From 25fed4bccbac68ea89325025f9d08fcb5eb6b258 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 4 Apr 2018 22:57:14 +0300 Subject: unused CLIST_INTERFACE data moved inside mir_app --- plugins/Clist_nicer/src/clui.cpp | 2 -- plugins/UserInfoEx/src/mir_menuitems.cpp | 15 +++++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 1eed90914d..b2014121ae 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -827,8 +827,6 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (db_get_b(NULL, "CLUI", "useskin", 0)) IMG_LoadItems(); CreateButtonBar(hwnd); - //FYR: to be checked: otherwise it raises double xStatus items - //NotifyEventHooks(pcli->hPreBuildStatusMenuEvent, 0, 0); SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); { LONG style; diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 205261f0f0..d5966d1574 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -484,18 +484,16 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) const BYTE mItems = 3; // menuitems to create BYTE item = 0; - int mProtoCount = pcli->menuProtoCount; - // on call by hook or first start if (!lParam || !hMenuItemAccount) { - size_t sizeNew = mItems * mProtoCount * sizeof(HGENMENU); + size_t sizeNew = mItems * pcli->menuProtos->getCount() * sizeof(HGENMENU); hMenuItemAccount = (HGENMENU*)mir_realloc(hMenuItemAccount, sizeNew); // set all bytes 0 to avoid problems memset(hMenuItemAccount, 0, sizeNew); } // on options change else // delete all MenuItems backward (first item second group) - RemoveMenuItems(hMenuItemAccount, mItems * mProtoCount); + RemoveMenuItems(hMenuItemAccount, mItems * pcli->menuProtos->getCount()); // load options int flag = db_get_b(NULL, MODNAME, SET_MI_ACCOUNT, MCAS_NOTINITIATED); @@ -505,19 +503,19 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) } // loop for all account names - for (int i = 0; i < mProtoCount; i++) { + for (auto &it : *pcli->menuProtos) { // set all bytes 0 to avoid problems item = 0; - HGENMENU mhRoot = pcli->menuProtos[i].pMenu, mhExIm; + HGENMENU mhRoot = it->pMenu, mhExIm; if (mhRoot == nullptr) break; - PROTOACCOUNT *pa = Proto_GetAccount(pcli->menuProtos[i].szProto); + PROTOACCOUNT *pa = Proto_GetAccount(it->szProto); // create service name main (account module name) and set pointer to end it char text[200]; - mir_strcpy(text, pcli->menuProtos[i].szProto); + mir_strcpy(text, it->szProto); CMenuItem mi; mi.pszService = text; @@ -526,6 +524,7 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) // support new genmenu style mi.root = mhRoot; + int i = pcli->menuProtos->indexOf(&it); switch (flag) { case 3: // cascade off -- cgit v1.2.3