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/Gender/src/main.cpp | |
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/Gender/src/main.cpp')
-rw-r--r-- | plugins/Gender/src/main.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/plugins/Gender/src/main.cpp b/plugins/Gender/src/main.cpp index 000c9d6389..88f3b6d3a1 100644 --- a/plugins/Gender/src/main.cpp +++ b/plugins/Gender/src/main.cpp @@ -123,13 +123,10 @@ INT_PTR GetIcon(WPARAM wParam, LPARAM lParam) int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
char *proto = GetContactProto((HANDLE)wParam);
+ if (!proto)
+ return 0;
- if (!proto) return 0;
-
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(CLISTMENUITEM);
-
-
+ CLISTMENUITEM mi = { sizeof(mi) };
if (DBGetContactSettingByte((HANDLE)wParam, proto, "ChatRoom", 0) || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
else
@@ -139,8 +136,7 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) unsigned short gender = DBGetContactSettingByte((HANDLE)wParam, proto, "Gender", DBGetContactSettingByte((HANDLE)wParam, "UserInfo", "Gender", 0));
- CLISTMENUITEM mitem = {0};
- mitem.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM mitem = { sizeof(mitem) };
mitem.flags = CMIM_FLAGS;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuMale, (LPARAM)&mitem);
@@ -149,16 +145,15 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) mitem.flags = CMIM_FLAGS | CMIF_CHECKED;
- switch (gender)
- {
- case 77:
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuMale, (LPARAM)&mitem);
+ switch (gender) {
+ case 77:
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuMale, (LPARAM)&mitem);
break;
- case 70:
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuFemale, (LPARAM)&mitem);
+ case 70:
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuFemale, (LPARAM)&mitem);
break;
- case 0:
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuNotDef, (LPARAM)&mitem);
+ case 0:
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuNotDef, (LPARAM)&mitem);
break;
}
@@ -253,8 +248,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) {
if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP))
{
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.icolibItem = g_hIconMenu;
mi.pszPopupName = (char*)-1;
@@ -284,8 +278,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) }
else
{
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.position = 1001;
mi.ptszName = LPGENT("Set Male");
|