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/SeenPlugin/src/menu.cpp | 48 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'plugins/SeenPlugin/src/menu.cpp') diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index a2dc3b077d..58d0c1818b 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -40,33 +40,31 @@ int BuildContactMenu(WPARAM wparam, LPARAM) MCONTACT hContact = (MCONTACT)wparam; char *szProto = GetContactProto(hContact); - CLISTMENUITEM cmi = { 0 }; - if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !db_get_b(NULL, S_MOD, "MenuItem", 1)) - cmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR; - else { - cmi.flags = CMIM_NAME | CMIM_FLAGS | CMIM_ICON | CMIF_TCHAR; - cmi.hIcon = NULL; - - DBVARIANT dbv; - if (!db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) { - cmi.ptszName = ParseString(dbv.ptszVal, (MCONTACT)wparam, 0); - db_free(&dbv); - } - else cmi.ptszName = ParseString(DEFAULT_MENUSTAMP, (MCONTACT)wparam, 0); - - if (!mir_tstrcmp(cmi.ptszName, TranslateT(""))) { - if (IsWatchedProtocol(szProto)) - cmi.flags |= CMIF_GRAYED; - else - cmi.flags |= CMIF_HIDDEN; - } - else if (db_get_b(NULL, S_MOD, "ShowIcon", 1)) { - isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1); - cmi.hIcon = Skin_LoadProtoIcon(szProto, isetting | 0x8000); - } + if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !db_get_b(NULL, S_MOD, "MenuItem", 1)) { + Menu_ShowItem(hmenuitem, false); + return 0; } - Menu_ModifyItem(hmenuitem, &cmi); + LPCTSTR ptszName; + ptrT tszStamp(db_get_tsa(NULL, S_MOD, "MenuStamp")); + if (tszStamp != NULL) + ptszName = ParseString(tszStamp , (MCONTACT)wparam, 0); + else + ptszName = ParseString(DEFAULT_MENUSTAMP, (MCONTACT)wparam, 0); + + int flags = 0; + HICON hIcon = NULL; + if (!mir_tstrcmp(ptszName, TranslateT(""))) { + if (IsWatchedProtocol(szProto)) + flags |= CMIF_GRAYED; + else + flags |= CMIF_HIDDEN; + } + else if (db_get_b(NULL, S_MOD, "ShowIcon", 1)) { + isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1); + hIcon = Skin_LoadProtoIcon(szProto, isetting | 0x8000); + } + Menu_ModifyItem(hmenuitem, ptszName, hIcon, flags); return 0; } -- cgit v1.2.3