From b064f2ebde6d4a58141e5b2e8186c6ea53680f64 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 4 Apr 2018 21:25:32 +0300 Subject: CLIST_INTERFACE::pfnGetAccountIndexByPos => Clist_GetAccountIndex --- src/mir_app/src/clc.h | 1 - src/mir_app/src/clistcore.cpp | 2 +- src/mir_app/src/clisttray.cpp | 6 +++--- src/mir_app/src/menu_clist.cpp | 20 ++++++++++---------- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + src/mir_app/src/proto_order.cpp | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index 6a3dbe6e0f..dc58b0a330 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -113,7 +113,6 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam); /* clistmenus.c */ HGENMENU fnGetProtocolMenu(const char*); -int fnGetAccountIndexByPos(int Pos); int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos); void RebuildMenuOrder(void); diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index 780b692aa1..a0af48e533 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -188,7 +188,7 @@ void InitClistCore() cli.pfnGetProtoIndexByPos = fnGetProtoIndexByPos; cli.pfnReloadProtoMenus = fnReloadProtoMenus; - cli.pfnGetAccountIndexByPos = fnGetAccountIndexByPos; + cli.pfnGetProtocolMenu = fnGetProtocolMenu; cli.pfnReloadExtraIcons = fnReloadExtraIcons; diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 457e4c0b29..9ae7938ae9 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -92,7 +92,7 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) } for (int t = 0; t < accounts.getCount(); t++) { - int i = cli.pfnGetAccountIndexByPos(t); + int i = Clist_GetAccountIndex(t); if (i == -1) continue; @@ -249,7 +249,7 @@ int fnTrayIconInit(HWND hwnd) else if (trayIconSetting == SETTING_TRAYICON_MULTI && (averageMode < 0 || db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) { cli.trayIconCount = netProtoCount; for (int i = 0; i < accounts.getCount(); i++) { - int j = cli.pfnGetAccountIndexByPos(i); + int j = Clist_GetAccountIndex(i); if (j >= 0) { PROTOACCOUNT *pa = accounts[j]; if (pa->IsVisible()) @@ -685,7 +685,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) int ind = 0; for (int j = 0; j < accounts.getCount(); j++) { - int k = cli.pfnGetAccountIndexByPos(j); + int k = Clist_GetAccountIndex(j); if (k >= 0) { if (!mir_strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName)) { HMENU hm = GetSubMenu(hMenu, ind); diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index a94f7a283f..4cc25c3c32 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -714,6 +714,15 @@ MIR_APP_DLL(bool) Clist_GetProtocolVisibility(const char *szModuleName) return (pa) ? pa->IsVisible() : false; } +MIR_APP_DLL(int) Clist_GetAccountIndex(int Pos) +{ + for (auto &it : accounts) + if (it->iOrder == Pos) + return accounts.indexOf(&it); + + return -1; +} + int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos) { char buf[10]; @@ -734,15 +743,6 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos) return -1; } -int fnGetAccountIndexByPos(int Pos) -{ - for (auto &it : accounts) - if (it->iOrder == Pos) - return accounts.indexOf(&it); - - return -1; -} - void RebuildMenuOrder(void) { BYTE bHideStatusMenu = db_get_b(0, "CLUI", "DontHideStatusMenu", 0); // cool perversion, though @@ -769,7 +769,7 @@ void RebuildMenuOrder(void) FreeMenuProtos(); for (int s = 0; s < accounts.getCount(); s++) { - int i = cli.pfnGetAccountIndexByPos(s); + int i = Clist_GetAccountIndex(s); if (i == -1) continue; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 8e5792b29f..eda248c2e6 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -537,3 +537,4 @@ Clist_GetProtocolVisibility @556 ?Accounts@@YGAAU?$LIST@UPROTOACCOUNT@@@@XZ @557 NONAME Clist_InitAutoRebuild @558 Clist_GetContactIcon @559 +Clist_GetAccountIndex @560 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index f79999b61b..04c814f405 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -537,3 +537,4 @@ Clist_GetProtocolVisibility @556 ?Accounts@@YAAEAU?$LIST@UPROTOACCOUNT@@@@XZ @557 NONAME Clist_InitAutoRebuild @558 Clist_GetContactIcon @559 +Clist_GetAccountIndex @560 diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp index 738a5129dd..29b8ec8e42 100644 --- a/src/mir_app/src/proto_order.cpp +++ b/src/mir_app/src/proto_order.cpp @@ -119,7 +119,7 @@ class CProtocolOrderOpts : public CDlgBase tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; for (int i = 0; i < accounts.getCount(); i++) { - int idx = cli.pfnGetAccountIndexByPos(i); + int idx = Clist_GetAccountIndex(i); if (idx == -1) continue; -- cgit v1.2.3