summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-04 21:25:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-04 21:25:32 +0300
commitb064f2ebde6d4a58141e5b2e8186c6ea53680f64 (patch)
treeb01cf136a0b4b8f02697090cde4ed55c3f2832e2
parentd4b6de0fb4ca58063eb2f424c77e74e703022b63 (diff)
CLIST_INTERFACE::pfnGetAccountIndexByPos => Clist_GetAccountIndex
-rw-r--r--include/m_clistint.h8
-rw-r--r--libs/win32/mir_app.libbin145402 -> 145652 bytes
-rw-r--r--libs/win64/mir_app.libbin141268 -> 141498 bytes
-rw-r--r--plugins/Clist_modern/src/modern_statusbar.cpp4
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp4
-rw-r--r--src/mir_app/src/clc.h1
-rw-r--r--src/mir_app/src/clistcore.cpp2
-rw-r--r--src/mir_app/src/clisttray.cpp6
-rw-r--r--src/mir_app/src/menu_clist.cpp20
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/proto_order.cpp2
12 files changed, 24 insertions, 25 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h
index ef1771a4b7..8eb695413e 100644
--- a/include/m_clistint.h
+++ b/include/m_clistint.h
@@ -255,6 +255,9 @@ EXTERN_C MIR_APP_DLL(void) Clist_BroadcastAsync(int msg, WPARAM wParam, LPARAM l
EXTERN_C MIR_APP_DLL(bool) Clist_FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible);
EXTERN_C MIR_APP_DLL(void) Clist_InitAutoRebuild(HWND hWnd);
+// calculates account's index by its position in status bar
+EXTERN_C MIR_APP_DLL(int) Clist_GetAccountIndex(int iPos);
+
/////////////////////////////////////////////////////////////////////////////////////////
// CLIST_INTERFACE structure definition
@@ -471,11 +474,6 @@ struct CLIST_INTERFACE
VOID (CALLBACK *pfnTrayCycleTimerProc)(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
/*************************************************************************************
- * version 6 additions (0.8.0.x) - accounts
- *************************************************************************************/
- int (*pfnGetAccountIndexByPos)(int pos);
-
- /*************************************************************************************
* version 7 additions (0.11.0.x) - extra images
*************************************************************************************/
void (*pfnReloadExtraIcons)(void);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 1cec3160e6..eeff59c359 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 8da2a03460..1880edde52 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp
index 1b396c6652..e0d671598f 100644
--- a/plugins/Clist_modern/src/modern_statusbar.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar.cpp
@@ -173,7 +173,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
int iProtoInStatusMenu = 0;
for (int j = 0; j < accs.getCount(); j++) {
- int i = pcli->pfnGetAccountIndexByPos(j);
+ int i = Clist_GetAccountIndex(j);
if (i == -1)
continue;
@@ -795,7 +795,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
bool first = true;
for (int pos = 0; pos < protoCount; pos++) {
- int k = pcli->pfnGetAccountIndexByPos(pos);
+ int k = Clist_GetAccountIndex(pos);
if (k < 0 || k >= protoCount)
continue;
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index 7f88c7b9fe..c5567303d9 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -106,7 +106,7 @@ void CluiProtocolStatusChanged(int, const char*)
// count down since built in ones tend to go at the end
partCount = 0;
for (int i = 0; i < accs.getCount(); i++) {
- int idx = pcli->pfnGetAccountIndexByPos(i);
+ int idx = Clist_GetAccountIndex(i);
if (idx == -1)
continue;
@@ -151,7 +151,7 @@ void CluiProtocolStatusChanged(int, const char*)
char *szMaxProto = nullptr;
partCount = 0;
for (int i = 0; i < accs.getCount(); i++) {
- int idx = pcli->pfnGetAccountIndexByPos(i);
+ int idx = Clist_GetAccountIndex(i);
if (idx == -1)
continue;
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;