From 30707c980d1560b358dbf2671a4d2a26a1e8173c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 21:45:37 +0000 Subject: various menu initialization quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/src/main.cpp | 33 +++++++++++------------ plugins/SecureIM/src/svcs_clist.cpp | 53 ++++++++----------------------------- 2 files changed, 26 insertions(+), 60 deletions(-) (limited to 'plugins/SecureIM/src') diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index d0ca0a56c1..0591ce40cf 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -46,30 +46,27 @@ void AddHookFunction(LPCSTR eventName, MIRANDAHOOK hookFunction) { HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize=sizeof(mi); - mi.flags=flags | CMIF_HIDDEN; - mi.position=pos; - mi.hIcon=hicon; - mi.pszName= (char*)name; - mi.pszPopupName=(char*)-1; - mi.pszService=(char*)service; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = flags | CMIF_HIDDEN; + mi.position = pos; + mi.hIcon = hicon; + mi.pszName = (char*)name; + mi.pszPopupName = (char*)-1; + mi.pszService = (char*)service; return Menu_AddContactMenuItem(&mi); } HANDLE AddSubItem(HANDLE rootid,LPCSTR name,int pos,int poppos,LPCSTR service,WPARAM wParam=0) { - CLISTMENUITEM mi = { 0 }; - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.flags=CMIF_CHILDPOPUP | CMIF_HIDDEN; - mi.position=pos; - mi.popupPosition=poppos; - mi.hIcon=NULL; - mi.pszName=(char*)name; - mi.pszPopupName=(char*)rootid; - mi.pszService=(char*)service; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIF_CHILDPOPUP | CMIF_HIDDEN; + mi.position = pos; + mi.popupPosition = poppos; + mi.hIcon = NULL; + mi.pszName = (char*)name; + mi.pszPopupName = (char*)rootid; + mi.pszService = (char*)service; return Menu_AddContactMenuItem(&mi); } diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index e7aa7f8379..a37dbf70d5 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -11,56 +11,28 @@ int __cdecl onContactSettingChanged(WPARAM wParam,LPARAM lParam) { int stat = getContactStatus(hContact); if (!ptr || stat==-1) return 0; -// HANDLE hMetaContact = getMetaContact(hContact); -// if(hMetaContact) { -// ptr = getUinKey(hMetaContact); -// if (!ptr) return 0; -// } - if (stat==ID_STATUS_OFFLINE) { // go offline if (ptr->mode==MODE_NATIVE && cpp_keyx(ptr->cntx)) { // have active context cpp_delete_context(ptr->cntx); ptr->cntx=0; // reset context -// if(hMetaContact) { // is subcontact of metacontact -// showPopUpDC(hMetaContact); -// ShowStatusIconNotify(hMetaContact); -// if(getMostOnline(hMetaContact)) { // make handover -// CallContactService(hMetaContact,PSS_MESSAGE,0,(LPARAM)SIG_INIT); -// } -// } -// else { // is contact or metacontact (not subcontact) - showPopUpDC(hContact); // show popup "Disabled" - ShowStatusIconNotify(hContact); // change icon in CL -// } + showPopUpDC(hContact); // show popup "Disabled" + ShowStatusIconNotify(hContact); // change icon in CL } - else - if (ptr->mode==MODE_RSAAES && exp->rsa_get_state(ptr->cntx)==7) { + else if (ptr->mode==MODE_RSAAES && exp->rsa_get_state(ptr->cntx)==7) { deleteRSAcntx(ptr); -// if(hMetaContact) { // is subcontact of metacontact -// showPopUpDC(hMetaContact); -// ShowStatusIconNotify(hMetaContact); -// if(getMostOnline(hMetaContact)) { // make handover -// CallContactService(hMetaContact,PSS_MESSAGE,0,(LPARAM)SIG_INIT); -// } -// } -// else { // is contact or metacontact (not subcontact) - showPopUpDC(hContact); // show popup "Disabled" - ShowStatusIconNotify(hContact); // change icon in CL -// } + showPopUpDC(hContact); // show popup "Disabled" + ShowStatusIconNotify(hContact); // change icon in CL } } else { // go not offline -// if (!hMetaContact) { // is contact or metacontact (not subcontact) - if (ptr->offlineKey) { - cpp_reset_context(ptr->cntx); - ptr->offlineKey = false; - } - ShowStatusIconNotify(hContact); // change icon in CL -// } + if (ptr->offlineKey) { + cpp_reset_context(ptr->cntx); + ptr->offlineKey = false; + } + ShowStatusIconNotify(hContact); // change icon in CL } return 0; } - // wParam=(WPARAM)(HANDLE)hContact // lParam=0 int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) { @@ -103,13 +75,10 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { pUinKey ptr = getUinKey(hContact); int i; - CLISTMENUITEM mi; - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(CLISTMENUITEM); - ShowStatusIconNotify(hContact); // check offline/online + CLISTMENUITEM mi = { sizeof(mi) }; if (!ptr) { // hide menu bars mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN; -- cgit v1.2.3