From 622d5101fe221d6839c859e0a643259f2cc474c9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 5 Nov 2013 18:46:19 +0000 Subject: - GetAverageMode moved to CLIST_INTERFACE; - copy of it removed from clist_modern git-svn-id: http://svn.miranda-ng.org/main/trunk@6793 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_clistint.h | 2 ++ .../Clist_modern/src/hdr/modern_commonprototypes.h | 1 - plugins/Clist_modern/src/modern_clisttray.cpp | 24 +--------------------- src/modules/clist/clc.h | 1 + src/modules/clist/clistmenus.cpp | 6 +++--- src/modules/clist/clisttray.cpp | 8 +++----- 6 files changed, 10 insertions(+), 32 deletions(-) diff --git a/include/m_clistint.h b/include/m_clistint.h index fdc4052a64..6b57eb0603 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -477,6 +477,8 @@ typedef struct *************************************************************************************/ int (*pfnGetContactIcon)(HANDLE hContact); int (*pfnTrayCalcChanged)(const char *szChangedProto, int averageMode, int iProtoCount); + int (*pfnGetAverageMode)(int *pNetProtoCount); + } CLIST_INTERFACE; diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index b1da2a00d2..785c9a7160 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -216,7 +216,6 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szStatus, int BgStatusBarChange(WPARAM wParam,LPARAM lParam); //clcopts.c int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack); //clc.c int ModernSkinButtonDeleteAll(); //modernbutton.c -int GetAverageMode( void ); //clisttray.c int GetContactCachedStatus(HANDLE hContact); //clistsettings.c int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c int GetContactIndex(ClcGroup *group,ClcContact *contact); //clcidents.c diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 203a9b25d8..d6397ecd1f 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -120,28 +120,6 @@ INT_PTR CListTray_GetGlobalStatus(WPARAM wparam,LPARAM lparam) return curstatus?curstatus:ID_STATUS_OFFLINE; } -int GetAverageMode() -{ - int count,netProtoCount,i; - int averageMode = 0; - PROTOACCOUNT **accs; - ProtoEnumAccounts( &count, &accs ); - for (i=0, netProtoCount = 0;i < count;i++) { - if ( pcli->pfnGetProtocolVisibility(accs[i]->szModuleName) == 0) - continue; - - pcli->cycleStep = i; - netProtoCount++; - if (averageMode == 0) - averageMode = CallProtoService(accs[i]->szModuleName, PS_GETSTATUS, 0, 0); - else if (averageMode != CallProtoService(accs[i]->szModuleName, PS_GETSTATUS, 0, 0)) { - averageMode = -1; - break; - } - } - return averageMode; -} - //////////////////////////////////////////////////////////// ///// Need to refresh trays icon after timely changing///// //////////////////////////////////////////////////////////// @@ -257,7 +235,7 @@ int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProto return pcli->pfnTrayIconSetBaseInfo(hIcon,szChangedProto); } else if (pcli->pfnGetProtocolVisibility(szChangedProto)) { - int avg = GetAverageMode(); + int avg = pcli->pfnGetAverageMode(NULL); int i = pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szChangedProto,CallProtoService(szChangedProto,PS_GETSTATUS, 0, 0)),szChangedProto); if (i < 0) { pcli->pfnTrayIconDestroy(hwnd); diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 6e4a3c4c28..43bdf9febd 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -110,6 +110,7 @@ void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour); HGENMENU fnGetProtocolMenu(const char*); int fnGetProtocolVisibility(const char* accName); int fnConvertMenu(CLISTMENUITEM*, TMO_MenuItem*); +int fnGetAverageMode(int *pNetProtoCount); int fnGetAccountIndexByPos(int Pos); int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos); diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 6ca756072f..85bb7f799b 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -153,7 +153,7 @@ void FreeMenuProtos(void) ////////////////////////////////////////////////////////////////////////// -int GetAverageMode(int* pNetProtoCount = NULL) +int fnGetAverageMode(int *pNetProtoCount) { int netProtoCount = 0; int averageMode = 0; @@ -501,7 +501,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) } } else if (smep && smep->status && !smep->custom) { - int curProtoStatus = (smep->proto) ? CallProtoServiceInt(NULL,smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode(); + int curProtoStatus = (smep->proto) ? CallProtoServiceInt(NULL,smep->proto, PS_GETSTATUS, 0, 0) : cli.pfnGetAverageMode(NULL); if (smep->status == curProtoStatus) timi->mi.flags |= CMIF_CHECKED; else @@ -1064,7 +1064,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) if (hStatusMainMenuHandles == NULL) return 0; if (cli.pfnGetProtocolVisibility(ack->szModule) == 0) return 0; - int overallStatus = GetAverageMode(); + int overallStatus = cli.pfnGetAverageMode(NULL); TMO_MenuItem tmi = { sizeof(tmi) }; if (overallStatus >= ID_STATUS_OFFLINE) { diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 10f51c3538..f1ee4a3bad 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -28,8 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HIMAGELIST hCListImages; -int GetAverageMode(int* pNetProtoCount = NULL); - static UINT WM_TASKBARCREATED; static UINT WM_TASKBARBUTTONCREATED; static BOOL mToolTipTrayTips = FALSE; @@ -235,7 +233,7 @@ int fnTrayIconInit(HWND hwnd) mir_cslock lck(trayLockCS); int netProtoCount = 0; - int averageMode = GetAverageMode(&netProtoCount); + int averageMode = cli.pfnGetAverageMode(&netProtoCount); mToolTipTrayTips = ServiceExists("mToolTip/ShowTip") != 0; if (cli.cycleTimerId) { @@ -420,7 +418,7 @@ LBL_Error: return i; } if ((cli.pfnGetProtocolVisibility(szPreferredProto)) && - (GetAverageMode() == -1) && + (cli.pfnGetAverageMode(NULL) == -1) && (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) && !(db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) goto LBL_Error; @@ -475,7 +473,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) int netProtoCount; mir_cslock lck(trayLockCS); - int averageMode = GetAverageMode(&netProtoCount); + int averageMode = cli.pfnGetAverageMode(&netProtoCount); if (cli.cycleTimerId) { KillTimer(NULL, cli.cycleTimerId); -- cgit v1.2.3