From 88790eed4ffd9ca555c8f9b73cb014a93b57a34f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Jun 2015 20:38:56 +0000 Subject: Menu_ModifyItem unbound from CLISTMENUITEM structure git-svn-id: http://svn.miranda-ng.org/main/trunk@14334 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/src/svcs_clist.cpp | 47 +++++++++++-------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) (limited to 'plugins/SecureIM/src/svcs_clist.cpp') diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index 575f068818..7a7a60c2b4 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -69,15 +69,13 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam) if (bMC) hContact = db_mc_getMostOnline(hContact); // возьмем тот, через который пойдет сообщение pUinKey ptr = getUinKey(hContact); - int i; - CLISTMENUITEM mi = { 0 }; ShowStatusIconNotify(hContact); // check offline/online if (!ptr) { // hide menu bars - for (i = 0; i < _countof(g_hMenu); i++) + for (int i = 0; i < _countof(g_hMenu); i++) Menu_ShowItem(g_hMenu[i], false); return 0; } @@ -90,36 +88,24 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam) bool isMiranda = isClientMiranda(hContact); // hide all menu bars - for (i = 0; i < _countof(g_hMenu); i++) + for (int i = 0; i < _countof(g_hMenu); i++) Menu_ShowItem(g_hMenu[i], false); if (isSecureProto && !isChat && isMiranda && (ptr->mode == MODE_NATIVE || ptr->mode == MODE_RSAAES)) { // Native/RSAAES - mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIM_ICON; - if (!isSecured) { - // create secureim connection - mi.hIcon = mode2icon(ptr->mode | SECURED, 2); - Menu_ModifyItem(g_hMenu[0], &mi); - } - else { - // disable secureim connection - mi.hIcon = mode2icon(ptr->mode, 2); - Menu_ModifyItem(g_hMenu[1], &mi); - } + + if (!isSecured) // create secureim connection + Menu_ModifyItem(g_hMenu[0], NULL, mode2icon(ptr->mode | SECURED, 2)); + else // disable secureim connection + Menu_ModifyItem(g_hMenu[1], NULL, mode2icon(ptr->mode, 2)); + // set status menu if (bSCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) { + Menu_ModifyItem(g_hMenu[2], _A2T(sim312[ptr->status]), g_hICO[ICO_ST_DIS + ptr->status]); - mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; - mi.hIcon = g_hICO[ICO_ST_DIS + ptr->status]; - mi.pszName = (LPSTR)sim312[ptr->status]; - Menu_ModifyItem(g_hMenu[2], &mi); - - mi.flags = CMIM_FLAGS | CMIM_ICON; - for (i = 0; i <= (ptr->mode == MODE_RSAAES ? 1 : 2); i++) { - mi.hIcon = (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : NULL; - Menu_ModifyItem(g_hMenu[3 + i], &mi); - } + for (int i = 0; i <= (ptr->mode == MODE_RSAAES ? 1 : 2); i++) + Menu_ModifyItem(g_hMenu[3 + i], NULL, (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : NULL); } } else if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) { @@ -135,17 +121,12 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam) if (isSecureProto && !isChat && isMiranda) { // set mode menu if (bMCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) { - mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; - mi.hIcon = g_hICO[ICO_OV_NAT + ptr->mode]; - mi.pszName = (LPSTR)sim311[ptr->mode]; - Menu_ModifyItem(g_hMenu[10], &mi); + Menu_ModifyItem(g_hMenu[10], _A2T(sim311[ptr->mode]), g_hICO[ICO_OV_NAT + ptr->mode]); - mi.flags = CMIM_FLAGS | CMIM_ICON; - for (i = 0; i < MODE_CNT; i++) { + for (int i = 0; i < MODE_CNT; i++) { if (i == MODE_PGP && ptr->mode != MODE_PGP && !bPGP) continue; if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG) continue; - mi.hIcon = (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL; - Menu_ModifyItem(g_hMenu[11 + i], &mi); + Menu_ModifyItem(g_hMenu[11 + i], NULL, (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL); } } } -- cgit v1.2.3