summaryrefslogtreecommitdiff
path: root/plugins/MyDetails
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-04-22 11:55:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-04-22 11:55:14 +0300
commit7e78fedfc9565202902d7b4c8facc96ceab988ee (patch)
tree0ff1bc0bd5d7434794dfd1593dc8b92fbfce750e /plugins/MyDetails
parentd5ac80725ea40736751aa74526254ee2d12ce59e (diff)
MyDetails:
- another ancient perversion with pointers to global arrays exterminated; - handmade dynamic array replaced with standard OBJLIST<>; - array iterators; - version bump
Diffstat (limited to 'plugins/MyDetails')
-rw-r--r--plugins/MyDetails/src/data.cpp83
-rw-r--r--plugins/MyDetails/src/data.h44
-rw-r--r--plugins/MyDetails/src/frame.cpp155
-rw-r--r--plugins/MyDetails/src/mydetails.cpp2
-rw-r--r--plugins/MyDetails/src/services.cpp119
-rw-r--r--plugins/MyDetails/src/version.h8
6 files changed, 174 insertions, 237 deletions
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp
index 086901bf6b..b6a4c95ecf 100644
--- a/plugins/MyDetails/src/data.cpp
+++ b/plugins/MyDetails/src/data.cpp
@@ -21,12 +21,10 @@ Boston, MA 02111-1307, USA.
static char *StatusModeToDbSetting(int status, const char *suffix);
-ProtocolArray *protocols = nullptr;
+ProtocolArray protocols;
void InitProtocolData()
{
- protocols = new ProtocolArray(10);
-
for (auto &pa : Accounts()) {
if (pa->szModuleName == nullptr || pa->szModuleName[0] == '\0' || pa->bIsVirtual)
continue;
@@ -34,7 +32,7 @@ void InitProtocolData()
// Found a protocol
Protocol *p = new Protocol(pa->szModuleName, pa->tszAccountName);
if (p->IsValid())
- protocols->Add(p);
+ protocols.insert(p);
else
delete p;
}
@@ -42,7 +40,7 @@ void InitProtocolData()
void DeInitProtocolData()
{
- delete protocols;
+ protocols.destroy();
}
// Protocol Class ///////////////////////////////////////////////////////////////////////////////////////////
@@ -111,8 +109,7 @@ int Protocol::GetStatus()
if (CallProtoService(name, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&css) != 0)
tszXStatusMessage[0] = tszXStatusName[0] = 0, custom_status = 0;
}
- else
- custom_status = 0;
+ else custom_status = 0;
// if protocol supports custom status, but it is not set (custom_status will be -1), show normal status
if (custom_status < 0)
@@ -337,53 +334,21 @@ wchar_t *Protocol::GetListeningTo()
// ProtocolDataArray Class /////////////////////////////////////////////////////////////////////////////
-ProtocolArray::ProtocolArray(int max_size)
+ProtocolArray::ProtocolArray() :
+ OBJLIST<Protocol>(10)
{
- buffer = (Protocol **)malloc(max_size * sizeof(Protocol *));
- buffer_len = 0;
-
GetDefaultNick();
GetDefaultAvatar();
}
-
-ProtocolArray::~ProtocolArray()
-{
- if (buffer != nullptr) {
- for (int i = 0; i < buffer_len; i++)
- delete buffer[i];
- free(buffer);
- }
-}
-
-
-int ProtocolArray::GetSize()
-{
- return buffer_len;
-}
-
-
-void ProtocolArray::Add(Protocol *p)
-{
- buffer[buffer_len] = p;
- buffer_len++;
-}
-
-
-Protocol *ProtocolArray::Get(int i)
-{
- return (i >= buffer_len) ? nullptr : buffer[i];
-}
-
-
-Protocol *ProtocolArray::Get(const char *name)
+Protocol* ProtocolArray::GetByName(const char *name)
{
if (name == nullptr)
return nullptr;
- for (int i = 0; i < buffer_len; i++)
- if (mir_strcmp(name, buffer[i]->name) == 0)
- return buffer[i];
+ for (auto &it: *this)
+ if (mir_strcmp(name, it->name) == 0)
+ return it;
return nullptr;
}
@@ -394,23 +359,22 @@ bool ProtocolArray::CanSetStatusMsgPerProtocol()
return ServiceExists(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG) != 0;
}
-
void ProtocolArray::GetAvatars()
{
- for (int i = 0; i < buffer_len; i++)
- buffer[i]->GetAvatar();
+ for (auto &it: *this)
+ it->GetAvatar();
}
void ProtocolArray::GetStatusMsgs()
{
- for (int i = 0; i < buffer_len; i++)
- buffer[i]->GetStatusMsg();
+ for (auto &it: *this)
+ it->GetStatusMsg();
}
void ProtocolArray::GetStatuses()
{
- for (int i = 0; i < buffer_len; i++)
- buffer[i]->GetStatus();
+ for (auto &it: *this)
+ it->GetStatus();
}
int ProtocolArray::GetGlobalStatus()
@@ -444,11 +408,10 @@ void ProtocolArray::SetNicks(const wchar_t *nick)
g_plugin.setWString(SETTING_DEFAULT_NICK, nick);
- for (int i = 0; i < buffer_len; i++)
- buffer[i]->SetNick(default_nick);
+ for (auto &it: *this)
+ it->SetNick(default_nick);
}
-
void ProtocolArray::SetStatus(int aStatus)
{
Clist_SetStatusMode(aStatus);
@@ -468,9 +431,9 @@ void ProtocolArray::SetStatusMsgs(int status, const wchar_t *message)
if (!db_get_b(0, "SRAway", StatusModeToDbSetting(status, "UsePrev"), 0))
db_set_ws(0, "SRAway", StatusModeToDbSetting(status, "Default"), message);
- for (int i = 0; i < buffer_len; i++)
- if (buffer[i]->status == status)
- buffer[i]->SetStatusMsg(status, message);
+ for (auto &it: *this)
+ if (it->status == status)
+ it->SetStatusMsg(status, message);
}
void ProtocolArray::GetDefaultNick()
@@ -487,12 +450,12 @@ void ProtocolArray::GetDefaultAvatar()
wcsncpy_s(default_avatar_file, ptrW(db_get_wsa(0, "ContactPhoto", "File", L"")), _TRUNCATE);
}
-wchar_t *ProtocolArray::GetDefaultStatusMsg()
+wchar_t* ProtocolArray::GetDefaultStatusMsg()
{
return GetDefaultStatusMsg(CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
}
-wchar_t *ProtocolArray::GetDefaultStatusMsg(int status)
+wchar_t* ProtocolArray::GetDefaultStatusMsg(int status)
{
default_status_message[0] = '\0';
diff --git a/plugins/MyDetails/src/data.h b/plugins/MyDetails/src/data.h
index 5f70525f38..d54a40e2d2 100644
--- a/plugins/MyDetails/src/data.h
+++ b/plugins/MyDetails/src/data.h
@@ -93,47 +93,34 @@ public:
void SetStatusMsg(int aStatus, const wchar_t *message);
};
-
-
-class ProtocolArray
+struct ProtocolArray : public OBJLIST<Protocol>
{
-protected:
- // Attributes ////////////
- Protocol **buffer;
- int buffer_len;
-
-public:
wchar_t default_nick[256];
wchar_t default_avatar_file[256];
wchar_t default_status_message[256];
// Methods ///////////////
- ProtocolArray(int max_size);
- virtual ~ProtocolArray();
+ ProtocolArray();
- int GetSize();
-
- void Add(Protocol *p);
- Protocol *Get(int i);
- Protocol *Get(const char *name);
+ Protocol* GetByName(const char *name);
void GetAvatars();
- bool CanSetAvatars();
- void SetAvatars(const wchar_t *file);
void SetNicks(const wchar_t *nick);
- void SetStatus(int aStatus);
+ void GetStatusMsgs();
+ void GetStatuses();
+
+ static bool CanSetAvatars();
+ static void SetAvatars(const wchar_t *file);
+ static bool CanSetStatusMsgPerProtocol();
+ static void SetStatus(int aStatus);
void SetStatusMsgs(const wchar_t *message);
void SetStatusMsgs(int status, const wchar_t *message);
- void GetStatusMsgs();
- void GetStatuses();
- int GetGlobalStatus();
-
- bool CanSetStatusMsgPerProtocol();
+ static int GetGlobalStatus();
void GetDefaultNick(); // Copy to cache
void GetDefaultAvatar(); // Copy to cache
@@ -144,16 +131,9 @@ public:
bool ListeningToEnabled();
};
-extern ProtocolArray *protocols;
-
-
+extern ProtocolArray protocols;
void InitProtocolData();
void DeInitProtocolData();
-
-
-
-
-
#endif // __DATA_H__
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp
index 8d2dc7f25c..b4954723fd 100644
--- a/plugins/MyDetails/src/frame.cpp
+++ b/plugins/MyDetails/src/frame.cpp
@@ -482,7 +482,7 @@ RECT GetRect(HDC hdc, RECT rc, SIZE s, UINT uFormat, int next_top, int text_left
return r;
}
-RECT GetRect(HDC hdc, RECT rc, const wchar_t *text, const wchar_t *def_text, Protocol *proto, UINT uFormat,
+RECT GetRect(HDC hdc, RECT rc, const wchar_t *text, const wchar_t *def_text, Protocol &proto, UINT uFormat,
int next_top, int text_left, bool smileys = true, bool frame = true, bool end_elipsis_on_frame = true)
{
const wchar_t *tmp;
@@ -507,7 +507,7 @@ RECT GetRect(HDC hdc, RECT rc, const wchar_t *text, const wchar_t *def_text, Pro
pos[0] = '\0';
if (smileys)
- DRAW_TEXT(hdc, tmp2, (int)mir_wstrlen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name);
+ DRAW_TEXT(hdc, tmp2, (int)mir_wstrlen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto.name);
else
DrawText(hdc, tmp2, -1, &r_tmp, uFormat | DT_CALCRECT);
@@ -602,14 +602,14 @@ void CalcRectangles(HWND hwnd)
return;
}
- Protocol *proto = protocols->Get(data->protocol_number);
- if (proto == nullptr) {
+ Protocol &proto = protocols[data->protocol_number];
+ if (&proto == nullptr) {
ReleaseDC(hwnd, hdc);
return;
}
data->recalc_rectangles = false;
- proto->data_changed = false;
+ proto.data_changed = false;
data->draw_proto = false;
data->draw_proto_cycle = false;
@@ -673,12 +673,12 @@ void CalcRectangles(HWND hwnd)
text_left = r.left;
// Draw image?
- if (proto->CanGetAvatar()) {
- if (proto->avatar_bmp != nullptr) {
+ if (proto.CanGetAvatar()) {
+ if (proto.avatar_bmp != nullptr) {
data->draw_img = true;
BITMAP bmp;
- if (GetObject(proto->avatar_bmp, sizeof(bmp), &bmp)) {
+ if (GetObject(proto.avatar_bmp, sizeof(bmp), &bmp)) {
// make bounds
RECT rc = r;
@@ -733,9 +733,9 @@ void CalcRectangles(HWND hwnd)
data->draw_nick = true;
SelectObject(hdc, hFont[FONT_NICK]);
- data->nick_rect = GetRect(hdc, r, proto->nickname, DEFAULT_NICKNAME, proto, uFormat, next_top, text_left);
+ data->nick_rect = GetRect(hdc, r, proto.nickname, DEFAULT_NICKNAME, proto, uFormat, next_top, text_left);
- if (proto->nickname[0] != '\0')
+ if (proto.nickname[0] != '\0')
data->nick_tt_hwnd = CreateTooltip(hwnd, data->nick_rect);
next_top = data->nick_rect.bottom + SPACE_TEXT_TEXT;
@@ -758,7 +758,7 @@ void CalcRectangles(HWND hwnd)
if (opts.show_protocol_cycle_button)
tmp_r.right -= 2 * ICON_SIZE;
- data->proto_rect = GetRect(hdc, tmp_r, proto->description, L"", proto, uFormat, next_top, tmp_text_left, false, true, false);
+ data->proto_rect = GetRect(hdc, tmp_r, proto.description, L"", proto, uFormat, next_top, tmp_text_left, false, true, false);
if (opts.show_protocol_cycle_button) {
data->draw_proto_cycle = true;
@@ -819,7 +819,7 @@ void CalcRectangles(HWND hwnd)
// Text size
RECT r_tmp = r;
- DrawText(hdc, proto->status_name, -1, &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
+ DrawText(hdc, proto.status_name, -1, &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
SIZE s;
s.cy = max(r_tmp.bottom - r_tmp.top, ICON_SIZE);
@@ -828,7 +828,7 @@ void CalcRectangles(HWND hwnd)
// Status global rect
data->status_rect = GetRect(hdc, r, s, uFormat, next_top, text_left, true, false);
- if (proto->status_name[0] != '\0')
+ if (proto.status_name[0] != '\0')
data->status_tt_hwnd = CreateTooltip(hwnd, data->status_rect);
next_top = data->status_rect.bottom + SPACE_TEXT_TEXT;
@@ -874,14 +874,14 @@ void CalcRectangles(HWND hwnd)
text_left = r.left;
// Away msg?
- if (proto->CanGetStatusMsg()) {
+ if (proto.CanGetStatusMsg()) {
data->draw_away_msg = true;
SelectObject(hdc, hFont[FONT_AWAY_MSG]);
- data->away_msg_rect = GetRect(hdc, r, proto->status_message, DEFAULT_STATUS_MESSAGE, proto, uFormat, next_top, text_left);
+ data->away_msg_rect = GetRect(hdc, r, proto.status_message, DEFAULT_STATUS_MESSAGE, proto, uFormat, next_top, text_left);
- if (proto->status_message[0] != '\0')
+ if (proto.status_message[0] != '\0')
data->away_msg_tt_hwnd = CreateTooltip(hwnd, data->away_msg_rect);
next_top = data->away_msg_rect.bottom + SPACE_TEXT_TEXT;
@@ -895,13 +895,13 @@ void CalcRectangles(HWND hwnd)
text_left = r.left;
// Listening to
- if (proto->ListeningToEnabled() && proto->GetStatus() > ID_STATUS_OFFLINE) {
+ if (proto.ListeningToEnabled() && proto.GetStatus() > ID_STATUS_OFFLINE) {
data->draw_listening_to = true;
- if (proto->listening_to[0] == '\0') {
+ if (proto.listening_to[0] == '\0') {
SelectObject(hdc, hFont[FONT_LISTENING_TO]);
- data->listening_to_rect = GetRect(hdc, r, proto->listening_to, DEFAULT_LISTENING_TO, proto, uFormat, next_top, text_left);
+ data->listening_to_rect = GetRect(hdc, r, proto.listening_to, DEFAULT_LISTENING_TO, proto, uFormat, next_top, text_left);
data->listening_to_text_rect = data->listening_to_rect;
memset(&data->listening_to_icon_rect, 0, sizeof(data->listening_to_icon_rect));
@@ -913,7 +913,7 @@ void CalcRectangles(HWND hwnd)
// Text size
RECT r_tmp = r;
- DrawText(hdc, proto->listening_to, -1, &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
+ DrawText(hdc, proto.listening_to, -1, &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
SIZE s;
s.cy = max(r_tmp.bottom - r_tmp.top, ICON_SIZE);
@@ -1032,7 +1032,7 @@ void EraseBackground(HWND hwnd, HDC hdc)
}
}
-void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, RECT rc, UINT uFormat, bool mouse_over, Protocol *proto)
+void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, RECT rc, UINT uFormat, bool mouse_over, Protocol &proto)
{
const wchar_t *tmp;
if (text[0] == '\0')
@@ -1084,7 +1084,7 @@ void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, REC
}
}
- DRAW_TEXT(hdc, tmp2, (int)mir_wstrlen(tmp2), &r, uFormat, proto->name);
+ DRAW_TEXT(hdc, tmp2, (int)mir_wstrlen(tmp2), &r, uFormat, proto.name);
if (mouse_over)
DrawText(hdc, L" ...", 4, &rc_tmp, uFormat);
@@ -1101,14 +1101,14 @@ void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, REC
void Draw(HWND hwnd, HDC hdc_orig)
{
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- Protocol *proto = protocols->Get(data->protocol_number);
+ Protocol &proto = protocols[data->protocol_number];
- if (proto == nullptr) {
+ if (&proto == nullptr) {
EraseBackground(hwnd, hdc_orig);
return;
}
- if (data->recalc_rectangles || proto->data_changed)
+ if (data->recalc_rectangles || proto.data_changed)
CalcRectangles(hwnd);
RECT r_full;
@@ -1166,7 +1166,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
adr.clrBorder = opts.draw_avatar_border_color;
adr.radius = round_radius;
adr.alpha = 255;
- adr.szProto = proto->name;
+ adr.szProto = proto.name;
CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&adr);
// Clipping rgn
@@ -1183,7 +1183,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectObject(hdc, hFont[FONT_NICK]);
SetTextColor(hdc, font_colour[FONT_NICK]);
- DrawTextWithRect(hdc, proto->nickname, DEFAULT_NICKNAME, rc, uFormat, data->mouse_over_nick && proto->CanSetNick(), proto);
+ DrawTextWithRect(hdc, proto.nickname, DEFAULT_NICKNAME, rc, uFormat, data->mouse_over_nick && proto.CanSetNick(), proto);
// Clipping rgn
SelectClipRgn(hdc, nullptr);
@@ -1234,7 +1234,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectObject(hdc, hFont[FONT_PROTO]);
SetTextColor(hdc, font_colour[FONT_PROTO]);
- DrawText(hdc, proto->description, -1, &rr, uFormat);
+ DrawText(hdc, proto.description, -1, &rr, uFormat);
// Clipping rgn
SelectClipRgn(hdc, nullptr);
@@ -1258,10 +1258,10 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectClipRgn(hdc, rgn);
HICON status_icon;
- if (proto->custom_status != 0 && ProtoServiceExists(proto->name, PS_GETCUSTOMSTATUSICON))
- status_icon = (HICON)CallProtoService(proto->name, PS_GETCUSTOMSTATUSICON, proto->custom_status, LR_SHARED);
+ if (proto.custom_status != 0 && ProtoServiceExists(proto.name, PS_GETCUSTOMSTATUSICON))
+ status_icon = (HICON)CallProtoService(proto.name, PS_GETCUSTOMSTATUSICON, proto.custom_status, LR_SHARED);
else
- status_icon = Skin_LoadProtoIcon(proto->name, proto->status);
+ status_icon = Skin_LoadProtoIcon(proto.name, proto.status);
if (status_icon != nullptr) {
DrawIconEx(hdc, data->status_icon_rect.left, data->status_icon_rect.top, status_icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
@@ -1278,7 +1278,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectObject(hdc, hFont[FONT_STATUS]);
SetTextColor(hdc, font_colour[FONT_STATUS]);
- DRAW_TEXT(hdc, proto->status_name, (int)mir_wstrlen(proto->status_name), &rc, uFormat, proto->name);
+ DRAW_TEXT(hdc, proto.status_name, (int)mir_wstrlen(proto.status_name), &rc, uFormat, proto.name);
SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
@@ -1296,8 +1296,8 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectObject(hdc, hFont[FONT_AWAY_MSG]);
SetTextColor(hdc, font_colour[FONT_AWAY_MSG]);
- DrawTextWithRect(hdc, proto->status_message, DEFAULT_STATUS_MESSAGE, rc, uFormat,
- data->mouse_over_away_msg && proto->CanSetStatusMsg(), proto);
+ DrawTextWithRect(hdc, proto.status_message, DEFAULT_STATUS_MESSAGE, rc, uFormat,
+ data->mouse_over_away_msg && proto.CanSetStatusMsg(), proto);
// Clipping rgn
SelectClipRgn(hdc, nullptr);
@@ -1314,8 +1314,8 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectObject(hdc, hFont[FONT_LISTENING_TO]);
SetTextColor(hdc, font_colour[FONT_LISTENING_TO]);
- DrawTextWithRect(hdc, proto->listening_to, DEFAULT_LISTENING_TO, rc, uFormat,
- data->mouse_over_listening_to && protocols->CanSetListeningTo(), proto);
+ DrawTextWithRect(hdc, proto.listening_to, DEFAULT_LISTENING_TO, rc, uFormat,
+ data->mouse_over_listening_to && protocols.CanSetListeningTo(), proto);
// Clipping rgn
SelectClipRgn(hdc, nullptr);
@@ -1349,12 +1349,12 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectObject(hdc, hFont[FONT_LISTENING_TO]);
SetTextColor(hdc, font_colour[FONT_LISTENING_TO]);
- DrawText(hdc, proto->listening_to, -1, &rc, uFormat);
+ DrawText(hdc, proto.listening_to, -1, &rc, uFormat);
SelectClipRgn(hdc, nullptr);
DeleteObject(rgn);
- if (data->mouse_over_listening_to && protocols->CanSetListeningTo())
+ if (data->mouse_over_listening_to && protocols.CanSetListeningTo())
FrameRect(hdc, &rtmp, (HBRUSH)GetStockObject(GRAY_BRUSH));
}
}
@@ -1412,7 +1412,7 @@ void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, POINT &p)
Clist_MenuProcessCommand(LOWORD(ret), MPCF_MAINMENU, 0);
}
-void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
+static void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
{
HMENU menu = Menu_GetStatusMenu();
HMENU submenu = nullptr;
@@ -1439,7 +1439,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto
}
}
- if (submenu == nullptr && protocols->GetSize() == 1)
+ if (submenu == nullptr && protocols.getCount() == 1)
submenu = menu;
}
@@ -1480,7 +1480,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto
}
}
-void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
+static void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
{
HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 5);
@@ -1507,9 +1507,9 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STATE;
- mii.fState = protocols->ListeningToEnabled() ? MFS_CHECKED : 0;
+ mii.fState = protocols.ListeningToEnabled() ? MFS_CHECKED : 0;
- if (!protocols->CanSetListeningTo())
+ if (!protocols.CanSetListeningTo())
mii.fState |= MFS_DISABLED;
SetMenuItemInfo(submenu, ID_LISTENINGTOPOPUP_SENDLISTENINGTO, FALSE, &mii);
@@ -1528,7 +1528,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P
break;
case ID_LISTENINGTOPOPUP_SENDLISTENINGTO:
- CallService(MS_LISTENINGTO_ENABLE, 0, !protocols->ListeningToEnabled());
+ CallService(MS_LISTENINGTO_ENABLE, 0, !protocols.ListeningToEnabled());
break;
}
}
@@ -1550,7 +1550,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
data->showing_menu = false;
data->protocol_number = db_get_w(0, "MyDetails", "ProtocolNumber", 0);
- if (data->protocol_number >= protocols->GetSize())
+ if (data->protocol_number >= protocols.getCount())
data->protocol_number = 0;
SetCycleTime(hwnd);
@@ -1596,8 +1596,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
SetStatusMessageRefreshTime(hwnd);
data->get_status_messages = false;
- protocols->GetStatuses();
- protocols->GetStatusMsgs();
+ protocols.GetStatuses();
+ protocols.GetStatusMsgs();
data->recalc_rectangles = true;
}
@@ -1615,7 +1615,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
return TRUE;
case WM_LBUTTONUP:
- proto = protocols->Get(data->protocol_number);
+ proto = &protocols[data->protocol_number];
if (proto != nullptr) {
POINT p;
p.x = LOWORD(lParam);
@@ -1660,7 +1660,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
data->showing_menu = false;
}
// In listening to?
- else if (data->draw_listening_to && InsideRect(&p, &data->listening_to_rect) && protocols->CanSetListeningTo())
+ else if (data->draw_listening_to && InsideRect(&p, &data->listening_to_rect) && protocols.CanSetListeningTo())
ShowListeningToMenu(hwnd, data, proto, p);
// In protocol?
@@ -1669,13 +1669,13 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
HMENU menu = CreatePopupMenu();
- for (int i = protocols->GetSize() - 1; i >= 0; i--) {
- MENUITEMINFO mii = { 0 };
+ for (int i = protocols.getCount() - 1; i >= 0; i--) {
+ MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
- mii.dwTypeData = protocols->Get(i)->description;
- mii.cch = (int)mir_wstrlen(protocols->Get(i)->description);
+ mii.dwTypeData = protocols[i].description;
+ mii.cch = (int)mir_wstrlen(mii.dwTypeData);
mii.wID = i + 1;
if (i == data->protocol_number) {
@@ -1697,7 +1697,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
DestroyMenu(menu);
if (ret != 0)
- PluginCommand_ShowProtocol(NULL, (WPARAM)protocols->Get(ret - 1)->name);
+ PluginCommand_ShowProtocol(NULL, (WPARAM)protocols[ret - 1].name);
data->showing_menu = false;
}
@@ -1711,7 +1711,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
return Menu_DrawItem(lParam);
case WM_CONTEXTMENU:
- proto = protocols->Get(data->protocol_number);
+ proto = &protocols[data->protocol_number];
if (proto != nullptr) {
POINT p = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
ScreenToClient(hwnd, &p);
@@ -1812,7 +1812,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
HMENU submenu = GetSubMenu(menu, 3);
TranslateMenu(submenu);
- if (protocols->CanSetStatusMsgPerProtocol()) {
+ if (protocols.CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
mir_snwprintf(tmp, TranslateT("Set my status message for %s..."), proto->description);
@@ -1877,7 +1877,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
ShowGlobalStatusMenu(hwnd, data, p);
}
// In listening to?
- else if (data->draw_listening_to && InsideRect(&p, &data->listening_to_rect) && protocols->CanSetListeningTo())
+ else if (data->draw_listening_to && InsideRect(&p, &data->listening_to_rect) && protocols.CanSetListeningTo())
ShowListeningToMenu(hwnd, data, proto, p);
// In protocol?
@@ -1929,7 +1929,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
InsertMenuItem(submenu, 0, TRUE, &mii);
- if (protocols->CanSetStatusMsgPerProtocol()) {
+ if (protocols.CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
mir_snwprintf(tmp, TranslateT("Set my status message for %s..."), proto->description);
@@ -1986,9 +1986,9 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STATE;
- mii.fState = protocols->ListeningToEnabled() ? MFS_CHECKED : 0;
+ mii.fState = protocols.ListeningToEnabled() ? MFS_CHECKED : 0;
- if (!protocols->CanSetListeningTo())
+ if (!protocols.CanSetListeningTo())
mii.fState |= MFS_DISABLED;
SetMenuItemInfo(submenu, ID_CONTEXTPOPUP_ENABLELISTENINGTO, FALSE, &mii);
@@ -2032,7 +2032,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
break;
case ID_CONTEXTPOPUP_ENABLELISTENINGTO:
- CallService(MS_LISTENINGTO_ENABLE, 0, !protocols->ListeningToEnabled());
+ CallService(MS_LISTENINGTO_ENABLE, 0, !protocols.ListeningToEnabled());
break;
case ID_SHOW_NEXT_PROTO:
@@ -2054,8 +2054,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
}
data->showing_menu = false;
- break;
}
+ break;
case WM_NCMOUSELEAVE:
case WM_MOUSELEAVE:
@@ -2086,8 +2086,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
TrackMouseEvent(&tme);
}
case WM_MOUSEMOVE:
- proto = protocols->Get(data->protocol_number);
- if (proto != nullptr) {
+ if (&proto != nullptr) {
POINT p = { LOWORD(lParam), HIWORD(lParam) };
MakeHover(hwnd, data->draw_img, &data->mouse_over_img, &p, &data->img_rect);
MakeHover(hwnd, data->draw_nick, &data->mouse_over_nick, &p, &data->nick_rect);
@@ -2103,7 +2102,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
LPNMHDR lpnmhdr = (LPNMHDR)lParam;
switch (lpnmhdr->code) {
case TTN_GETDISPINFO:
- proto = protocols->Get(data->protocol_number);
+ proto = &protocols[data->protocol_number];
LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lpnmhdr;
SendMessage(lpnmhdr->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300);
@@ -2142,7 +2141,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
break;
case MWM_AVATAR_CHANGED:
- proto = protocols->Get((const char *)wParam);
+ proto = protocols.GetByName((const char *)wParam);
if (proto != nullptr) {
proto->GetAvatar();
RefreshFrame();
@@ -2150,7 +2149,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
break;
case MWM_NICK_CHANGED:
- proto = protocols->Get((const char *)wParam);
+ proto = protocols.GetByName((const char *)wParam);
if (proto != nullptr) {
proto->GetNick();
RefreshFrame();
@@ -2158,7 +2157,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
break;
case MWM_STATUS_CHANGED:
- proto = protocols->Get((const char *)wParam);
+ proto = protocols.GetByName((const char *)wParam);
if (proto != nullptr) {
proto->GetStatus();
proto->GetStatusMsg();
@@ -2175,7 +2174,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
case MWM_LISTENINGTO_CHANGED:
if (wParam != NULL) {
- proto = protocols->Get((const char *)wParam);
+ proto = protocols.GetByName((const char *)wParam);
if (proto != nullptr)
proto->GetListeningTo();
}
@@ -2319,7 +2318,7 @@ INT_PTR PluginCommand_ShowNextProtocol(WPARAM, LPARAM)
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
data->protocol_number++;
- if (data->protocol_number >= protocols->GetSize())
+ if (data->protocol_number >= protocols.getCount())
data->protocol_number = 0;
db_set_w(0, "MyDetails", "ProtocolNumber", data->protocol_number);
@@ -2342,7 +2341,7 @@ INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM, LPARAM)
data->protocol_number--;
if (data->protocol_number < 0)
- data->protocol_number = protocols->GetSize() - 1;
+ data->protocol_number = protocols.getCount() - 1;
db_set_w(0, "MyDetails", "ProtocolNumber", data->protocol_number);
@@ -2362,9 +2361,9 @@ INT_PTR PluginCommand_ShowProtocol(WPARAM, LPARAM lParam)
return -1;
int proto_num = -1;
- for (int i = 0; i < protocols->GetSize(); i++) {
- if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
- proto_num = i;
+ for (auto &it : protocols) {
+ if (mir_strcmpi(it->name, proto) == 0) {
+ proto_num = protocols.indexOf(&it);
break;
}
}
@@ -2397,7 +2396,7 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam)
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
if ((HANDLE)wParam == nullptr) {
- Protocol *proto = protocols->Get(cws->szModule);
+ Protocol *proto = protocols.GetByName(cws->szModule);
if (!strcmp(cws->szSetting, "MyHandle")
|| !strcmp(cws->szSetting, "UIN")
@@ -2425,7 +2424,7 @@ int AvatarChangedHook(WPARAM wParam, LPARAM)
if (hwnd_frame == nullptr)
return 0;
- Protocol *proto = protocols->Get((const char *)wParam);
+ Protocol *proto = protocols.GetByName((const char *)wParam);
if (proto != nullptr)
PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM)proto->name, 0);
@@ -2442,7 +2441,7 @@ int ProtoAckHook(WPARAM, LPARAM lParam)
if (ack->result != ACKRESULT_SUCCESS)
return 0;
- Protocol *proto = protocols->Get(ack->szModule);
+ Protocol *proto = protocols.GetByName(ack->szModule);
switch (ack->type) {
case ACKTYPE_STATUS:
if (proto != nullptr)
@@ -2468,7 +2467,7 @@ int ListeningtoEnableStateChangedHook(WPARAM wParam, LPARAM)
if (hwnd_frame == nullptr)
return 0;
- if (wParam == NULL || protocols->Get((const char *)wParam) != nullptr)
+ if (wParam == NULL || protocols.GetByName((const char *)wParam) != nullptr)
PostMessage(hwnd_frame, MWM_LISTENINGTO_CHANGED, wParam, 0);
return 0;
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp
index e493b38fdd..ad6d333b0b 100644
--- a/plugins/MyDetails/src/mydetails.cpp
+++ b/plugins/MyDetails/src/mydetails.cpp
@@ -87,7 +87,7 @@ static int MainInit(WPARAM, LPARAM)
mi.root = hMenuRoot;
mi.hIcolibItem = nullptr;
- if (protocols->CanSetAvatars()) {
+ if (protocols.CanSetAvatars()) {
SET_UID(mi, 0xe5b2d79e, 0xd25a, 0x4f72, 0xa4, 0x1a, 0x21, 0xfd, 0x48, 0x6b, 0xb5, 0x6);
mi.position = 100001;
mi.name.w = LPGENW("Set my avatar...");
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp
index b5089e9a42..e6cd8d5dfa 100644
--- a/plugins/MyDetails/src/services.cpp
+++ b/plugins/MyDetails/src/services.cpp
@@ -45,41 +45,41 @@ public:
Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_OTHER_MIRANDA);
// All protos have the same nick?
- if (protocols->GetSize() > 0) {
- wchar_t *nick = protocols->Get(0)->nickname;
+ if (protocols.getCount() > 0) {
+ wchar_t *nick = protocols[0].nickname;
bool foundDefNick = true;
- for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) {
- if (mir_wstrcmpi(protocols->Get(i)->nickname, nick) != 0) {
+ for (int i = 1; foundDefNick && i < protocols.getCount(); i++) {
+ if (mir_wstrcmpi(protocols[i].nickname, nick) != 0) {
foundDefNick = false;
break;
}
}
if (foundDefNick)
- if (mir_wstrcmpi(protocols->default_nick, nick) != 0)
- mir_wstrcpy(protocols->default_nick, nick);
+ if (mir_wstrcmpi(protocols.default_nick, nick) != 0)
+ mir_wstrcpy(protocols.default_nick, nick);
}
- m_edtNickname.SetText(protocols->default_nick);
+ m_edtNickname.SetText(protocols.default_nick);
m_edtNickname.SendMsg(EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, 0);
}
else {
- Protocol *proto = protocols->Get(m_protonum);
+ auto &proto = protocols[m_protonum];
wchar_t tmp[128];
- mir_snwprintf(tmp, TranslateT("Set my nickname for %s"), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my nickname for %s"), proto.description);
SetWindowText(m_hwnd, tmp);
- HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0);
+ HICON hIcon = (HICON)CallProtoService(proto.name, PS_LOADICON, PLI_PROTOCOL, 0);
if (hIcon != nullptr) {
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
DestroyIcon(hIcon);
}
- m_edtNickname.SetText(proto->nickname);
- m_edtNickname.SendMsg(EM_LIMITTEXT, min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0);
+ m_edtNickname.SetText(proto.nickname);
+ m_edtNickname.SendMsg(EM_LIMITTEXT, min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto.GetNickMaxLength()), 0);
}
return true;
}
@@ -90,9 +90,9 @@ public:
m_edtNickname.GetText(tmp, _countof(tmp));
if (m_protonum == -1)
- protocols->SetNicks(tmp);
+ protocols.SetNicks(tmp);
else
- protocols->Get(m_protonum)->SetNick(tmp);
+ protocols[m_protonum].SetNick(tmp);
return true;
}
@@ -109,10 +109,9 @@ INT_PTR PluginCommand_SetMyNicknameUI(WPARAM, LPARAM lParam)
int proto_num = -1;
if (proto != nullptr) {
- int i;
- for (i = 0; i < protocols->GetSize(); i++) {
- if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
- proto_num = i;
+ for (auto &it: protocols) {
+ if (mir_strcmpi(it->name, proto) == 0) {
+ proto_num = protocols.indexOf(&it);
break;
}
}
@@ -120,7 +119,7 @@ INT_PTR PluginCommand_SetMyNicknameUI(WPARAM, LPARAM lParam)
if (proto_num == -1)
return -1;
- if (!protocols->Get(i)->CanSetNick())
+ if (!protocols[proto_num].CanSetNick())
return -2;
}
@@ -141,12 +140,12 @@ INT_PTR PluginCommand_SetMyNickname(WPARAM wParam, LPARAM lParam)
{
char *proto = (char *)wParam;
if (proto != nullptr) {
- for (int i = 0; i < protocols->GetSize(); i++) {
- if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
- if (!protocols->Get(i)->CanSetNick())
+ for (auto &it : protocols) {
+ if (mir_strcmpi(it->name, proto) == 0) {
+ if (!it->CanSetNick())
return -2;
- protocols->Get(i)->SetNick((wchar_t *)lParam);
+ it->SetNick((wchar_t *)lParam);
return 0;
}
}
@@ -154,7 +153,7 @@ INT_PTR PluginCommand_SetMyNickname(WPARAM wParam, LPARAM lParam)
return -1;
}
- protocols->SetNicks((wchar_t *)lParam);
+ protocols.SetNicks((wchar_t *)lParam);
return 0;
}
@@ -166,11 +165,11 @@ INT_PTR PluginCommand_GetMyNickname(WPARAM wParam, LPARAM lParam)
char *proto = (char *)wParam;
if (proto == nullptr) {
- mir_wstrncpy(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
+ mir_wstrncpy(ret, protocols.default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
return 0;
}
else {
- Protocol *protocol = protocols->Get(proto);
+ Protocol *protocol = protocols.GetByName(proto);
if (protocol != nullptr) {
mir_wstrncpy(ret, protocol->nickname, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
return 0;
@@ -188,25 +187,23 @@ INT_PTR PluginCommand_SetMyAvatarUI(WPARAM, LPARAM lParam)
int proto_num = -1;
if (proto != nullptr) {
- int i;
- for (i = 0; i < protocols->GetSize(); i++) {
- if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
- proto_num = i;
+ for (auto &it : protocols)
+ if (mir_strcmpi(it->name, proto) == 0) {
+ proto_num = protocols.indexOf(&it);
break;
}
- }
if (proto_num == -1)
return -1;
- if (!protocols->Get(i)->CanSetAvatar())
+ if (!protocols[proto_num].CanSetAvatar())
return -2;
}
if (proto_num == -1)
- protocols->SetAvatars(nullptr);
+ protocols.SetAvatars(nullptr);
else
- protocols->Get(proto_num)->SetAvatar(nullptr);
+ protocols[proto_num].SetAvatar(nullptr);
return 0;
}
@@ -215,12 +212,12 @@ INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam, LPARAM lParam)
{
char *proto = (char *)wParam;
if (proto != nullptr) {
- for (int i = 0; i < protocols->GetSize(); i++) {
- if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
- if (!protocols->Get(i)->CanSetAvatar())
+ for (auto &it: protocols) {
+ if (mir_strcmpi(it->name, proto) == 0) {
+ if (!it->CanSetAvatar())
return -2;
- protocols->Get(i)->SetAvatar((wchar_t *)lParam);
+ it->SetAvatar((wchar_t *)lParam);
return 0;
}
}
@@ -228,7 +225,7 @@ INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam, LPARAM lParam)
return -1;
}
- protocols->SetAvatars((wchar_t *)lParam);
+ protocols.SetAvatars((wchar_t *)lParam);
return 0;
}
@@ -241,19 +238,19 @@ INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam)
return -1;
if (proto == nullptr) {
- mir_wstrncpy(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
+ mir_wstrncpy(ret, protocols.default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
return 0;
}
- for (int i = 0; i < protocols->GetSize(); i++) {
- if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) {
- if (!protocols->Get(i)->CanGetAvatar())
+ for (auto &it: protocols) {
+ if (mir_strcmpi(it->name, proto) == 0) {
+ if (!it->CanGetAvatar())
return -2;
- protocols->Get(i)->GetAvatar();
+ it->GetAvatar();
- if (mir_wstrlen(protocols->Get(i)->avatar_file))
- mir_wstrncpy(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
+ if (mir_wstrlen(it->avatar_file))
+ mir_wstrncpy(ret, it->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
else
ret[0] = '\0';
@@ -306,19 +303,19 @@ public:
mir_subclassWindow(m_edtStatusMessage.GetHwnd(), StatusMsgEditSubclassProc);
if (m_data->proto_num >= 0) {
- Protocol *proto = protocols->Get(m_data->proto_num);
+ auto &proto = protocols[m_data->proto_num];
- HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0);
+ HICON hIcon = (HICON)CallProtoService(proto.name, PS_LOADICON, PLI_PROTOCOL, 0);
if (hIcon != nullptr) {
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
DestroyIcon(hIcon);
}
wchar_t title[256];
- mir_snwprintf(title, TranslateT("Set my status message for %s"), proto->description);
+ mir_snwprintf(title, TranslateT("Set my status message for %s"), proto.description);
SetWindowText(m_hwnd, title);
- m_edtStatusMessage.SetText(proto->GetStatusMsg());
+ m_edtStatusMessage.SetText(proto.GetStatusMsg());
}
else if (m_data->status != 0) {
Window_SetProtoIcon_IcoLib(m_hwnd, nullptr, m_data->status);
@@ -327,12 +324,12 @@ public:
mir_snwprintf(title, TranslateT("Set my status message for %s"), Clist_GetStatusModeDescription(m_data->status, 0));
SetWindowText(m_hwnd, title);
- m_edtStatusMessage.SetText(protocols->GetDefaultStatusMsg(m_data->status));
+ m_edtStatusMessage.SetText(protocols.GetDefaultStatusMsg(m_data->status));
}
else {
Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_OTHER_MIRANDA);
- m_edtStatusMessage.SetText(protocols->GetDefaultStatusMsg());
+ m_edtStatusMessage.SetText(protocols.GetDefaultStatusMsg());
}
return true;
}
@@ -343,11 +340,11 @@ public:
m_edtStatusMessage.GetText(tmp, _countof(tmp));
if (m_data->proto_num >= 0)
- protocols->Get(m_data->proto_num)->SetStatusMsg(tmp);
+ protocols[m_data->proto_num].SetStatusMsg(tmp);
else if (m_data->status == 0)
- protocols->SetStatusMsgs(tmp);
+ protocols.SetStatusMsgs(tmp);
else
- protocols->SetStatusMsgs(m_data->status, tmp);
+ protocols.SetStatusMsgs(m_data->status, tmp);
return true;
}
@@ -371,11 +368,9 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam)
return -10;
if (proto_name != nullptr) {
- for (int i = 0; i < protocols->GetSize(); i++) {
- proto = protocols->Get(i);
-
- if (mir_strcmpi(proto->name, proto_name) == 0) {
- proto_num = i;
+ for (auto &it: protocols) {
+ if (mir_strcmpi(it->name, proto_name) == 0) {
+ proto_num = protocols.indexOf(&it);
break;
}
}
@@ -383,7 +378,7 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam)
if (proto_num == -1)
return -1;
- if (protocols->CanSetStatusMsgPerProtocol() && !proto->CanSetStatusMsg())
+ if (protocols.CanSetStatusMsgPerProtocol() && !proto->CanSetStatusMsg())
return -2;
}
else if (ServiceExists(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG)) {
@@ -392,7 +387,7 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam)
else if (proto != nullptr)
CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, proto->status, (LPARAM)proto_name);
else
- CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, protocols->GetGlobalStatus(), NULL);
+ CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, protocols.GetGlobalStatus(), NULL);
return 0;
} // fallthrough
diff --git a/plugins/MyDetails/src/version.h b/plugins/MyDetails/src/version.h
index 263549e2b1..8a2c9b8369 100644
--- a/plugins/MyDetails/src/version.h
+++ b/plugins/MyDetails/src/version.h
@@ -1,7 +1,7 @@
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 12
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 1
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>