diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-22 20:38:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-22 20:38:56 +0000 |
commit | 88790eed4ffd9ca555c8f9b73cb014a93b57a34f (patch) | |
tree | b3e5bfe096005a9cac4bc14fdfbe5f6f5acad98a /plugins/MirOTR | |
parent | 9ecc2aa50e2183e2c4a11861ca6dede7d2151139 (diff) |
Menu_ModifyItem unbound from CLISTMENUITEM structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@14334 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r-- | plugins/MirOTR/src/mirotrmenu.cpp | 35 | ||||
-rw-r--r-- | plugins/MirOTR/src/svcs_menu.cpp | 3 |
2 files changed, 12 insertions, 26 deletions
diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 33f69c3915..d65acdc67b 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -98,41 +98,30 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) if (mi.flags & CMIF_NOTNOTPRIVATE && level == TRUST_NOT_PRIVATE) return FALSE; if (pcpp->MenuItemHandle == hStatusInfoItem) { - size_t len; TCHAR text[128]; - mi.name.t = text; - mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; + switch (level) { case TRUST_PRIVATE: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_PRIVATE); - mir_tstrncpy(text, TranslateT(LANG_STATUS_PRIVATE), _countof(text)); - len = mir_tstrlen(text); - if (len < _countof(text)) - mir_sntprintf(text + len, _countof(text) - len, _T(" [v%i]"), context->protocol_version); + mir_sntprintf(text, _T("%s [v%i]"), TranslateT(LANG_STATUS_PRIVATE), context->protocol_version); + Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_PRIVATE)); break; + case TRUST_UNVERIFIED: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_UNVERIFIED); - mir_tstrncpy(text, TranslateT(LANG_STATUS_UNVERIFIED), _countof(text)); - len = mir_tstrlen(text); - if (len < _countof(text)) - mir_sntprintf(text + len, _countof(text) - len, _T(" [v%i]"), context->protocol_version); + mir_sntprintf(text, _T("%s [v%i]"), TranslateT(LANG_STATUS_UNVERIFIED), context->protocol_version); + Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_UNVERIFIED)); break; + case TRUST_FINISHED: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_FINISHED); - mi.name.t = TranslateT(LANG_STATUS_FINISHED); + Menu_ModifyItem(hStatusInfoItem, TranslateT(LANG_STATUS_FINISHED), IcoLib_GetIconHandle(ICON_UNVERIFIED)); break; + default: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); - mi.name.t = TranslateT(LANG_STATUS_DISABLED); + Menu_ModifyItem(hStatusInfoItem, TranslateT(LANG_STATUS_DISABLED), IcoLib_GetIconHandle(ICON_NOT_PRIVATE)); } - CallService(MO_MODIFYMENUITEM, (WPARAM)hStatusInfoItem, (LPARAM)&mi); } else if (pcpp->MenuItemHandle == hHTMLConvMenuItem) { - if (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) - mi.flags |= CMIM_FLAGS | CMIF_CHECKED; - else - mi.flags = CMIM_FLAGS | (mi.flags &~CMIF_CHECKED); - CallService(MO_MODIFYMENUITEM, (WPARAM)hHTMLConvMenuItem, (LPARAM)&mi); + int flags = db_get_b(hContact, MODULENAME, "HTMLConv", 0) ? CMIF_CHECKED : 0; + Menu_ModifyItem(hHTMLConvMenuItem, NULL, INVALID_HANDLE_VALUE, flags); } } return TRUE; diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index 1eda3b7469..a7657a247c 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -179,9 +179,6 @@ void InitMenu() int SVC_PrebuildContactMenu(WPARAM hContact, LPARAM lParam) { - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_TCHAR; - const char *proto = GetContactProto(hContact); DWORD pol = CONTACT_DEFAULT_POLICY; |