diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-28 21:45:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-28 21:45:37 +0000 |
commit | 30707c980d1560b358dbf2671a4d2a26a1e8173c (patch) | |
tree | 74aee5adaaac976e1398274ca64c5461a60f1feb /plugins/ContactsPlus | |
parent | 335ec43a4bfdcbbd0b2257037f1f3e0553d89076 (diff) |
various menu initialization quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ContactsPlus')
-rw-r--r-- | plugins/ContactsPlus/src/main.cpp | 82 |
1 files changed, 38 insertions, 44 deletions
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 585575f77b..c64acaf38a 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -154,60 +154,54 @@ static bool CheckContactsServiceSupport(const char* szProto) static int HookPreBuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = (HANDLE)wParam;
- char* szProto =GetContactProto(hContact);
- int bVisible = FALSE;
-
- if (szProto && CheckContactsServiceSupport(szProto))
- { // known protocol, protocol supports contacts sending
- // check the selected contact if it supports contacts receive
- if (CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXCONTACTSPERPACKET, (LPARAM)hContact))
- bVisible = TRUE;
- }
-
- { // update contact menu item's visibility
- CLISTMENUITEM mi = {0};
-
- mi.cbSize = sizeof(mi);
- if (bVisible)
- mi.flags = CMIM_FLAGS;
- else
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuItem, (LPARAM)&mi);
- }
-
- return 0;
+ HANDLE hContact = (HANDLE)wParam;
+ char* szProto =GetContactProto(hContact);
+ int bVisible = FALSE;
+
+ if (szProto && CheckContactsServiceSupport(szProto)) {
+ // known protocol, protocol supports contacts sending
+ // check the selected contact if it supports contacts receive
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXCONTACTSPERPACKET, (LPARAM)hContact))
+ bVisible = TRUE;
+ }
+
+ // update contact menu item's visibility
+ CLISTMENUITEM mi = { sizeof(mi) };
+ if (bVisible)
+ mi.flags = CMIM_FLAGS;
+ else
+ mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuItem, (LPARAM)&mi);
+ return 0;
}
static int HookModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- char* modules[2] = {0};
- WCHAR tmp[MAX_PATH];
+ char* modules[2] = {0};
+ WCHAR tmp[MAX_PATH];
- modules[0] = MODULENAME;
- CallService("DBEditorpp/RegisterModule",(WPARAM)modules,(LPARAM)1);
+ modules[0] = MODULENAME;
+ CallService("DBEditorpp/RegisterModule",(WPARAM)modules,(LPARAM)1);
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(mi);
- mi.ptszName = SRCTranslateT("Contacts", tmp);
- mi.position = -2000009990; //position in menu
- mi.flags = CMIF_KEEPUNTRANSLATED;
- if (g_UnicodeCore)
- mi.flags |= CMIF_UNICODE;
- mi.pszService = MS_CONTACTS_SEND;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS));
- hContactMenuItem = Menu_AddContactMenuItem(&mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.ptszName = SRCTranslateT("Contacts", tmp);
+ mi.position = -2000009990; //position in menu
+ mi.flags = CMIF_KEEPUNTRANSLATED;
+ if (g_UnicodeCore)
+ mi.flags |= CMIF_UNICODE;
+ mi.pszService = MS_CONTACTS_SEND;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS));
+ hContactMenuItem = Menu_AddContactMenuItem(&mi);
- hHookPreBuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, HookPreBuildContactMenu);
+ hHookPreBuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, HookPreBuildContactMenu);
- ghSendWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); // no need to destroy this
- ghRecvWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); // no need to destroy this
+ ghSendWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); // no need to destroy this
+ ghRecvWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); // no need to destroy this
-
- ProcessUnreadEvents();
- return 0;
+ ProcessUnreadEvents();
+ return 0;
}
|