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/AddContactPlus/src/main.cpp | 8 +- plugins/Alarms/src/frame.cpp | 5 +- plugins/Alarms/src/options.cpp | 3 +- plugins/AuthState/src/main.cpp | 9 +- plugins/AutoShutdown/src/settingsdlg.cpp | 33 +++--- plugins/AvatarHistory/src/AvatarDlg.cpp | 7 +- plugins/AvatarHistory/src/icolib.cpp | 4 +- plugins/BasicHistory/src/BasicHistory.cpp | 13 +-- plugins/Boltun/src/boltun.cpp | 20 +--- plugins/BossKeyPlus/src/BossKey.cpp | 7 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 9 +- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 7 +- plugins/Clist_modern/src/modern_clistmenus.cpp | 5 +- plugins/Clist_modern/src/modern_clisttray.cpp | 6 +- plugins/Clist_modern/src/modern_clui.cpp | 6 +- plugins/Clist_modern/src/modern_cluiframes.cpp | 40 +------ plugins/Clist_modern/src/modern_groupmenu.cpp | 88 +++++--------- plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp | 26 +---- plugins/Clist_mw/src/clisttray.cpp | 5 +- plugins/Clist_mw/src/groupmenu.cpp | 42 ++----- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 36 ++---- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 54 ++------- plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp | 39 +++---- plugins/Clist_nicer/src/clistmenus.cpp | 31 +++-- plugins/Console/src/Console.cpp | 8 +- plugins/ContactsPlus/src/main.cpp | 82 ++++++------- plugins/CrashDumper/src/crshdmp.cpp | 5 +- plugins/CyrTranslit/src/MirandaContact.cpp | 3 +- plugins/DbEditorPP/src/main.cpp | 3 +- plugins/DbEditorPP/src/options.cpp | 7 +- plugins/Db_autobackups/src/main.cpp | 3 +- plugins/Dbx_mmap_SA/src/dialogs.cpp | 36 +++--- plugins/FTPFileYM/src/ftpfile.cpp | 16 +-- plugins/FavContacts/src/main.cpp | 3 +- plugins/FileAsMessage/src/main.cpp | 1 - plugins/FloatingContacts/src/main.cpp | 21 ++-- plugins/Gender/src/main.cpp | 33 +++--- plugins/HistoryLinkListPlus/src/linklist.cpp | 18 +-- plugins/Import/src/main.cpp | 4 +- plugins/LangMan/src/main.cpp | 3 +- plugins/ListeningTo/src/listeningto.cpp | 12 +- plugins/MenuItemEx/src/main.cpp | 18 ++- plugins/MetaContacts/src/icons.cpp | 42 ++++--- plugins/MetaContacts/src/meta_menu.cpp | 3 +- plugins/MetaContacts/src/meta_services.cpp | 6 +- plugins/MirOTR/MirOTR/src/svcs_menu.cpp | 12 +- plugins/Msg_Export/src/main.cpp | 4 +- plugins/MyDetails/src/frame.cpp | 23 ++-- plugins/MyDetails/src/mydetails.cpp | 5 +- plugins/NewEventNotify/src/menuitem.cpp | 30 +++-- plugins/NewEventNotify/src/options.cpp | 4 +- plugins/NewXstatusNotify/src/main.cpp | 6 +- plugins/New_GPG/src/init.cpp | 4 +- plugins/New_GPG/src/utilities.cpp | 8 +- plugins/NewsAggregator/Src/Menus.cpp | 3 +- plugins/NoHistory/src/dllmain.cpp | 7 +- plugins/NotesAndReminders/src/main.cpp | 128 ++++++++++----------- plugins/Nudge/src/main.cpp | 3 +- plugins/Nudge/src/nudge.cpp | 5 +- plugins/OpenFolder/src/openFolder.cpp | 3 +- plugins/PackUpdater/Src/PackUpdater.cpp | 7 +- plugins/PasteIt/src/PasteIt.cpp | 22 ++-- plugins/Ping/src/menu.cpp | 109 +++--------------- plugins/Ping/src/pingthread.cpp | 4 +- plugins/PluginUpdater/src/PluginUpdater.cpp | 3 +- plugins/Popup/src/main.cpp | 15 +-- plugins/ProfileManager/src/pmanagerEx.cpp | 7 +- plugins/QuickContacts/src/quickcontacts.cpp | 4 +- plugins/Quotes/src/Forex.cpp | 6 +- plugins/Quotes/src/QuoteInfoDlg.cpp | 7 +- plugins/RecentContacts/src/RecentContacts.cpp | 7 +- plugins/Scriver/src/chat/clist.cpp | 3 +- plugins/Scriver/src/chat/main.cpp | 2 +- plugins/Scriver/src/msgs.cpp | 8 +- plugins/SecureIM/src/main.cpp | 33 +++--- plugins/SecureIM/src/svcs_clist.cpp | 53 ++------- plugins/SendScreenshotPlus/src/Main.cpp | 10 +- plugins/Sessions/Src/Main.cpp | 4 +- plugins/SimpleAR/src/Main.cpp | 34 +++--- plugins/SimpleStatusMsg/src/awaymsg.cpp | 7 +- plugins/SimpleStatusMsg/src/main.cpp | 3 +- plugins/SmileyAdd/src/main.cpp | 3 +- plugins/SmileyAdd/src/services.cpp | 24 ++-- plugins/SplashScreen/src/main.cpp | 5 +- plugins/StatusPlugins/StartupStatus/profiles.cpp | 4 +- plugins/StopSpamMod/src/init.cpp | 6 +- plugins/StopSpamPlus/src/stopspam.cpp | 6 +- plugins/TabSRMM/src/chat/clist.cpp | 3 +- plugins/TabSRMM/src/chat/services.cpp | 3 +- plugins/TabSRMM/src/globals.cpp | 29 ++--- plugins/TabSRMM/src/mim.cpp | 8 +- plugins/TabSRMM/src/typingnotify.cpp | 10 +- plugins/TrafficCounter/src/TrafficCounter.c | 5 +- plugins/UserGuide/src/main.cpp | 6 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 24 ++-- plugins/UserInfoEx/src/svc_email.cpp | 18 +-- plugins/UserInfoEx/src/svc_homepage.cpp | 14 +-- plugins/UserInfoEx/src/svc_refreshci.cpp | 8 +- plugins/VersionInfo/src/main.cpp | 3 +- plugins/Weather/src/weather_mwin.cpp | 4 +- plugins/WhenWasIt/src/hooked_events.cpp | 1 + plugins/WhoUsesMyFiles/src/wumfplug.c | 52 ++++----- plugins/YAMN/src/main.cpp | 6 +- plugins/YAPP/src/services.cpp | 6 +- plugins/ZeroNotification/src/main.cpp | 35 +++--- protocols/AimOscar/src/proto.cpp | 50 ++++---- protocols/AimOscar/src/theme.cpp | 11 +- protocols/FacebookRM/src/theme.cpp | 12 +- protocols/GTalkExt/src/menu.cpp | 6 +- protocols/Gadu-Gadu/src/gg.cpp | 24 ++-- protocols/Gadu-Gadu/src/gg_proto.cpp | 3 +- protocols/Gadu-Gadu/src/groupchat.cpp | 6 +- protocols/Gadu-Gadu/src/image.cpp | 10 +- protocols/Gadu-Gadu/src/import.cpp | 14 ++- protocols/Gadu-Gadu/src/links.cpp | 14 +-- protocols/Gadu-Gadu/src/sessions.cpp | 13 +-- protocols/IRCG/src/commandmonitor.cpp | 22 ++-- protocols/IRCG/src/ircproto.cpp | 9 +- protocols/IRCG/src/options.cpp | 10 +- protocols/IRCG/src/services.cpp | 48 ++++---- protocols/IcqOscarJ/src/icq_menu.cpp | 10 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 12 +- protocols/IcqOscarJ/src/init.cpp | 9 +- protocols/JabberG/src/jabber_menu.cpp | 44 +++---- protocols/JabberG/src/jabber_privacy.cpp | 6 +- protocols/JabberG/src/jabber_xstatus.cpp | 3 +- protocols/MRA/src/MraIcons.cpp | 3 +- protocols/MRA/src/Mra_functions.cpp | 10 +- protocols/MRA/src/Mra_svcs.cpp | 3 +- protocols/MSN/src/msn_menu.cpp | 33 ++---- protocols/MSN/src/msn_proto.cpp | 6 +- protocols/Tlen/src/jabber_iqid.cpp | 13 +-- protocols/Tlen/src/jabber_svc.cpp | 9 +- protocols/Tlen/src/jabber_thread.cpp | 14 +-- protocols/Tlen/src/tlen.cpp | 12 +- protocols/Twitter/src/proto.cpp | 4 +- protocols/Xfire/src/Xfire_game.cpp | 17 ++- protocols/Xfire/src/Xfire_gamelist.cpp | 18 ++- protocols/Xfire/src/main.cpp | 5 +- protocols/Xfire/src/searching4games.cpp | 1 - protocols/Yahoo/src/proto.cpp | 9 +- protocols/Yahoo/src/services.cpp | 21 ++-- src/core/stdaway/awaymsg.cpp | 23 ++-- src/core/stdchat/src/clist.cpp | 21 ++-- src/core/stdchat/src/services.cpp | 3 +- src/core/stdemail/email.cpp | 6 +- src/core/stdfile/file.cpp | 9 +- src/core/stdhelp/help.cpp | 3 +- src/core/stdmsg/src/msgs.cpp | 6 +- src/core/stduihist/history.cpp | 3 +- src/core/stdurl/url.cpp | 6 +- src/modules/clist/clui.cpp | 10 +- src/modules/clist/movetogroup.cpp | 10 +- src/modules/options/options.cpp | 3 +- src/modules/protocols/protoopts.cpp | 3 +- 155 files changed, 839 insertions(+), 1487 deletions(-) diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 23d349ade8..6f4c69cab3 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -70,12 +70,10 @@ INT_PTR AddContactPlusDialog(WPARAM, LPARAM) static int OnIconsChanged(WPARAM, LPARAM) { - CLISTMENUITEM mi = {0}; - if (!hMainMenuItem) return 0; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON | CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.icolibItem = hIconLibItem; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItem, (LPARAM)&mi); @@ -99,12 +97,10 @@ static int OnAccListChanged(WPARAM, LPARAM) if (iAccCount) { - CLISTMENUITEM mi = {0}; - if (hMainMenuItem) return 0; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 500020001; mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.icolibItem = hIconLibItem; diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index cdcb4b755a..b3937eb85c 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -453,8 +453,7 @@ int ReloadFont(WPARAM wParam, LPARAM lParam) void FixMainMenu() { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { if (options.hide_with_clist || options.auto_showhide) mi.flags = CMIM_FLAGS | CMIF_GRAYED; @@ -555,7 +554,7 @@ int CreateFrame() CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ALL; - mi.hIcon=hIconMenuShowHide; + mi.hIcon = hIconMenuShowHide; mi.pszName = LPGEN("Show Reminders"); mi.pszService = MODULE "/ShowHideReminders"; mi.pszPopupName = LPGEN("Alarms"); diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 2c1bb60950..9670795a4e 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -692,8 +692,7 @@ void AddMenuItem() { if (hMainMenuItem) return; - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ALL; mi.hIcon = hIconMenuSet; mi.pszName = "Set Alarm"; diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index b65de865f4..9a4ff8ae2d 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -143,10 +143,10 @@ INT_PTR onAuthMenuSelected(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,"Auth",0) && !DBGetContactSettingByte((HANDLE)wParam,proto,"Grant",0) && DBGetContactSettingWord((HANDLE)wParam,proto,"ServerId",0)) mi.flags = CMIF_TCHAR | CMIM_FLAGS | CMIF_HIDDEN; @@ -252,8 +252,7 @@ extern "C" int __declspec(dllexport) Load(void) { hAuthMenuSelected = CreateServiceFunction("AuthState/MenuItem", onAuthMenuSelected); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -1999901005; mi.flags = CMIF_TCHAR; mi.ptszName = _T("Enable AuthState icons"); diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 2131c768aa..4c980117f2 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -439,31 +439,28 @@ extern HANDLE hActiveIcon,hInactiveIcon; void SetShutdownMenuItem(BOOL fActive) { - CLISTMENUITEM cmi; - ZeroMemory(&cmi,sizeof(cmi)); - cmi.cbSize=sizeof(cmi); - /* main menu */ - cmi.position=2001090000; - cmi.icolibItem=fActive?hActiveIcon:hInactiveIcon; - cmi.ptszName=fActive?_T("Stop automatic &shutdown"):_T("Automatic &shutdown..."); /* autotranslated */ - cmi.pszService="AutoShutdown/MenuCommand"; - cmi.flags=CMIF_TCHAR|CMIF_ICONFROMICOLIB; - if(hMainMenuItem!=NULL) { - cmi.flags|=CMIM_NAME|CMIM_ICON; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMainMenuItem,(LPARAM)&cmi); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 2001090000; + mi.icolibItem = fActive?hActiveIcon:hInactiveIcon; + mi.ptszName = fActive?_T("Stop automatic &shutdown"):_T("Automatic &shutdown..."); /* autotranslated */ + mi.pszService = "AutoShutdown/MenuCommand"; + mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB; + if (hMainMenuItem != NULL) { + mi.flags |= CMIM_NAME|CMIM_ICON; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMainMenuItem,(LPARAM)&mi); } - else hMainMenuItem = Menu_AddMainMenuItem(&cmi); + else hMainMenuItem = Menu_AddMainMenuItem(&mi); /* tray menu */ - cmi.position=899999; + mi.position = 899999; if(hTrayMenuItem!=NULL) { - cmi.flags|=CMIM_NAME|CMIM_ICON; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hTrayMenuItem,(LPARAM)&cmi); + mi.flags|=CMIM_NAME|CMIM_ICON; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hTrayMenuItem,(LPARAM)&mi); } - else hTrayMenuItem = Menu_AddTrayMenuItem(&cmi); + else hTrayMenuItem = Menu_AddTrayMenuItem(&mi); - Skin_ReleaseIcon(cmi.hIcon); + Skin_ReleaseIcon(mi.hIcon); } static INT_PTR MenuItemCommand(WPARAM wParam,LPARAM lParam) diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index f499fcb8ee..de344a5929 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -526,8 +526,7 @@ int CleanupAvatarPic(HWND hwnd) int PreBuildContactMenu(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(clmi); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; char *proto = GetContactProto((HANDLE)wParam); @@ -541,11 +540,9 @@ int PreBuildContactMenu(WPARAM wParam,LPARAM lParam) void InitMenuItem() { - CLISTMENUITEM mi = {0}; - hServices[2] = CreateServiceFunction(MS_AVATARHISTORY_SHOWDIALOG, ShowDialogSvc); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.ptszName = LPGENT("View Avatar History"); mi.flags = CMIF_TCHAR; mi.position = 1000090010; diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp index acc5d642c3..508c683686 100644 --- a/plugins/AvatarHistory/src/icolib.cpp +++ b/plugins/AvatarHistory/src/icolib.cpp @@ -46,9 +46,7 @@ static void ReleaseIconEx(HICON hIcon) static void IcoLibUpdateMenus() { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIM_ICON; mi.hIcon = createDefaultOverlayedIcon(FALSE); CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenu, ( LPARAM )&mi ); diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index fe7c4d9f68..41e666436a 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -82,8 +82,8 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { int count = EventList::GetContactMessageNumber((HANDLE)wParam); bool isInList = HistoryWindow::IsInList(GetForegroundWindow()); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; if (!count) mi.flags |= CMIF_HIDDEN; @@ -114,8 +114,7 @@ int ToolbarModuleLoaded(WPARAM wParam,LPARAM lParam) void InitMenuItems() { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1000090000; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY); @@ -141,8 +140,7 @@ void InitTaskMenuItems() { if(Options::instance->taskOptions.size() > 0) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; if(hTaskMainMenu == NULL) { mi.position = 500060005; @@ -189,8 +187,7 @@ void InitTaskMenuItems() } else if(hTaskMainMenu != NULL) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_ROOTPOPUP | CMIF_HIDDEN; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hTaskMainMenu, (LPARAM)&mi); } diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 25968b15a7..42149db57a 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -587,14 +587,12 @@ static INT_PTR ContactClickStartChatting(WPARAM wParam, LPARAM lParam) static int MessagePrebuild(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM clmi; - HANDLE hContact = (HANDLE)wParam; + CLISTMENUITEM clmi = { sizeof(clmi) }; + HANDLE hContact = (HANDLE)wParam; if (!blInit || (DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 1)) { - ZeroMemory(&clmi, sizeof(clmi)); - clmi.cbSize = sizeof(clmi); - clmi.flags = CMIM_FLAGS | CMIF_GRAYED; + clmi.flags = CMIM_FLAGS | CMIF_GRAYED; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemAutoChat, (LPARAM)&clmi); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemNotToChat, (LPARAM)&clmi); @@ -603,8 +601,7 @@ static int MessagePrebuild(WPARAM wParam, LPARAM lParam) { BOOL boltunautochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE); BOOL boltunnottochat = DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE); - ZeroMemory(&clmi, sizeof(clmi)); - clmi.cbSize = sizeof(clmi); + clmi.flags = CMIM_FLAGS | CMIM_ICON | (boltunautochat ? CMIF_CHECKED : 0); clmi.hIcon = LoadIcon( GetModuleHandle(NULL), MAKEINTRESOURCE((boltunautochat ? IDI_TICK : IDI_NOTICK))); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemAutoChat, (LPARAM)&clmi); @@ -650,14 +647,8 @@ extern "C" int __declspec(dllexport) Load(void) CreateServiceFunction(SERV_CONTACT_NOT_TO_CHAT, ContactClickNotToChat); CreateServiceFunction(SERV_CONTACT_START_CHATTING, ContactClickStartChatting); { - CLISTMENUITEM mi; - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -50010002; //TODO: check the warning - mi.flags = 0; - mi.hIcon = NULL; - mi.pszContactOwner = NULL; mi.pszName = BOLTUN_AUTO_CHAT; mi.pszService = SERV_CONTACT_AUTO_CHAT; hMenuItemAutoChat = Menu_AddContactMenuItem(&mi); @@ -674,6 +665,7 @@ extern "C" int __declspec(dllexport) Load(void) mi.pszService = SERV_CONTACT_START_CHATTING; hMenuItemStartChatting = Menu_AddContactMenuItem(&mi); } + int line; blInit = LoadMind(Config.MindFileName, line); if (!blInit) diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index ac6b4c457c..fc198b6820 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -618,11 +618,10 @@ static int GenMenuInit(WPARAM wParam, LPARAM lParam) // Modify menu item text be { if (g_hMenuItem) { - CLISTMENUITEM mi = {0}; TCHAR buf[128] = {0}; mir_sntprintf(buf, SIZEOF(buf), _T("%s [%s]"), TranslateT("Hide"), GetBossKeyText()); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME; mi.ptszName = buf; @@ -633,9 +632,7 @@ static int GenMenuInit(WPARAM wParam, LPARAM lParam) // Modify menu item text be void BossKeyMenuItemInit(void) // Add menu item { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.position = 2000100000; mi.pszPopupName = 0; diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index e89114cb97..af22f743d6 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -466,10 +466,10 @@ INT_PTR MenuMissYouClick(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 (db_get_b((HANDLE)wParam, proto, "ChatRoom", 0) || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)) mi.flags = CMIM_FLAGS | CMIF_HIDDEN; @@ -717,8 +717,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) if (options.enableMissYou) { hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.icolibItem = hDisabledIcon; mi.position = 200000; diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index cee91395de..1a39c15b82 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -336,8 +336,7 @@ static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam) { // we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded if (ServiceExists(MS_POPUP_ADDPOPUPT)) { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR | CMIM_NAME | CMIM_ICON; if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) { mi.ptszName = LPGENT("Disable c&lient change notification"); @@ -388,8 +387,8 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_POPUP_ADDPOPUPT)) { hServices.AddElem(CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups)); hHooks.AddElem(HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu)); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) mi.ptszName = LPGENT("Disable c&lient change notification"); diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index ba4e787b02..0c6175e7cc 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -75,7 +75,6 @@ static HANDLE hOnContactMenuBuild_FAV = NULL; static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; BOOL NeedFree = FALSE; BYTE bContactRate = db_get_b((HANDLE)wParam, "CList", "Rate",0); //if (hFavoriteContactMenu) @@ -103,9 +102,7 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) int i; TCHAR * name = NULL; - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.hIcon = CLUI_LoadIconFromExternalFile("clisticons.dll",8,TRUE,TRUE,iconsName[bContactRate],"Contact List",Translate(iconsName[bContactRate]),-IDI_FAVORITE_0 - bContactRate, &NeedFree); mi.pszPopupName = (char *)-1; mi.position = 0; diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 4ac629d55b..03414ab7f9 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -641,10 +641,7 @@ void InitTrayMenus(void) { //add exit command to menu - CLISTMENUITEM mi; - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 900000; mi.pszService = "CloseAction"; mi.pszName = LPGEN("E&xit"); @@ -673,7 +670,6 @@ void InitTrayMenus(void) AddTrayMenuItem(0,(LPARAM)&mi); DestroyIcon_protect(mi.hIcon); - memset(&mi,0,sizeof(mi)); mi.cbSize = sizeof(mi); mi.position = 300000; diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index b0a9ffee51..6892cbf104 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -100,10 +100,10 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) TCHAR cls[128]; HANDLE hItem; HWND hwndClist = GetFocus(); - CLISTMENUITEM mi; + if (MirandaExiting()) return 0; - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; GetClassName(hwndClist,cls,SIZEOF(cls)); hwndClist = (!lstrcmp(CLISTCONTROL_CLASS,cls))?hwndClist:pcli->hwndContactList; diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index 2b78349096..37c0a574e0 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -837,8 +837,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,HGEN if (_fCluiFramesModuleNotStarted) return NULL; - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.pszPopupName = (char *)root; mi.popupPosition = frameid; @@ -1006,15 +1005,12 @@ static int ModifyMItem(WPARAM wParam,LPARAM lParam) static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam) { - int pos; - CLISTMENUITEM mi; /* HOOK */ if (MirandaExiting()) return 0; if (_fCluiFramesModuleNotStarted) return -1; - pos = id2pos(wParam); + int pos = id2pos(wParam); if (pos >= 0 && pos < g_nFramesCount) { - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS|CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED; mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].Name; @@ -1061,18 +1057,12 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam) static int CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) { //hiword(wParam) = frameid,loword(wParam) = flag - int pos; - CLISTMENUITEM mi; - //TMO_MenuItem tmi; - if (_fCluiFramesModuleNotStarted) return -1; - - pos = id2pos(wParam); + int pos = id2pos(wParam); if (pos >= 0 && pos < g_nFramesCount) { - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS|CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED; mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].Name; @@ -1108,23 +1098,6 @@ static int CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) if (g_pfwFrames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_pfwFrames[pos].MenuHandles.MIAlignBottom,(LPARAM)&mi); - /* - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP|((Frames[pos].align&alClient)?CMIF_GRAYED:0); - if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignTop,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP|CMIF_GRAYED; - if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignClient,(LPARAM)&mi); - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP|((Frames[pos].align&alClient)?CMIF_GRAYED:0); - if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignBottom,(LPARAM)&mi); - - */ - - - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED; if ((!g_pfwFrames[pos].visible) || g_pfwFrames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; @@ -1768,9 +1741,8 @@ static int CLUIFramesLoadMainMenu() _hmiRoot = (HGENMENU)-1; } - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); // create root menu + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); mi.position = 3000090000; diff --git a/plugins/Clist_modern/src/modern_groupmenu.cpp b/plugins/Clist_modern/src/modern_groupmenu.cpp index d11337f3ed..e9c5d5791d 100644 --- a/plugins/Clist_modern/src/modern_groupmenu.cpp +++ b/plugins/Clist_modern/src/modern_groupmenu.cpp @@ -214,11 +214,9 @@ INT_PTR CreateGroupHelper(WPARAM wParam,LPARAM lParam) static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; - if (MirandaExiting()) return 0; - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + if (MirandaExiting()) return 0; + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | (db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); @@ -238,27 +236,24 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi); return 0; -}; +} int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) { - HICON hicon; - CLISTMENUITEM clmi = {0}; + if (MirandaExiting()) return 0; + BOOL needFree; - if (MirandaExiting()) return 0; - hicon = CLUI_LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,&needFree); + HICON hicon = CLUI_LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,&needFree); NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); if (needFree) DestroyIcon_protect(hicon); - clmi.cbSize = sizeof(clmi); + + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_ICON; clmi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0); CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi); CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi); - // - - return 0; -}; +} void GroupMenus_Init(void) { @@ -309,13 +304,10 @@ void GroupMenus_Init(void) op.Value = (INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService"; CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op); - { //add exit command to menu - CLISTMENUITEM mi; GroupMenuParam gmp; - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1900000; mi.pszService = "CloseAction"; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_EXIT); @@ -344,7 +336,6 @@ void GroupMenus_Init(void) AddGroupMenuItem(0,(LPARAM)&mi); DestroyIcon_protect(mi.hIcon); - memset(&mi,0,sizeof(mi)); mi.cbSize = sizeof(mi); mi.position = 300000; @@ -411,7 +402,6 @@ void GroupMenus_Init(void) mi.pszName = LPGEN("Hide &Offline Users out here"); hHideOfflineUsersOutHereMenuItem = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi); - memset(&mi,0,sizeof(mi)); mi.cbSize = sizeof(mi); mi.position = 100003; @@ -420,8 +410,6 @@ void GroupMenus_Init(void) mi.pszName = LPGEN("Hide &Empty Groups"); hHideEmptyGroupsMenuItem = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi); - - memset(&mi,0,sizeof(mi)); mi.cbSize = sizeof(mi); mi.position = 100004; @@ -430,12 +418,7 @@ void GroupMenus_Init(void) mi.pszName = LPGEN("Disable &Groups"); hDisableGroupsMenuItem = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi); - HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged); - - //MS_CLIST_GROUPCREATE - - }; } //////////////////////////////END Group MENU///////////////////////// @@ -470,34 +453,31 @@ static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; - BOOL gray1 = FALSE; - BOOL gray2 = FALSE; - BOOL showOfflineinGroup = FALSE; - - + BOOL gray1 = FALSE; + BOOL gray2 = FALSE; + BOOL showOfflineinGroup = FALSE; + ClcGroup *group = (ClcGroup *)wParam; if (wParam == 0) return 0; - if (MirandaExiting()) return 0; + if (MirandaExiting()) return 0; //contact->group - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - showOfflineinGroup = CLCItems_IsShowOfflineGroup(group); - gray1 = (showOfflineinGroup != FALSE); - gray2 = (group->hideOffline != FALSE); - - if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline - - mi.flags = CMIM_FLAGS | ((group->hideOffline && !gray1)?CMIF_CHECKED:0)| (gray1?CMIF_GRAYED:0); + showOfflineinGroup = CLCItems_IsShowOfflineGroup(group); + gray1 = (showOfflineinGroup != FALSE); + gray2 = (group->hideOffline != FALSE); + + if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline + + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | ((group->hideOffline && !gray1)?CMIF_CHECKED:0)| (gray1?CMIF_GRAYED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | ((showOfflineinGroup && !gray2) ? CMIF_CHECKED:0)| (gray2?CMIF_GRAYED:0); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowOfflineUsersHereMenuItem, (LPARAM)&mi); - + + mi.flags = CMIM_FLAGS | ((showOfflineinGroup && !gray2) ? CMIF_CHECKED:0)| (gray2?CMIF_GRAYED:0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowOfflineUsersHereMenuItem, (LPARAM)&mi); return 0; -}; +} + INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) { ListParam param = { 0 }; @@ -695,11 +675,9 @@ void InitSubGroupMenus(void) CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op); //add exit command to menu - CLISTMENUITEM mi; GroupMenuParam gmp; - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1000; mi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0); mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; @@ -708,8 +686,6 @@ void InitSubGroupMenus(void) hNewSubGroupMenuItem = (HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); DestroyIcon_protect(mi.hIcon); - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.position = 1001; mi.hIcon = NULL; mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; @@ -718,8 +694,6 @@ void InitSubGroupMenus(void) gmp.wParam = POPUP_GROUPHIDEOFFLINE; hHideOfflineUsersHereMenuItem = (HANDLE)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.position = 1002; mi.hIcon = NULL; mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; @@ -739,8 +713,6 @@ void InitSubGroupMenus(void) AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); DestroyIcon_protect(mi.hIcon); - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.position = 900002; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index 7c9381f7cc..0326de4745 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -629,13 +629,10 @@ int CLUIFramesGetalClientFrame(void) HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,HGENMENU (*pfnAdd )( CLISTMENUITEM* )) { - CLISTMENUITEM mi; HANDLE menuid; int framepos = id2pos(frameid); - ZeroMemory(&mi,sizeof(mi)); - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.hIcon = LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); mi.pszPopupName = (char *)root; mi.popupPosition = frameid; @@ -807,16 +804,11 @@ INT_PTR ModifyMItem(WPARAM wParam,LPARAM lParam) static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam) { - int pos; - CLISTMENUITEM mi; - //TMO_MenuItem tmi; - lockfrm(); - pos = id2pos(wParam); + int pos = id2pos(wParam); if (pos >= 0 && pos < nFramescount) { - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; ModifyMItem((WPARAM)contMITitle,(LPARAM)&mi); @@ -868,8 +860,7 @@ INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) int pos = id2pos(wParam); if (pos >= 0 && pos < nFramescount) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)Frames[pos].MenuHandles.MITitle,(LPARAM)&mi); @@ -1415,14 +1406,11 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam,LPARAM lParam) static int CLUIFramesLoadMainMenu() { - CLISTMENUITEM mi; int i,separator; if ( !(ServiceExists(MS_CLIST_REMOVEMAINMENUITEM))) { - //hmm new menu system not used..so display only two items and warning message - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); // create "show all frames" menu + CLISTMENUITEM mi = { sizeof(mi) }; mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); mi.flags = CMIF_GRAYED; mi.position = 10000000; @@ -1455,10 +1443,8 @@ static int CLUIFramesLoadMainMenu() MainMIRoot = (HGENMENU)-1; } - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - // create root menu + CLISTMENUITEM mi = { sizeof(mi) }; mi.hIcon = LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); mi.flags = CMIF_ROOTPOPUP; mi.position = 3000090000; diff --git a/plugins/Clist_mw/src/clisttray.cpp b/plugins/Clist_mw/src/clisttray.cpp index d18e90f443..af0f210e14 100644 --- a/plugins/Clist_mw/src/clisttray.cpp +++ b/plugins/Clist_mw/src/clisttray.cpp @@ -225,10 +225,7 @@ void InitTrayMenus(void) { //add exit command to menu - CLISTMENUITEM mi; - - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 900000; mi.pszService = "CloseAction"; mi.pszName = LPGEN("E&xit"); diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index ecf2c4aeeb..118d66a463 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -213,37 +213,27 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) mi.flags = CMIM_FLAGS | ( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersOutHereMenuItem, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideEmptyGroupsMenuItem, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi); - return 0; } int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) { - HICON hicon; - CLISTMENUITEM clmi = {0}; - - hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0); + HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0); NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); - clmi.cbSize = sizeof(clmi); - clmi.flags = CMIM_ICON; - clmi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_ICON; + mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&mi); return 0; } @@ -296,11 +286,9 @@ void InitGroupMenus(void) { //add exit command to menu - CLISTMENUITEM mi; GroupMenuParam gmp; - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1900000; mi.pszService = "CloseAction"; mi.pszName = LPGEN("E&xit"); @@ -439,19 +427,16 @@ static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; ClcGroup *group = (ClcGroup *)wParam; if (wParam == 0) return 0; //contact->group - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); - return 0; } + static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) { int tick; @@ -596,13 +581,10 @@ void InitSubGroupMenus(void) op.Value = (INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService"; CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op); - { //add exit command to menu - CLISTMENUITEM mi; GroupMenuParam gmp; - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1000; mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0); mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; @@ -638,10 +620,6 @@ void InitSubGroupMenus(void) mi.pszName = LPGEN("&Delete Group"); gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP; AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - - //MS_CLIST_SubGroupCREATE - - } } //////////////////////////////END SubGroup MENU///////////////////////// diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index cf91ea9106..477edd5345 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -636,16 +636,13 @@ int CLUIFramesGetalClientFrame(void) HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU (*pfnAdd )( CLISTMENUITEM* )) { - CLISTMENUITEM mi; - //TMO_MenuItem tmi; HANDLE menuid; int framepos = id2pos(frameid); - if (FramesSysNotStarted) return NULL; - - ZeroMemory(&mi, sizeof(mi)); + if (FramesSysNotStarted) + return NULL; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); mi.pszPopupName = (char *)root; mi.popupPosition = frameid; @@ -835,18 +832,14 @@ int ModifyMItem(WPARAM wParam, LPARAM lParam) static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) { - int pos; - CLISTMENUITEM mi; - if (FramesSysNotStarted) return -1; lockfrm(); - pos = id2pos((INT_PTR)wParam); + int pos = id2pos((INT_PTR)wParam); if (pos >= 0 && pos < nFramescount) { - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; ModifyMItem((WPARAM)contMITitle, (LPARAM)&mi); @@ -899,18 +892,14 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM lParam) { - int pos; - CLISTMENUITEM mi; - if (FramesSysNotStarted) return -1; lockfrm(); - pos = id2pos((INT_PTR)wParam); + int pos = id2pos((INT_PTR)wParam); if (pos >= 0 && pos < nFramescount) { - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MITitle, (LPARAM)&mi); @@ -1599,9 +1588,6 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM lParam) static int CLUIFramesLoadMainMenu() { - CLISTMENUITEM mi; - int i, separator; - if (FramesSysNotStarted) return -1; @@ -1610,10 +1596,8 @@ static int CLUIFramesLoadMainMenu() MainMIRoot = (HANDLE) - 1; } - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); - // create root menu + CLISTMENUITEM mi = { sizeof(mi) }; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA); //LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; mi.position = (int)3000090000; @@ -1623,8 +1607,8 @@ static int CLUIFramesLoadMainMenu() MainMIRoot = Menu_AddMainMenuItem(&mi); // create frames menu - separator = (int)3000200000; - for (i = 0;i < nFramescount;i++) { + int separator = (int)3000200000; + for (int i=0; i < nFramescount; i++) { mi.hIcon = Frames[i].TitleBar.hicon; mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP | CMIF_TCHAR; mi.position = separator; diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 8d11eddac5..7d6e67b063 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -223,64 +223,40 @@ INT_PTR HideOfflineRootHelper(WPARAM wParam,LPARAM lParam) !SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETHIDEOFFLINEROOT,0,0), 0); return 0; -}; +} static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; - - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | (cfg::getByte("CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersOutHereMenuItem, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideEmptyGroupsMenuItem, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableGroupsMenuItem, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hGroupMainMenuItemProxy, (LPARAM)&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAppearanceMenuItemProxy, (LPARAM)&mi); - return 0; -}; +} int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) { - HICON hicon; - CLISTMENUITEM clmi={0}; - - //hicon=LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP); - NewGroupIconidx=ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon); - - clmi.cbSize=sizeof(clmi); - clmi.flags=CMIM_ICON; - clmi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewSubGroupMenuItem,(LPARAM)&clmi); - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hNewGroupMenuItem,(LPARAM)&clmi); - // - - + CLISTMENUITEM clmi = { sizeof(clmi) }; + clmi.flags = CMIM_ICON; + clmi.hIcon = ImageList_GetIcon(hCListImages, NewGroupIconidx, 0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hNewSubGroupMenuItem, (LPARAM)&clmi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hNewGroupMenuItem, (LPARAM)&clmi); return 0; -}; +} void InitGroupMenus(void) { @@ -330,11 +306,9 @@ void InitGroupMenus(void) { //add exit command to menu - CLISTMENUITEM mi; GroupMenuParam gmp; - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position=1900000; mi.pszService="CloseAction"; mi.pszName=LPGEN("E&xit"); @@ -387,7 +361,6 @@ void InitGroupMenus(void) AddGroupMenuItem(0,(LPARAM)&mi); - memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=500000; @@ -482,8 +455,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) return 0; //contact->group - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); @@ -657,11 +629,9 @@ void InitSubGroupMenus(void) { //add exit command to menu - CLISTMENUITEM mi; GroupMenuParam gmp; - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position=1000; mi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0); mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy"; diff --git a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp index ee867b0a48..7daa97cf9d 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp @@ -5,41 +5,28 @@ HANDLE hPriorityItem = 0, hFloatingItem = 0; static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; - BYTE bSetting; - - // Menu Item - Floating Contact - bSetting = cfg::getByte("CList", "flt_enabled", 0); - if (bSetting && !hFloatingItem) - { - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); + BYTE bSetting = cfg::getByte("CList", "flt_enabled", 0); + if (bSetting && !hFloatingItem) { + CLISTMENUITEM mi = { sizeof(mi) }; mi.position=200000; mi.pszPopupName=(char *)-1; mi.pszService="CList/SetContactFloating"; mi.pszName=LPGEN("&Floating Contact"); - if (pcli) - { - if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) - mi.flags=CMIF_CHECKED; - } + if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) + mi.flags = CMIF_CHECKED; + hFloatingItem = Menu_AddContactMenuItem(&mi); } - else if ( !bSetting && hFloatingItem) - { + else if ( !bSetting && hFloatingItem) { CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hFloatingItem, 0); hFloatingItem = 0; } - else - { - memset(&mi,0,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.flags=CMIM_FLAGS; - if (pcli) - { - if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) - mi.flags |= CMIF_CHECKED; - } + else { + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; + if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0)) + mi.flags |= CMIF_CHECKED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hFloatingItem, (LPARAM)&mi); } return 0; diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index fdd5c3e9f2..bfabb68c49 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -398,27 +398,24 @@ int InitCustomMenus(void) CreateServiceFunction("CloseAction",CloseAction); CreateServiceFunction("CList/SetContactFloating", SetContactFloating); CreateServiceFunction("CList/SetContactIgnore", SetContactIgnore); - { - //FYR: Visibility and ignore item moved back to clist_nicer from core - HANDLE hIgnoreItem = 0; // FYR: moved from global it is never used globally - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof( mi ); - - if ( !hIgnoreItem ) { - mi.position = 200000; - mi.pszPopupName = ( char* )-1; - mi.pszService = "CList/SetContactIgnore"; - mi.pszName = LPGEN("&Contact list settings..."); - hIgnoreItem = Menu_AddContactMenuItem(&mi); - } - } - hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); - hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + { + //FYR: Visibility and ignore item moved back to clist_nicer from core + HANDLE hIgnoreItem = 0; // FYR: moved from global it is never used globally + if ( !hIgnoreItem ) { + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 200000; + mi.pszPopupName = ( char* )-1; + mi.pszService = "CList/SetContactIgnore"; + mi.pszName = LPGEN("&Contact list settings..."); + hIgnoreItem = Menu_AddContactMenuItem(&mi); + } + } + hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); return 0; } void UninitCustomMenus(void) { - } diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index c52b574648..3d0da48591 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -187,9 +187,7 @@ static void ShowConsole(int show) if (hMenu) { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.ptszName = (show) ? _T("Hide Console") : _T("Show Console"); mi.flags = CMIM_NAME | CMIF_TCHAR; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&mi); @@ -1271,9 +1269,9 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) if (hwndConsole && IsWindow(hwndConsole)) { - CLISTMENUITEM mi = {0}; HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.hIcon = hIcons[0]; mi.ptszPopupName = _T("&Help"); 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; } diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 18f78be3eb..047f93a7ef 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -269,10 +269,7 @@ static int ModulesLoaded(WPARAM, LPARAM) UploadInit(); - CLISTMENUITEM mi = { 0 }; - - mi.cbSize = sizeof(mi); - + CLISTMENUITEM mi = { sizeof(mi) }; mi.popupPosition = 2000089999; mi.position = 2000089999; mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR; diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index 750ee9ffbc..045199f45d 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -65,8 +65,7 @@ void MirandaContact::save(HANDLE hContact, bool bValue) void MirandaContact::addMenuItem() { - CLISTMENUITEM mi; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszName = MENU_ITEM_TEXT; mi.flags = 0; mi.position = 65535; diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 2d4e21c310..beb025d7d3 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -162,8 +162,7 @@ static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) int ModulesLoaded(WPARAM wParam,LPARAM lParam) { // Register menu item - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1900000001; mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)); mi.pszName = modFullname; diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index f7cfe921b2..a9fd40b3a8 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -51,7 +51,6 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { case PSN_APPLY: { - CLISTMENUITEM mi = {0}; char mods[4096]; DBWriteContactSettingByte(NULL,modname,"ExpandSettingsOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_EXPANDSETTINGS)); DBWriteContactSettingByte(NULL,modname,"RestoreOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_RESTORESETTINGS)); @@ -65,15 +64,13 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) DBWriteContactSettingWord(NULL,modname,"PopupDelay",(WORD)GetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,NULL,0)); DBWriteContactSettingDword(NULL,modname,"PopupColour",(DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0)); - mi.cbSize = sizeof(mi); - + CLISTMENUITEM mi = { sizeof(mi) }; if (!IsDlgButtonChecked(hwnd,IDC_MENU)) mi.flags = CMIM_FLAGS | CMIF_HIDDEN; else mi.flags = CMIM_FLAGS; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hUserMenu, (LPARAM) & mi); - + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hUserMenu, (LPARAM) & mi); } return TRUE; } diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 75d9f71614..6e3cbd5239 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -82,8 +82,7 @@ static void IcoLibInit(void) static void MenuInit(void) { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.hIcon = Skin_GetIcon("backup"); mi.ptszPopupName = LPGENT("Database"); diff --git a/plugins/Dbx_mmap_SA/src/dialogs.cpp b/plugins/Dbx_mmap_SA/src/dialogs.cpp index c54acaa597..6a53bcbf4b 100644 --- a/plugins/Dbx_mmap_SA/src/dialogs.cpp +++ b/plugins/Dbx_mmap_SA/src/dialogs.cpp @@ -70,17 +70,14 @@ INT_PTR ChangePassword(WPARAM wParam, LPARAM lParam) void xModifyMenu(HANDLE hMenu,long flags,const TCHAR* name, HICON hIcon) { - CLISTMENUITEM menu; - ZeroMemory(&menu,sizeof(menu)); - menu.cbSize = sizeof(menu); - menu.flags = CMIM_FLAGS | CMIF_TCHAR; - menu.flags |= name ? CMIM_NAME : 0; - menu.flags |= hIcon ? CMIM_ICON : 0; - menu.flags |= flags; - menu.ptszName = (TCHAR*)name; - menu.hIcon = hIcon; - - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenu,(LPARAM)&menu); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_TCHAR; + mi.flags |= name ? CMIM_NAME : 0; + mi.flags |= hIcon ? CMIM_ICON : 0; + mi.flags |= flags; + mi.ptszName = (TCHAR*)name; + mi.hIcon = hIcon; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenu,(LPARAM)&mi); } int InitMenus(WPARAM, LPARAM) @@ -106,15 +103,14 @@ int InitMenus(WPARAM, LPARAM) HANDLE hIcon = Skin_AddIcon(&sid); // main menu item - CLISTMENUITEM menu = {0}; - menu.cbSize = sizeof(menu); - menu.flags = CMIM_ALL | CMIF_TCHAR | CMIF_ICONFROMICOLIB; - menu.icolibItem = hIcon; - menu.ptszName = (g_Db->m_bEncoding) ? LPGENT("Change password") : LPGENT("Set password"); - menu.ptszPopupName = LPGENT("Database"); - menu.pszService = MS_DB_CHANGEPASSWORD; - menu.position = 500100000; - hSetPwdMenu = Menu_AddMainMenuItem(&menu); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_ALL | CMIF_TCHAR | CMIF_ICONFROMICOLIB; + mi.icolibItem = hIcon; + mi.ptszName = (g_Db->m_bEncoding) ? LPGENT("Change password") : LPGENT("Set password"); + mi.ptszPopupName = LPGENT("Database"); + mi.pszService = MS_DB_CHANGEPASSWORD; + mi.position = 500100000; + hSetPwdMenu = Menu_AddMainMenuItem(&mi); return 0; } diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index dea3d4457f..3ca4573d00 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -124,11 +124,9 @@ static void InitIcolib() void InitMenuItems() { - CLISTMENUITEM mi = {0}; - CLISTMENUITEM mi2 = {0}; TCHAR stzName[256]; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.icolibItem = hIconlibItem[ServerList::FTP_COUNT]; mi.position = 3000090001; @@ -141,7 +139,7 @@ void InitMenuItems() mi.cbSize = sizeof(mi); mi.ptszName = stzName; - mi2.cbSize = sizeof(mi2); + CLISTMENUITEM mi2 = { sizeof(mi2) }; mi2.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR; mi2.pszService = MS_FTPFILE_CONTACTMENU; @@ -256,8 +254,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) bHideRoot = false; } - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; if (opt.bUseSubmenu) @@ -287,11 +284,8 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) void PrebuildMainMenu() { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - - for (int i = 0; i < ServerList::FTP_COUNT; i++) - { + CLISTMENUITEM mi = { sizeof(mi) }; + for (int i=0; i < ServerList::FTP_COUNT; i++) { mi.flags = CMIM_FLAGS; if (!ftpList[i]->bEnabled) mi.flags |= opt.bHideInactive ? CMIF_HIDDEN : CMIF_GRAYED; diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 733a890bd0..767a870174 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -343,8 +343,7 @@ extern "C" __declspec(dllexport) int Load(void) LoadHttpApi(); #ifdef _DEBUG - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS); mi.position = 1900000000; diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 197e59309f..a9f4cb17d9 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -226,7 +226,6 @@ int OnModulesLoaded(WPARAM wparam,LPARAM lparam) hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged); CLISTMENUITEM mi = { sizeof(mi) }; - mi.cbSize = sizeof(CLISTMENUITEM); mi.position = 200011; mi.hIcon = hIcons[ICON_MAIN]; mi.pszName = LPGEN("File As Message..."); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 5faf1c177b..df6aa4320b 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -513,11 +513,8 @@ static int OnStatusModeChange( WPARAM wParam, LPARAM lParam ) static int OnPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) { ThumbInfo *pThumb = thumbList.FindThumbByContact( (HANDLE) wParam ); - CLISTMENUITEM clmi; - - ZeroMemory( &clmi, sizeof( clmi )); - clmi.cbSize = sizeof( clmi ); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = ( pThumb == NULL ) ? CMIM_FLAGS | CMIF_HIDDEN : CMIM_FLAGS &~CMIF_HIDDEN; CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemRemove, (LPARAM)&clmi ); @@ -1060,8 +1057,7 @@ static void LoadMenus() // Remove thumb menu item hRemoveThumb = CreateServiceFunction( sModule "/RemoveThumb", OnContactMenu_Remove ); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 0xFFFFF; mi.flags = CMIF_TCHAR; mi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( IDI_HIDE )); @@ -1184,18 +1180,15 @@ static INT_PTR OnHotKey_HideWhenCListShow( WPARAM wParam, LPARAM lParam ) static INT_PTR OnMainMenu_HideAll( WPARAM wParam, LPARAM lParam ) { - CLISTMENUITEM clmi = {0}; - int b; - fcOpt.bHideAll = !fcOpt.bHideAll; DBWriteContactSettingByte(NULL, sModule, "HideAll", (BYTE)fcOpt.bHideAll); OnStatusChanged(); - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_NAME | CMIM_ICON|CMIF_TCHAR; - clmi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE )); - clmi.ptszName = fcOpt.bHideAll ? _T("Show all thumbs") : _T("Hide all thumbs"); - b = CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMainMenuItemHideAll, ( LPARAM )&clmi ); + CLISTMENUITEM clmi = { sizeof(clmi) }; + clmi.flags = CMIM_NAME | CMIM_ICON|CMIF_TCHAR; + clmi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE )); + clmi.ptszName = fcOpt.bHideAll ? _T("Show all thumbs") : _T("Hide all thumbs"); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMainMenuItemHideAll, ( LPARAM )&clmi ); return 0; } 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"); diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index b246cdeaaf..4208fb0634 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -47,7 +47,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) extern "C" __declspec(dllexport) int Load(void) { - CLISTMENUITEM linklistmenuitem; WNDCLASS wndclass; @@ -71,14 +70,15 @@ extern "C" __declspec(dllexport) int Load(void) #endif CreateServiceFunction("Linklist/MenuCommand", LinkList_Main); - ZeroMemory(&linklistmenuitem, sizeof(linklistmenuitem)); - linklistmenuitem.cbSize = sizeof(linklistmenuitem); - linklistmenuitem.position = 0x00; - linklistmenuitem.flags = CMIF_TCHAR; - linklistmenuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON)); - linklistmenuitem.ptszName = LPGENT("&Create Linklist"); - linklistmenuitem.pszService = "Linklist/MenuCommand"; - Menu_AddContactMenuItem(&linklistmenuitem); + + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 0x00; + mi.flags = CMIF_TCHAR; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON)); + mi.ptszName = LPGENT("&Create Linklist"); + mi.pszService = "Linklist/MenuCommand"; + Menu_AddContactMenuItem(&mi); + hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); wndclass.style = CS_HREDRAW | CS_VREDRAW; diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index f16a875b3a..3de2bee115 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -115,9 +115,7 @@ extern "C" __declspec(dllexport) int Load(void) hIcoHandle = IcoLib_Register("import_main", "Import", LPGEN("Import..."), IDI_IMPORT); - CLISTMENUITEM mi; - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.icolibItem = hIcoHandle; mi.pszName = LPGEN("&Import..."); mi.position = 500050000; diff --git a/plugins/LangMan/src/main.cpp b/plugins/LangMan/src/main.cpp index 2309bf1ec8..db222bf309 100644 --- a/plugins/LangMan/src/main.cpp +++ b/plugins/LangMan/src/main.cpp @@ -130,8 +130,7 @@ __declspec(dllexport) int Load(void) /* menu item */ - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 2000089999; mi.icolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RELOAD)); mi.pszName = LPGEN("Reload langpack"); diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index cea9ef9566..21326eee11 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -172,8 +172,7 @@ void UpdateGlobalStatusMenus() { BOOL enabled = ListeningToEnabled(NULL, TRUE); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(clmi); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | (enabled ? CMIF_CHECKED : 0) | (opts.enable_sending ? 0 : CMIF_GRAYED); @@ -207,8 +206,7 @@ void RebuildMenu() TCHAR text[512]; mir_sntprintf(text, MAX_REGS(text), TranslateT("Send to %s"), info->account); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 100000 + i; mi.pszPopupName = (char *) hMainMenuGroup; mi.popupPosition = 500080000 + i; @@ -260,8 +258,7 @@ int AccListChanged(WPARAM wParam, LPARAM lParam) TCHAR text[512]; mir_sntprintf(text, MAX_REGS(text), TranslateT("Send to %s"), info->account); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(clmi); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME | CMIF_TCHAR; clmi.ptszName = text; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->hMenu, (LPARAM) &clmi); @@ -767,8 +764,7 @@ INT_PTR EnableListeningTo(WPARAM wParam,LPARAM lParam) ProtocolInfo *info = GetProtoInfo(proto); if (info != NULL) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(clmi); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | (lParam ? CMIF_CHECKED : 0) | (opts.enable_sending ? 0 : CMIF_GRAYED); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 6450110251..c01630d821 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -896,8 +896,7 @@ INT_PTR onIgnore(WPARAM wparam,LPARAM lparam) static HANDLE AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag, char* service, int pos, int param) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.hParentMenu = hRoot; mi.popupPosition = param; mi.position = pos; @@ -910,14 +909,13 @@ static HANDLE AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag static void ModifySubmenuItem(HANDLE hItem, TCHAR* name, int checked, int hidden) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.ptszName = name; - mi.flags = CMIM_FLAGS | CMIF_TCHAR; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.ptszName = name; + mi.flags = CMIM_FLAGS | CMIF_TCHAR; if ( checked ) - mi.flags |= CMIF_CHECKED; + mi.flags |= CMIF_CHECKED; if ( hidden ) - mi.flags |= CMIF_HIDDEN; + mi.flags |= CMIF_HIDDEN; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hItem, (LPARAM)&mi); } @@ -1196,8 +1194,6 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) { int pos = 1000, i = 0; - CLISTMENUITEM mi; - IconsInit(); bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0; @@ -1215,7 +1211,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hServices[10] = CreateServiceFunction(MS_COPYIP,onCopyIP); hServices[11] = CreateServiceFunction(MS_COPYMIRVER,onCopyMirVer); - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.hIcon = NULL; mi.pszContactOwner = NULL; diff --git a/plugins/MetaContacts/src/icons.cpp b/plugins/MetaContacts/src/icons.cpp index e6cbc9a3a3..54f56e2a84 100644 --- a/plugins/MetaContacts/src/icons.cpp +++ b/plugins/MetaContacts/src/icons.cpp @@ -30,34 +30,32 @@ void ReleaseIconEx(HICON hIcon) int ReloadIcons(WPARAM wParam, LPARAM lParam) { // fix menu icons - CLISTMENUITEM menu = {0}; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_ICON; - menu.cbSize = sizeof(menu); - menu.flags = CMIM_ICON; + mi.hIcon = LoadIconEx(Meta_IsEnabled() ? I_MENUOFF : I_MENU); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&mi); + ReleaseIconEx(mi.hIcon); - menu.hIcon = LoadIconEx(Meta_IsEnabled() ? I_MENUOFF : I_MENU); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&menu); - ReleaseIconEx(menu.hIcon); - - menu.hIcon = LoadIconEx(I_CONVERT); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&menu); - ReleaseIconEx(menu.hIcon); + mi.hIcon = LoadIconEx(I_CONVERT); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi); + ReleaseIconEx(mi.hIcon); - menu.hIcon = LoadIconEx(I_ADD); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&menu); - ReleaseIconEx(menu.hIcon); + mi.hIcon = LoadIconEx(I_ADD); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi); + ReleaseIconEx(mi.hIcon); - menu.hIcon = LoadIconEx(I_EDIT); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&menu); - ReleaseIconEx(menu.hIcon); + mi.hIcon = LoadIconEx(I_EDIT); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi); + ReleaseIconEx(mi.hIcon); - menu.hIcon = LoadIconEx(I_SETDEFAULT); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&menu); - ReleaseIconEx(menu.hIcon); + mi.hIcon = LoadIconEx(I_SETDEFAULT); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi); + ReleaseIconEx(mi.hIcon); - menu.hIcon = LoadIconEx(I_REMOVE); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&menu); - ReleaseIconEx(menu.hIcon); + mi.hIcon = LoadIconEx(I_REMOVE); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi); + ReleaseIconEx(mi.hIcon); return 0; } diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp index 743b25c838..0d7d82d7a7 100644 --- a/plugins/MetaContacts/src/meta_menu.cpp +++ b/plugins/MetaContacts/src/meta_menu.cpp @@ -394,7 +394,6 @@ INT_PTR TranslateMenuFunc(HANDLE hMeta, int contact_number) { */ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM mi; DBVARIANT dbv; HANDLE hContact; char *proto; @@ -402,8 +401,8 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) int i, iconIndex; WORD status; + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; - mi.cbSize = sizeof(CLISTMENUITEM); if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID,-1) != (DWORD)-1) { diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index c837a7b1c8..d205ff9a6e 100644 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -1489,9 +1489,9 @@ int Meta_CallMostOnline(WPARAM wParam, LPARAM lParam) { } -INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM mi; - mi.cbSize = sizeof(CLISTMENUITEM); +INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam) +{ + CLISTMENUITEM mi = { sizeof(mi) }; // just write to db - the rest is handled in the Meta_SettingChanged function if (db_get_b(0, META_PROTO, "Enabled", 1)) { db_set_b(0, META_PROTO, "Enabled", 0); diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index 17c2d9a4b0..270eb6de60 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -122,15 +122,15 @@ INT_PTR SVC_ToggleHTMLOTR(WPARAM wParam, LPARAM lParam) { return 0; } -void InitMenu() { +void InitMenu() +{ CreateServiceFunction(MS_OTR_MENUSTART, SVC_StartOTR); CreateServiceFunction(MS_OTR_MENUSTOP, SVC_StopOTR); CreateServiceFunction(MS_OTR_MENUREFRESH, SVC_RefreshOTR); CreateServiceFunction(MS_OTR_MENUVERIFY, SVC_VerifyOTR); CreateServiceFunction(MS_OTR_MENUTOGGLEHTML, SVC_ToggleHTMLOTR); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB; mi.position = -400000; @@ -154,11 +154,11 @@ void DeinitMenu() { UnhookEvent(hMenuBuildEvent); } -int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { +int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) +{ HANDLE hContact = (HANDLE)wParam; - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB; const char *proto = contact_get_proto(hContact); diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 725ad3222d..0ab02fa6f2 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -180,9 +180,7 @@ int MainInit(WPARAM /*wparam*/,LPARAM /*lparam*/) MessageBox( NULL , LPGENT("Failed to HookEvent ME_OPT_INITIALISE") , MSG_BOX_TITEL , MB_OK ); - CLISTMENUITEM mi; - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize=sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags=0; mi.pszContactOwner=NULL; //all contacts mi.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_EXPORT_MESSAGE)); diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index f2e056082b..3dca1c808a 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -317,17 +317,15 @@ int CreateFrame() // Create menu item - CLISTMENUITEM menu = {0}; - - menu.cbSize=sizeof(menu); - menu.flags = CMIF_TCHAR; - menu.popupPosition = -0x7FFFFFFF; - menu.ptszPopupName = LPGENT("My Details"); - menu.position = 1; // 500010000 - menu.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - menu.ptszName = LPGENT("Show My Details"); - menu.pszService= MODULE_NAME "/ShowHideMyDetails"; - hMenuShowHideFrame = Menu_AddMainMenuItem(&menu); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIF_TCHAR; + mi.popupPosition = -0x7FFFFFFF; + mi.ptszPopupName = LPGENT("My Details"); + mi.position = 1; // 500010000 + mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.ptszName = LPGENT("Show My Details"); + mi.pszService= MODULE_NAME "/ShowHideMyDetails"; + hMenuShowHideFrame = Menu_AddMainMenuItem(&mi); if ( db_get_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1) == 1) { ShowWindow(hwnd_container, SW_SHOW); @@ -2485,8 +2483,7 @@ INT_PTR HideFrameFunc(WPARAM wParam, LPARAM lParam) void FixMainMenu() { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME; if (MyDetailsFrameVisible()) diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 188e41e748..52b8fb2666 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -150,11 +150,10 @@ static int MainInit(WPARAM wparam,LPARAM lparam) InitProtocolData(); // Add options to menu - CLISTMENUITEM mi; + // !!!!!!!! check it later + CLISTMENUITEM mi = { sizeof(mi) }; if (protocols->CanSetAvatars()) { - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); mi.flags = CMIF_TCHAR; mi.popupPosition = 500050000; mi.ptszPopupName = LPGENT("My Details"); diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index 6831c204a1..99e35c4740 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -1,6 +1,6 @@ /* Name: NewEventNotify - Plugin for Miranda IM - File: menuitem.c - Manages item(s) in the Miranda Menu + File: mi.c - Manages item(s) in the Miranda Menu Version: 0.0.4 Description: Notifies you about some events Author: icebreaker, @@ -24,7 +24,6 @@ #include "neweventnotify.h" -CLISTMENUITEM menuitem; HANDLE hMenuitemNotify; BOOL bNotify; @@ -40,14 +39,14 @@ static INT_PTR MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam) int MenuitemUpdate(BOOL bStatus) { - //menuitem.flags = CMIM_FLAGS | (bStatus ? CMIF_CHECKED : 0); - menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(bStatus ? IDI_ENABLED : IDI_DISABLED)); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(bStatus ? IDI_ENABLED : IDI_DISABLED)); if (bStatus) - menuitem.ptszName = TranslateT(MENUITEM_DISABLE); + mi.ptszName = TranslateT(MENUITEM_DISABLE); else - menuitem.ptszName = TranslateT(MENUITEM_ENABLE); - menuitem.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuitemNotify, (LPARAM)&menuitem); + mi.ptszName = TranslateT(MENUITEM_ENABLE); + mi.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuitemNotify, (LPARAM)&mi); return 0; } @@ -56,14 +55,13 @@ int MenuitemInit(BOOL bStatus) { CreateServiceFunction(MS_NEN_MENUNOTIFY, MenuitemNotifyCmd); - ZeroMemory(&menuitem, sizeof(menuitem)); - menuitem.cbSize = sizeof(CLISTMENUITEM); - menuitem.position = 1; - menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)); - menuitem.ptszPopupName = TranslateT("PopUps"); - menuitem.pszService = MS_NEN_MENUNOTIFY; - menuitem.flags = CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; - hMenuitemNotify = Menu_AddMainMenuItem(&menuitem); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 1; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)); + mi.ptszPopupName = TranslateT("PopUps"); + mi.pszService = MS_NEN_MENUNOTIFY; + mi.flags = CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; + hMenuitemNotify = Menu_AddMainMenuItem(&mi); bNotify = bStatus; MenuitemUpdate(bNotify); diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 2e22a9f5cd..648e15c7de 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -263,7 +263,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0); options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0); } - //send changes to menuitem + //send changes to mi MenuitemUpdate(!options->bDisable); //enable "Apply" button SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); @@ -282,7 +282,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L case PSN_RESET: OptionsRead(); - //maybe something changed with the menuitem + //maybe something changed with the mi MenuitemUpdate(!options->bDisable); break; } diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index dc590828b1..23041dab04 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1037,8 +1037,7 @@ INT_PTR EnableDisableMenuCommand(WPARAM wParam, LPARAM lParam) opt.TempDisabled = !opt.TempDisabled; DBWriteContactSettingByte(0, MODULE, "TempDisable", opt.TempDisabled); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON | CMIM_NAME | CMIF_TCHAR; if (opt.TempDisabled) { mi.ptszName = _T("Enable status notification"); @@ -1056,8 +1055,7 @@ INT_PTR EnableDisableMenuCommand(WPARAM wParam, LPARAM lParam) void InitMainMenuItem() { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB; mi.ptszPopupName = ServiceExists(MS_POPUP_ADDPOPUP) ? _T("PopUps") : NULL; mi.pszService = MS_STATUSCHANGE_MENUCOMMAND; diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index fbfe9ad9fa..66fd9400f5 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -194,8 +194,8 @@ extern "C" int __declspec(dllexport) Load() CreateServiceFunction("/ExportGPGKeys",ExportGpGKeys); CreateServiceFunction("/ImportGPGKeys",ImportGpGKeys); - CLISTMENUITEM mi = {0}; - mi.cbSize=sizeof(mi); + // !!!!!!!! check it later + CLISTMENUITEM mi = { sizeof(mi) }; mi.position=-0x7FFFFFFF; mi.flags=CMIF_TCHAR; mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index f872bd5e7f..3effa8aa48 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -208,8 +208,8 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) setSrmmIcon(hContact); setClistIcon(hContact); enc = enc?0:1; - CLISTMENUITEM mi = {0}; - mi.cbSize=sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME; enc?mi.pszName="Turn off GPG encryption":mi.pszName="Turn on GPG encryption"; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi); @@ -221,8 +221,8 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l) HANDLE hContact = (HANDLE)w; if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); - CLISTMENUITEM mi = {0}; - mi.cbSize=sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME; TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); if(_tcslen(tmp) < 1) diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index 62a5da045d..a0217919ec 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -23,8 +23,7 @@ HANDLE hService2[6]; VOID InitMenu() { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszContactOwner = MODULE; mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_NOTOFFLINE; diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index a1bb09e6ed..e2742e3fcd 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -164,9 +164,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { char *proto = GetContactProto(hContact); bool chat_room = (proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) != 0); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS|CMIF_TCHAR; if(chat_room) mi.flags |= CMIF_HIDDEN; else { @@ -307,8 +305,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { InitIcons(); // create contact menu item - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.position = -300010; diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 0553a91d6d..6150abb40d 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -207,79 +207,71 @@ static void InitServices() int OnModulesLoaded(WPARAM wparam,LPARAM lparam) { - CLISTMENUITEM cmi = {0}; - // register fonts and hotkeys - RegisterFontServiceFonts(); RegisterKeyBindings(); // register menus - - cmi.cbSize = sizeof(cmi); - cmi.pszContactOwner = NULL; - cmi.ptszPopupName = LPGENT("Notes && Reminders"); - cmi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB; - - cmi.position = 1600000000; - cmi.icolibItem = hIconLibItem[2]; - cmi.ptszName = LPGENT("New &Note"); - cmi.pszService = MODULENAME"/MenuCommandAddNew"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); - - cmi.position = 1600000001; - cmi.icolibItem = hIconLibItem[0]; - cmi.ptszName = LPGENT("New &Reminder"); - cmi.pszService = MODULENAME"/MenuCommandNewReminder"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); - - // - - cmi.position = 1600100000; - cmi.icolibItem = hIconLibItem[3]; - cmi.ptszName = LPGENT("&Show / Hide Notes"); - cmi.pszService = MODULENAME"/MenuCommandShowHide"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); - - cmi.position = 1600100001; - cmi.icolibItem = hIconLibItem[13]; - cmi.ptszName = LPGENT("Vie&w Notes"); - cmi.pszService = MODULENAME"/MenuCommandViewNotes"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); - - cmi.position = 1600100002; - cmi.icolibItem = hIconLibItem[1]; - cmi.ptszName = LPGENT("&Delete All Notes"); - cmi.pszService = MODULENAME"/MenuCommandDeleteAll"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); - - cmi.position = 1600100003; - cmi.icolibItem = hIconLibItem[11]; - cmi.ptszName = LPGENT("&Bring All to Front"); - cmi.pszService = MODULENAME"/MenuCommandBringAllFront"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); - - // - - cmi.position = 1600200000; - cmi.icolibItem = hIconLibItem[6]; - cmi.ptszName = LPGENT("&View Reminders"); - cmi.pszService = MODULENAME"/MenuCommandViewReminders"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); - - cmi.position = 1600200001; - cmi.icolibItem = hIconLibItem[5]; - cmi.ptszName = LPGENT("D&elete All Reminders"); - cmi.pszService = MODULENAME"/MenuCommandDeleteReminders"; - if (g_AddContListMI) Menu_AddContactMenuItem(&cmi); - Menu_AddMainMenuItem(&cmi); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.pszContactOwner = NULL; + mi.ptszPopupName = LPGENT("Notes && Reminders"); + mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB; + + mi.position = 1600000000; + mi.icolibItem = hIconLibItem[2]; + mi.ptszName = LPGENT("New &Note"); + mi.pszService = MODULENAME"/MenuCommandAddNew"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); + + mi.position = 1600000001; + mi.icolibItem = hIconLibItem[0]; + mi.ptszName = LPGENT("New &Reminder"); + mi.pszService = MODULENAME"/MenuCommandNewReminder"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); + + mi.position = 1600100000; + mi.icolibItem = hIconLibItem[3]; + mi.ptszName = LPGENT("&Show / Hide Notes"); + mi.pszService = MODULENAME"/MenuCommandShowHide"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); + + mi.position = 1600100001; + mi.icolibItem = hIconLibItem[13]; + mi.ptszName = LPGENT("Vie&w Notes"); + mi.pszService = MODULENAME"/MenuCommandViewNotes"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); + + mi.position = 1600100002; + mi.icolibItem = hIconLibItem[1]; + mi.ptszName = LPGENT("&Delete All Notes"); + mi.pszService = MODULENAME"/MenuCommandDeleteAll"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); + + mi.position = 1600100003; + mi.icolibItem = hIconLibItem[11]; + mi.ptszName = LPGENT("&Bring All to Front"); + mi.pszService = MODULENAME"/MenuCommandBringAllFront"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); + + mi.position = 1600200000; + mi.icolibItem = hIconLibItem[6]; + mi.ptszName = LPGENT("&View Reminders"); + mi.pszService = MODULENAME"/MenuCommandViewReminders"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); + + mi.position = 1600200001; + mi.icolibItem = hIconLibItem[5]; + mi.ptszName = LPGENT("D&elete All Reminders"); + mi.pszService = MODULENAME"/MenuCommandDeleteReminders"; + if (g_AddContListMI) Menu_AddContactMenuItem(&mi); + Menu_AddMainMenuItem(&mi); // register misc diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index ab9442c524..580153ada9 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -762,8 +762,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) newNudge->item.hIcoLibItem = Skin_AddIcon(&sid); //Add contact menu entry - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.popupPosition = 500085000; mi.pszContactOwner = proto->szModuleName; mi.pszPopupName = proto->szModuleName; diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp index 0afa6edee0..301827debb 100644 --- a/plugins/Nudge/src/nudge.cpp +++ b/plugins/Nudge/src/nudge.cpp @@ -30,10 +30,7 @@ void CNudge::Load(void) int CNudgeElement::ShowContactMenu(bool show) { - - CLISTMENUITEM mi; - memset( &mi, 0, sizeof( mi )); - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = show? CMIM_FLAGS : CMIM_FLAGS | CMIF_HIDDEN ; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi); diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp index 46129468cd..38fba5857b 100644 --- a/plugins/OpenFolder/src/openFolder.cpp +++ b/plugins/OpenFolder/src/openFolder.cpp @@ -85,8 +85,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) hotkey.DefHotKey = MAKEWORD( 'O', HOTKEYF_SHIFT | HOTKEYF_ALT ); Hotkey_Register(&hotkey); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 0x7FFFFFFF; mi.flags = CMIF_ICONFROMICOLIB|CMIF_TCHAR; mi.icolibItem = hIconOpenFolder; diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 09ba638c9e..6622a6ba21 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -52,9 +52,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(void) { - CLISTMENUITEM mi; - mir_getLP(&pluginInfoEx); + TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"DEFAULT_UPDATES_FOLDER)); lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot)); if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) @@ -70,8 +69,8 @@ extern "C" __declspec(dllexport) int Load(void) // Add cheking update menu item hCheckUpdates = CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcon = Skin_GetIcon("check_update"); diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index e2164c2492..d74ed92621 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -337,10 +337,10 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) bool bIsContact = false; char *szProto = GetContactProto((HANDLE)wParam); - if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false; + if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) + bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false; - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; if (!bIsContact) mi.flags |= CMIF_HIDDEN; @@ -385,10 +385,7 @@ void InitIcolib() void InitMenuItems() { - CLISTMENUITEM mi = {0}; - CLISTMENUITEM mi2 = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.icolibItem = hMainIcon; mi.position = 3000090005; @@ -413,7 +410,7 @@ void InitMenuItems() mi.ptszName = _T("Default web page"); HGENMENU hDefWebMenu = Menu_AddContactMenuItem(&mi); - mi2.cbSize = sizeof(mi2); + CLISTMENUITEM mi2 = { sizeof(mi2) }; mi2.pszService = MS_PASTEIT_CONTACTMENU; mi2.hParentMenu = hDefWebMenu; for(int i = 0 ; i < PasteToWeb::pages; ++i) @@ -431,16 +428,11 @@ void InitMenuItems() void DefWebPageChanged() { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - - for (int i = 0; i < PasteToWeb::pages; i++) - { + CLISTMENUITEM mi = { sizeof(mi) }; + for (int i = 0; i < PasteToWeb::pages; i++) { mi.flags = CMIM_FLAGS; if (Options::instance->defWeb == i) - { mi.flags |= CMIF_CHECKED; - } CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hWebPageMenus[i], (LPARAM)&mi); } diff --git a/plugins/Ping/src/menu.cpp b/plugins/Ping/src/menu.cpp index dbec0a3447..29b3d24696 100644 --- a/plugins/Ping/src/menu.cpp +++ b/plugins/Ping/src/menu.cpp @@ -4,95 +4,24 @@ HANDLE hMenuDisable, hMenuGraph, hMenuEdit; HANDLE hEventMenuBuild; -/* -int MenuBuild(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM menu; - ZeroMemory(&menu,sizeof(menu)); - menu.cbSize=sizeof(menu); - - menu.flags = CMIM_NAME | CMIM_ICON; - bool disable = DBGetContactSettingWord((HANDLE)wParam, PLUG, "Status", ID_STATUS_OFFLINE) != options.off_status; - if(disable) { - menu.hIcon = hIconDisabled; - menu.pszName = Translate("Disable"); - } else { - menu.hIcon = hIconEnabled; - menu.pszName = Translate("Enable"); - } - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDisable, (LPARAM)&menu); - - // hide graph menu item if window displayed - //menu.flags = CMIM_FLAGS | (DBGetContactSettingDword((HANDLE)wParam, PLUG, "WindowHandle", 0) == 0 ? 0 : CMIF_HIDDEN); - //CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuGraph, (LPARAM)&menu); - - return 0; -} -*/ - -void InitMenus() { - - CLISTMENUITEM menu; - ZeroMemory(&menu,sizeof(menu)); - menu.cbSize=sizeof(menu); - +void InitMenus() +{ // main menu - menu.flags = CMIF_TCHAR; - menu.popupPosition = 500099900; - menu.ptszPopupName = LPGENT("PING"); - menu.cbSize = sizeof( menu ); - menu.position = 2000060000; - menu.hIcon = hIconResponding; - menu.ptszName = LPGENT("Enable All Pings"); - menu.pszService = PLUG "/EnableAll"; - Menu_AddMainMenuItem(&menu); - - menu.popupPosition = 500299901; - menu.cbSize = sizeof( menu ); - menu.position = 2000060001; - menu.popupPosition = 0; - menu.hIcon = hIconDisabled; - menu.ptszName = LPGENT("Disable All Pings"); - menu.pszService = PLUG "/DisableAll"; - Menu_AddMainMenuItem(&menu); - - /* - // list items - menu.flags = 0; - menu.popupPosition = 0; - menu.pszPopupName = 0; - menu.cbSize = sizeof( menu ); - menu.position =-300100; - //menu.popupPosition = 0; - menu.hIcon = hIconDisabled; - menu.pszName = Translate( "Disable" ); - menu.pszService = PLUG "/ToggleEnabled"; - menu.pszContactOwner = PLUG; - hMenuDisable = (HANDLE)CallService( MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&menu ); - - menu.flags = 0; - menu.popupPosition = 0; - menu.pszPopupName = 0; - menu.cbSize = sizeof( menu ); - menu.position =-300090; - //menu.popupPosition = 0; - menu.hIcon = hIconResponding - menu.pszName = Translate( "Graph" ); - menu.pszService = PLUG "/ShowGraph"; - menu.pszContactOwner = PLUG; - hMenuGraph = (HANDLE)CallService( MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&menu ); - - menu.flags = 0; - menu.popupPosition = 0; - menu.pszPopupName = 0; - menu.cbSize = sizeof( menu ); - menu.position =-300080; - //menu.popupPosition = 0; - menu.hIcon = hIconResponding; - menu.pszName = Translate( "Edit..." ); - menu.pszService = PLUG "/Edit"; - menu.pszContactOwner = PLUG; - hMenuGraph = (HANDLE)CallService( MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&menu ); - - hEventMenuBuild = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MenuBuild); - */ + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIF_TCHAR; + mi.popupPosition = 500099900; + mi.ptszPopupName = LPGENT("PING"); + mi.position = 2000060000; + mi.hIcon = hIconResponding; + mi.ptszName = LPGENT("Enable All Pings"); + mi.pszService = PLUG "/EnableAll"; + Menu_AddMainMenuItem(&mi); + + mi.popupPosition = 500299901; + mi.position = 2000060001; + mi.popupPosition = 0; + mi.hIcon = hIconDisabled; + mi.ptszName = LPGENT("Disable All Pings"); + mi.pszService = PLUG "/DisableAll"; + Menu_AddMainMenuItem(&mi); } diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 5db0f4322e..a5b2034e3f 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -1015,12 +1015,10 @@ void InitList() { CreateServiceFunction(PLUG "/ShowWindow", PingPlugShowWindow); - CLISTMENUITEM mi = {0}; - + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.popupPosition = 1000200001; mi.ptszPopupName = LPGENT( "Ping" ); - mi.cbSize = sizeof( mi ); mi.position = 3000320001; mi.hIcon = 0;//LoadIcon( hInst, 0); mi.ptszName = LPGENT( "Show/Hide &Ping Window" ); diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 1a63de62d8..5fc6572a5d 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -103,8 +103,7 @@ extern "C" __declspec(dllexport) int Load(void) // Add cheking update menu item hCheckUpdates = CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -0x7FFFFFFF; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = Skin_GetIconHandle("check_update"); diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 67c805844c..764a7acc20 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -179,9 +179,7 @@ static int IconsChanged(WPARAM wParam,LPARAM lParam) { LoadActions(); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); - + CLISTMENUITEM mi = { sizeof(mi) }; if (PopUpOptions.ModuleIsEnabled == TRUE) { //The module is enabled. //The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON,0); @@ -225,9 +223,8 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp) { int iResult = 0; int iResultRoot = 0; - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; if (PopUpOptions.ModuleIsEnabled) { //The module is enabled. //The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. @@ -261,11 +258,9 @@ INT_PTR svcShowHistory(WPARAM, LPARAM) return 0; } -void InitMenuItems(void) { - CLISTMENUITEM mi={0}; - - // Common - mi.cbSize = sizeof(mi); +void InitMenuItems(void) +{ + CLISTMENUITEM mi = { sizeof(mi) }; // support new genmenu style mi.flags = CMIF_ROOTHANDLE|CMIF_TCHAR; mi.hParentMenu = HGENMENU_ROOT; diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp index 5009d4b898..eff0eaad77 100644 --- a/plugins/ProfileManager/src/pmanagerEx.cpp +++ b/plugins/ProfileManager/src/pmanagerEx.cpp @@ -100,13 +100,12 @@ static INT_PTR RestartMe(WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int Load(void) { - CLISTMENUITEM mi; - mir_getLP(&pluginInfo); hLoadPM = CreateServiceFunction("Database/LoadPM", LoadPM); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + + // !!!!!!!! check it later + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -500200000; mi.flags = CMIF_TCHAR; mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LoadPM)); diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 3860e7a494..f5aa9e59c0 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -208,9 +208,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) hIml = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0); // Add menu item - CLISTMENUITEM mi; - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 500100001; mi.flags = CMIF_TCHAR; mi.ptszName = LPGENT("Quick Contacts..."); diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 6aa7d90dcf..d931ca9813 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -73,11 +73,7 @@ namespace void InitMenu() { -// USES_CONVERSION; - - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(CLISTMENUITEM); - //mi.ptszPopupName = _T("Quotes"); + CLISTMENUITEM mi = { sizeof(mi) }; mi.ptszName = _T("Quotes"); mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_ROOTPOPUP; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index 61b6fb5f11..b828ee7931 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -304,13 +304,10 @@ namespace { void enable_menu(HANDLE hMenu,bool bEnable) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof( CLISTMENUITEM ); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if(false == bEnable) - { - clmi.flags |= /*CMIF_HIDDEN*/CMIF_GRAYED; - } + clmi.flags |= CMIF_GRAYED; CallService(MS_CLIST_MODIFYMENUITEM,reinterpret_cast(hMenu),reinterpret_cast(&clmi)); } diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 2e1b0b409e..86f737298a 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -461,8 +461,8 @@ int Create_TopToolbarShowList(WPARAM wParam, LPARAM lParam) int Create_MenuitemShowList(void) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + // !!!!!!!! check it later + CLISTMENUITEM mi = { sizeof(mi) }; mi.hIcon = Skin_GetIcon("recent_main"); mi.pszName = msLastUC_ShowListName; mi.pszService = msLastUC_ShowList; @@ -522,8 +522,7 @@ static void iconsInit(void) static int OnPrebuildContactMenu (WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof( clmi ); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME | CMIF_TCHAR; if ( DBGetContactSettingByte((HANDLE)wParam, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0) diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index 836277f933..8e89ab671d 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -198,8 +198,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if ( hContact ) { char* szProto = GetContactProto(hContact); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; if ( szProto ) { diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 4ff0eef47d..3f0e54753e 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -76,7 +76,7 @@ int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam) OptionsInit(); LoadIcons(); { - CLISTMENUITEM mi = { 0 }; + CLISTMENUITEM mi = { sizeof(mi) }; mi.cbSize = sizeof(mi); mi.position = -2000090001; mi.flags = CMIF_DEFAULT | CMIF_ICONFROMICOLIB; diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 1a9450776e..7aed7129aa 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -381,8 +381,7 @@ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { if ( hContact ) { char* szProto = GetContactProto(hContact); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; if ( szProto ) { @@ -480,15 +479,14 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam) { static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM mi; ReloadGlobals(); RegisterIcons(); RegisterFontServiceFonts(); RegisterKeyBindings(); LoadGlobalIcons(); LoadMsgLogIcons(); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090000; mi.flags = CMIF_ICONFROMICOLIB | CMIF_DEFAULT; mi.icolibItem = LoadSkinnedIconHandle( SKINICON_EVENT_MESSAGE ); 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; diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 3398f5580b..58d92dd8aa 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -292,13 +292,11 @@ INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam) { //--------------------------------------------------------------------------- // Add SendSS menu item in contact menu -void AddMenuItems(void) { - CLISTMENUITEM mi={0}; - +void AddMenuItems(void) +{ // Common - mi.cbSize = sizeof(mi); - // support new genmenu style - mi.flags = CMIF_ROOTHANDLE|CMIF_UNICODE; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIF_ROOTHANDLE | CMIF_UNICODE; mi.hParentMenu = HGENMENU_ROOT; // Add item to contact menu diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 630f9bb1f0..ac82ba2010 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -976,9 +976,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hibSessionsSave = AddIcon(hiSessionsSave, "SessionsSave", LPGENT("Save Session")); hibSessionsLoadLast = AddIcon(hiSessionsLoadLast, "SessionsLoadLast", LPGENT("Load last Session")); - CLISTMENUITEM cl; - ZeroMemory(&cl, sizeof(cl)); - cl.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM cl = { sizeof(cl) }; cl.position = 1000000000; cl.flags = CMIM_ALL | CMIF_TCHAR; diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index e00a1f6a64..fc9059c197 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -20,7 +20,6 @@ HINSTANCE hinstance; HANDLE hPreBuildHook = NULL, hAddEventHook = NULL, hOptHook = NULL, hCheckDefHook = NULL, hOnPreShutdown = NULL, hToggleEnable = NULL, hToggleAutoanswer = NULL; HANDLE hToggle = NULL, hEnableMenu = NULL; -CLISTMENUITEM mi; BOOL fEnabled, gbVarsServiceExist = FALSE; INT interval; int hLangpack; @@ -61,16 +60,14 @@ BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved) INT_PTR ToggleEnable(WPARAM wParam, LPARAM lParam) { - mi.cbSize=sizeof(mi); - mi.flags=CMIM_NAME|CMIM_ICON|CMIF_TCHAR; - fEnabled=!fEnabled; - if (fEnabled) - { + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_NAME|CMIM_ICON|CMIF_TCHAR; + fEnabled = !fEnabled; + if (fEnabled) { mi.ptszName = _T("Disable Auto&reply"); mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ON)); } - else - { + else { mi.ptszName = _T("Enable Auto&reply"); mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_OFF)); } @@ -85,7 +82,8 @@ INT_PTR Toggle(WPARAM w, LPARAM l) on = !DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0); DBWriteContactSettingByte(hContact, protocolname, "TurnedOn", on?1:0); on = on?0:1; - mi.cbSize=sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME |CMIM_ICON | CMIF_TCHAR; mi.ptszName=on?_T("Turn off Autoanswer"):_T("Turn on Autoanswer"); mi.hIcon = on?LoadIcon(hinstance, MAKEINTRESOURCE(IDI_OFF)):LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ON)); @@ -96,7 +94,8 @@ INT_PTR Toggle(WPARAM w, LPARAM l) INT OnPreBuildContactMenu(WPARAM w, LPARAM l) { HANDLE hContact = (HANDLE)w; - mi.cbSize=sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; BOOL on = !DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0); mi.ptszName = on?_T("Turn off Autoanswer"):_T("Turn on Autoanswer"); @@ -314,23 +313,20 @@ INT OnPreShutdown(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport)Load(void) { - mir_getLP(&pluginInfoEx); hToggleEnable = CreateServiceFunction(protocolname"/ToggleEnable", ToggleEnable); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + hToggleAutoanswer = CreateServiceFunction(protocolname"/ToggleAutoanswer",Toggle); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 500090000; mi.ptszName = _T(""); mi.pszService = protocolname"/ToggleEnable"; hEnableMenu = Menu_AddMainMenuItem(&mi); - hToggleAutoanswer = CreateServiceFunction(protocolname"/ToggleAutoanswer",Toggle); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=-0x7FFFFFFF; - mi.ptszName=_T(""); - mi.pszService=protocolname"/ToggleAutoanswer"; + mi.position = -0x7FFFFFFF; + mi.ptszName = _T(""); + mi.pszService = protocolname"/ToggleAutoanswer"; hToggle = Menu_AddContactMenuItem(&mi); //add hook diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 6c31c8ec4e..0f50b6d15a 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -372,13 +372,13 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM clmi = {0}; TCHAR str[128]; char *szProto = GetContactProto((HANDLE)wParam); int iHidden = szProto ? DBGetContactSettingByte((HANDLE)wParam, szProto, "ChatRoom", 0) : 0; char *szMsg; int iStatus; + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.cbSize = sizeof(clmi); clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR; @@ -456,11 +456,10 @@ int AwayMsgPreShutdown(void) int LoadAwayMsgModule(void) { - CLISTMENUITEM mi = {0}; - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); hWindowList2 = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; CreateServiceFunctionEx(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index d572945340..bbac07d69a 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1647,8 +1647,7 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) if (!iStatusMsgFlags || !iStatusMenuItemCount) return 0; - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR; if (!DBGetContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", 1)) mi.flags |= CMIF_HIDDEN; diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 4165553cad..cbf4531f0c 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -84,8 +84,7 @@ static int ModulesLoaded(WPARAM, LPARAM) INT_PTR temp = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; mi.popupPosition = 2000070050; mi.position = 2000070050; diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 58bb73781e..58e6c90c97 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -402,20 +402,16 @@ INT_PTR CustomCatMenu(WPARAM wParam, LPARAM lParam) int RebuildContactMenu(WPARAM wParam, LPARAM) { - int i; - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; SmileyCategoryListType::SmileyCategoryVectorType& smc = *g_SmileyCategories.GetSmileyCategoryList(); char* protnam = GetContactProto((HANDLE)wParam); bool haveMenu = IsSmileyProto(protnam); - if (haveMenu && opt.UseOneForAll) - { + if (haveMenu && opt.UseOneForAll) { unsigned cnt = 0; - for (i = 0; i < smc.getCount(); ++i) + for (int i=0; i < smc.getCount(); ++i) cnt += smc[i].IsCustom(); haveMenu = cnt != 0; } @@ -424,12 +420,11 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenuItem, (LPARAM)&mi); - for (i = 0; i < menuHandleArray.getCount(); ++i) + for (int i = 0; i < menuHandleArray.getCount(); ++i) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)menuHandleArray[i], 0); menuHandleArray.destroy(); - if (haveMenu) - { + if (haveMenu) { bkstring cat; opt.ReadContactCategory((HANDLE)wParam, cat); @@ -440,9 +435,9 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) bool nonecheck = true; HGENMENU hMenu; - for (i = 0; i < smc.getCount(); i++) - { - if (smc[i].IsExt() || (smc[i].IsProto() && opt.UseOneForAll)) continue; + for (int i=0; i < smc.getCount(); i++) { + if (smc[i].IsExt() || (smc[i].IsProto() && opt.UseOneForAll)) + continue; const int ind = i + 3; @@ -450,8 +445,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) mi.popupPosition = ind; mi.ptszName = (TCHAR*)smc[i].GetDisplayName().c_str(); - if (cat == smc[i].GetName()) - { + if (cat == smc[i].GetName()) { mi.flags |= CMIF_CHECKED; nonecheck = false; } diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 8289ce229d..0b3f842812 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -338,9 +338,8 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) #ifdef _DEBUG hTestService = CreateServiceFunction("Splash/Test", TestService); - CLISTMENUITEM mi; - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); mi.hotKey = 0; diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 3fb09ef6eb..aa417e7672 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -89,12 +89,10 @@ static INT_PTR profileService5(WPARAM wParam, LPARAM lParam) static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM mi; char profilename[128], servicename[128]; int i, count; - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.popupPosition = 2000100000; mcount = 0; count = GetProfileCount(0, 0); diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 1ce5b12c79..9a7e7abb24 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -166,11 +166,11 @@ int hLangpack = 0; extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfoEx); - CLISTMENUITEM mi; + CreateServiceFunction("/RemoveTmp", (MIRANDASERVICE)RemoveTmp); HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize=sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.position=-0x7FFFFFFF; mi.flags=0; mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); diff --git a/plugins/StopSpamPlus/src/stopspam.cpp b/plugins/StopSpamPlus/src/stopspam.cpp index 42639424fd..57dfa560ef 100644 --- a/plugins/StopSpamPlus/src/stopspam.cpp +++ b/plugins/StopSpamPlus/src/stopspam.cpp @@ -43,8 +43,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) extern "C" int __declspec(dllexport) Load(void) { - CLISTMENUITEM mi; - mir_getLP(&pluginInfoEx); plSets=new Settings; @@ -55,8 +53,8 @@ extern "C" int __declspec(dllexport) Load(void) // Add deliting temporary contacts hTempRemove = CreateServiceFunction(MS_STOPSPAM_REMTEMPCONTACTS, RemoveTempContacts); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp index 628a7372ab..d3714fc820 100644 --- a/plugins/TabSRMM/src/chat/clist.cpp +++ b/plugins/TabSRMM/src/chat/clist.cpp @@ -224,8 +224,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if ( hContact ) { char* szProto = GetContactProto(hContact); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; if ( szProto ) { diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 5690e08154..427dc7de89 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -70,8 +70,7 @@ int Chat_ModulesLoaded(WPARAM wParam, LPARAM lParam) LoadIcons(); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090001; mi.flags = CMIF_DEFAULT | CMIF_ICONFROMICOLIB; mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN ); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 32705d2388..16e335c2c8 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -156,10 +156,9 @@ void CGlobals::reloadSystemStartup() */ void CGlobals::reloadSystemModulesChanged() { - BOOL bIEView = FALSE; - CLISTMENUITEM mi = { 0 }; + BOOL bIEView = FALSE; - m_MathModAvail = ServiceExists(MATH_RTF_REPLACE_FORMULAE); + m_MathModAvail = ServiceExists(MATH_RTF_REPLACE_FORMULAE); /* * smiley add @@ -203,12 +202,10 @@ void CGlobals::reloadSystemModulesChanged() CallService(MTH_FREE_MATH_BUFFER, 0, (LPARAM)szDelim); } } - else - PluginConfig.m_MathModStartDelimiter[0] = 0; + else PluginConfig.m_MathModStartDelimiter[0] = 0; g_MetaContactsAvail = (ServiceExists(MS_MC_GETDEFAULTCONTACT) ? 1 : 0); - if (g_MetaContactsAvail) { mir_snprintf(szMetaName, 256, "%s", (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); bMetaEnabled = abs(M->GetByte(0, szMetaName, "Enabled", -1)); @@ -221,7 +218,7 @@ void CGlobals::reloadSystemModulesChanged() g_PopupAvail = (ServiceExists(MS_POPUP_ADDPOPUPEX) ? 1 : 0); g_PopupWAvail = (ServiceExists(MS_POPUP_ADDPOPUPW) ? 1 : 0); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090000; mi.flags = CMIF_ICONFROMICOLIB | CMIF_DEFAULT; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_MESSAGE); @@ -364,11 +361,6 @@ void CGlobals::hookSystemEvents() int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) { - int i; - MENUITEMINFOA mii = {0}; - HMENU submenu; - CLISTMENUITEM mi = { 0 }; - ::UnhookEvent(m_event_ModulesLoaded); M->configureCustomFolders(); @@ -376,17 +368,18 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) Skin->Init(true); CSkin::initAeroEffect(); - for (i=0; i < NR_BUTTONBARICONS; i++) + for (int i=0; i < NR_BUTTONBARICONS; i++) PluginConfig.g_buttonBarIcons[i] = 0; ::LoadIconTheme(); ::CreateImageList(TRUE); + MENUITEMINFOA mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_BITMAP; mii.hbmpItem = HBMMENU_CALLBACK; - submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); - for (i=0; i <= 8; i++) - SetMenuItemInfoA(submenu, (UINT_PTR)i, TRUE, &mii); + HMENU submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); + for (int k=0; k <= 8; k++) + SetMenuItemInfoA(submenu, (UINT_PTR)k, TRUE, &mii); PluginConfig.reloadSystemModulesChanged(); @@ -395,7 +388,6 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) ::CB_InitDefaultButtons(); ::ModPlus_Init(wParam, lParam); ::NotifyEventHooks(hHookToolBarLoadedEvt, 0, 0); - // if (M->GetByte("avatarmode", -1) == -1) M->WriteByte(SRMSGMOD_T, "avatarmode", 2); @@ -407,7 +399,7 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) if (nen_options.bTraySupport) ::CreateSystrayIcon(TRUE); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -500050005; mi.hIcon = PluginConfig.g_iconContainer; mi.pszContactOwner = NULL; @@ -416,7 +408,6 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) PluginConfig.m_UserMenuItem = Menu_AddContactMenuItem(&mi); if (sendLater->isAvail()) { - mi.cbSize = sizeof(mi); mi.position = -500050006; mi.hIcon = 0; mi.pszContactOwner = NULL; diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 9381dc7356..f491210554 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -666,12 +666,10 @@ int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; if ( hContact ) { - char* szProto = GetContactProto(hContact); - - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; + char *szProto = GetContactProto(hContact); if ( szProto ) { // leave this menu item hidden for chats if ( !M->GetByte(hContact, szProto, "ChatRoom", 0 )) @@ -679,7 +677,7 @@ int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) clmi.flags &= ~CMIF_HIDDEN; } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )PluginConfig.m_hMenuItem, ( LPARAM )&clmi ); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)PluginConfig.m_hMenuItem, (LPARAM)&clmi); } return 0; } diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 52633e3304..5214fadf5d 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -7,10 +7,7 @@ static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam) Disabled = !(Disabled); if (PopupService) { - - CLISTMENUITEM mi = { 0 }; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON | CMIM_NAME; if (!Disabled) { @@ -21,7 +18,7 @@ static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam) mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED)); } - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hDisableMenu,(LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hDisableMenu, (LPARAM)&mi); } return 0; @@ -541,10 +538,9 @@ int TN_ModuleInit() mir_sntprintf(szStop, sizeof(szStop), TranslateT("...has stopped typing.")); if (PopupService && ShowMenu) { - CLISTMENUITEM mi = { 0 }; hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = 0; if (!Disabled) { diff --git a/plugins/TrafficCounter/src/TrafficCounter.c b/plugins/TrafficCounter/src/TrafficCounter.c index c427ee7443..b7fe86b3d6 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.c +++ b/plugins/TrafficCounter/src/TrafficCounter.c @@ -1506,10 +1506,7 @@ int MenuCommand_TrafficShowHide(WPARAM wParam,LPARAM lParam) void Traffic_AddMainMenuItem(void) { - CLISTMENUITEM mi; - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -0x7FFFFFFF; mi.flags = 0; mi.hIcon = NULL; diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp index 1533af56be..c11494cf38 100644 --- a/plugins/UserGuide/src/main.cpp +++ b/plugins/UserGuide/src/main.cpp @@ -79,11 +79,9 @@ static INT_PTR ShowGuideFile(WPARAM wParam,LPARAM lParam) int ModulesLoaded(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; - hShowGuide = CreateServiceFunction("UserGuide/ShowGuide", ShowGuideFile); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 500000; mi.flags = CMIF_TCHAR; mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_HELP); diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 9f140fb4b7..e7fdbeaaf5 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -80,7 +80,6 @@ VOID RebuildContact() { int flag = 0; BYTE item = 0; - CLISTMENUITEM mi; HGENMENU mhRoot = HGENMENU_ROOT; HGENMENU mhExIm = HGENMENU_ROOT; @@ -98,10 +97,9 @@ VOID RebuildContact() // delete all MenuItems and set all bytes 0 to avoid problems RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem)); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); // support new genmenu style + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTHANDLE; mi.hParentMenu = HGENMENU_ROOT; @@ -182,7 +180,6 @@ VOID RebuildMain() { int flag = 0; BYTE item = 0; - CLISTMENUITEM mi; HGENMENU mhRoot = HGENMENU_ROOT; HGENMENU mhExIm = HGENMENU_ROOT; @@ -197,10 +194,9 @@ VOID RebuildMain() // delete all MenuItems and set all bytes 0 to avoid problems RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem)); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); // support new genmenu style + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTHANDLE; mi.hParentMenu = HGENMENU_ROOT; @@ -321,7 +317,6 @@ VOID RebuildGroup() { int flag = 0; BYTE item = 0; - CLISTMENUITEM mi; GroupMenuParam gmp = {0}; HGENMENU mhRoot = HGENMENU_ROOT; @@ -337,12 +332,12 @@ VOID RebuildGroup() // delete all MenuItems and set all bytes 0 to avoid problems RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem)); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); // create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it char text[ 200 ]; strcpy( text, "UserInfo"); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; char* tDest = text + strlen( text ); @@ -419,7 +414,6 @@ VOID RebuildSubGroup() { int flag = 0; BYTE item = 0; - CLISTMENUITEM mi; GroupMenuParam gmp = {0}; HGENMENU mhRoot = HGENMENU_ROOT; @@ -435,12 +429,12 @@ VOID RebuildSubGroup() // delete all MenuItems and set all bytes 0 to avoid problems RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem)); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); // create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it char text[ 200 ]; strcpy( text, "UserInfo"); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; char* tDest = text + strlen( text ); @@ -529,7 +523,6 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) BYTE i = 0, item = 0; TCHAR sztName[MAXSETTING]; PROTOACCOUNT* pAccountName = NULL; - CLISTMENUITEM mi; mProtoCount = pcli->menuProtoCount; @@ -556,15 +549,12 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) DB::Setting::WriteByte(SET_MI_ACCOUNT, flag); } - // loop for all account names for (i = 0; i < mProtoCount; i++) { // set all bytes 0 to avoid problems item = 0; mhRoot = 0; - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); mhRoot = pcli->menuProtos[i].pMenu; if ( mhRoot == NULL ) @@ -574,6 +564,8 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) // create service name main (account module name) and set pointer to end it char text[ 200 ]; strcpy( text, pcli->menuProtos[i].szProto); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; char* tDest = text + strlen( text ); diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 563d0dabf4..ea4741414d 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -180,22 +180,15 @@ static INT OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw **/ static INT OnPreBuildMenu(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM mi; - LPSTR val; - - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; - val = Get((HANDLE)wParam); + LPSTR val = Get((HANDLE)wParam); if (val) - { mir_free(val); - } else - { mi.flags = CMIM_FLAGS | CMIF_HIDDEN; - } + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ghMenuItem, (LPARAM)&mi); return 0; } @@ -220,11 +213,8 @@ VOID SvcEMailRebuildMenu() if (!ghMenuItem) { - CLISTMENUITEM mi; - // insert contact menuitem - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000010000; mi.hIcon = IcoLib_GetIcon(ICO_BTN_EMAIL); mi.pszName = "&E-mail"; diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 7364653d56..456ef87711 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -142,11 +142,9 @@ static INT OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw **/ static INT OnPreBuildMenu(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM mi; LPSTR val; - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; val = Get((HANDLE)wParam); @@ -154,10 +152,8 @@ static INT OnPreBuildMenu(WPARAM wParam, LPARAM lParam) { MIR_FREE(val); } - else - { - mi.flags = CMIM_FLAGS | CMIF_HIDDEN; - } + else mi.flags = CMIM_FLAGS | CMIF_HIDDEN; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ghMenuItem, (LPARAM)&mi); return 0; } @@ -181,9 +177,7 @@ VOID SvcHomepageRebuildMenu() if (!ghMenuItem) { // insert contact menuitem - CLISTMENUITEM mi = { 0 }; - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000010000; mi.hIcon = IcoLib_GetIcon(ICO_BTN_GOTO); mi.pszName = "&Homepage"; diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 1a14ec0bea..2945b118c4 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -623,9 +623,7 @@ class CContactUpdater : public CContactQueue // reset menu if (hMenuItemRefresh) { - CLISTMENUITEM clmi; - - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME|CMIM_ICON; clmi.pszName = LPGEN("Refresh Contact Details"); clmi.hIcon = IcoLib_GetIcon(ICO_BTN_UPDATE); @@ -751,9 +749,7 @@ public: // if there are contacts in the queue, change the main menu item to indicate it is meant for canceling. if (hMenuItemRefresh && Size() > 0) { - CLISTMENUITEM clmi; - - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME|CMIM_ICON; clmi.pszName = LPGEN("Abort Refreshing Contact Details"); clmi.hIcon = IcoLib_GetIcon(ICO_BTN_CANCEL); diff --git a/plugins/VersionInfo/src/main.cpp b/plugins/VersionInfo/src/main.cpp index 91e29e650e..4427ca5827 100644 --- a/plugins/VersionInfo/src/main.cpp +++ b/plugins/VersionInfo/src/main.cpp @@ -91,8 +91,7 @@ extern "C" int __declspec(dllexport) Load(void) _tcslwr(filePath); //Menu item - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = mi.popupPosition = 2000089999; mi.flags = 0; mi.hIcon = hiVIIcon; diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 8a7798b3b1..f5f305109f 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -310,9 +310,7 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam,LPARAM lParam) int BuildContactMenu(WPARAM wparam,LPARAM lparam) { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | (db_get_dw((HANDLE)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMwinMenu, (LPARAM)&mi); diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index f9ea5641a8..643ad10512 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -60,6 +60,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) SkinAddNewSoundEx(BIRTHDAY_TODAY_SOUND, LPGEN("WhenWasIt"), LPGEN("Birthday today")); UpdateTimers(); + CLISTMENUITEM cl = { sizeof(cl) }; cl.position = 10000000; cl.flags = CMIF_ICONFROMICOLIB; diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.c b/plugins/WhoUsesMyFiles/src/wumfplug.c index d7ba2a65bd..c9f07b99ad 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.c +++ b/plugins/WhoUsesMyFiles/src/wumfplug.c @@ -271,17 +271,14 @@ static INT_PTR WumfMenuCommand(WPARAM wParam,LPARAM lParam) { BOOL MajorTo0121 = FALSE; int iResult = 0; - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); - if (WumfOptions.PopupsEnabled == TRUE) - { + CLISTMENUITEM mi = { sizeof(mi) }; + if (WumfOptions.PopupsEnabled == TRUE) { WumfOptions.PopupsEnabled = FALSE; mi.pszName = Translate("Enable WUMF popups"); mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP)); } - else - { + else { WumfOptions.PopupsEnabled = TRUE; mi.pszName = Translate("Disable WUMF popups"); mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP)); @@ -579,37 +576,34 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) __declspec(dllexport) int Load(void) { - CLISTMENUITEM mi = { 0 }; - mir_getLP(&pluginInfo); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); LoadOptions(); CreateServiceFunction(MS_WUMF_SWITCHPOPUP, WumfMenuCommand); CreateServiceFunction(MS_WUMF_CONNECTIONSSHOW, WumfShowConnections); - if (WumfOptions.PopupsEnabled == FALSE) - { - mi.pszName = Translate("Enable WUMF popups"); - mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP)); - } - else { - mi.pszName = Translate("Disable WUMF popups"); - mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP)); + CLISTMENUITEM mi = { sizeof(mi) }; + if (WumfOptions.PopupsEnabled == FALSE) { + mi.pszName = Translate("Enable WUMF popups"); + mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP)); + } + else { + mi.pszName = Translate("Disable WUMF popups"); + mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP)); + } + mi.pszService = MS_WUMF_SWITCHPOPUP; + mi.popupPosition = 1999990000; + mi.pszPopupName = Translate("PopUps"); + hMenuItem = (HANDLE)Menu_AddMainMenuItem(&mi); + + mi.pszName = Translate("WUMF: Show connections"); + mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_DRIVE)); + mi.pszService = MS_WUMF_CONNECTIONSSHOW; + mi.popupPosition = 1999990000; + mi.pszPopupName = NULL; + Menu_AddMainMenuItem(&mi); } - mi.pszService = MS_WUMF_SWITCHPOPUP; - mi.popupPosition = 1999990000; - mi.pszPopupName = Translate("PopUps"); - hMenuItem = (HANDLE)Menu_AddMainMenuItem(&mi); - - mi.pszName = Translate("WUMF: Show connections"); - mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_DRIVE)); - mi.pszService = MS_WUMF_CONNECTIONSSHOW; - mi.popupPosition = 1999990000; - mi.pszPopupName = NULL; - Menu_AddMainMenuItem(&mi); HookEvent(ME_OPT_INITIALISE,OptionsInit); HookEvent(ME_TTB_MODULELOADED, InitTopToolbar); diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 018d9f9565..866fdfbd2c 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -197,8 +197,7 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr) void CheckMenuItems() { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof( CLISTMENUITEM ); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if ( !DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1)) clmi.flags |= CMIF_HIDDEN; @@ -209,8 +208,7 @@ void CheckMenuItems() int SystemModulesLoaded(WPARAM, LPARAM) { //Insert "Check mail (YAMN)" item to Miranda's menu - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 0xb0000000; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = g_GetIconHandle(0); diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index 6abbd4bc47..f8d2b3a1e9 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -239,9 +239,9 @@ INT_PTR IsSecondLineShown(WPARAM wParam, LPARAM lParam) { return TRUE; } -void UpdateMenu() { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(CLISTMENUITEM); +void UpdateMenu() +{ + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszName = (char*)(db_get_b(0, MODULE, "Enabled", 1) == 1 ? LPGEN("Disable Popups") : LPGEN("Enable Popups")); mi.flags = CMIM_NAME;// | CMIM_ICON; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuToggleOnOff, (LPARAM)&mi); diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index 70bda90b6f..02866e38f0 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -16,7 +16,6 @@ http://miranda-ng.org/ HINSTANCE hInst; static HANDLE hEventSoundSettingChange, hEventStatusModeChange, hEventOptionsInitialize, hAckEvent, hSoundMenu; -CLISTMENUITEM mi; HGENMENU noSoundMenu; int hLangpack; @@ -38,7 +37,7 @@ static const struct CheckBoxValues_t statusValues[]={ }; PLUGININFOEX pluginInfoEx = { - sizeof(PLUGININFOEX), + sizeof(PLUGININFOEX), PLUGINNAME, PLUGIN_MAKE_VERSION(VER_MAJOR, VER_MINOR, VER_RELEASE, VER_BUILD), DESCRIPTION, @@ -81,24 +80,29 @@ static void FillCheckBoxTree(HWND hwndTree,const struct CheckBoxValues_t *values static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) { DWORD flags=0; - TVITEM tvi; + TVITEM tvi; tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_STATE; tvi.hItem=TreeView_GetRoot(hwndTree); while(tvi.hItem) { TreeView_GetItem(hwndTree,&tvi); - if (((tvi.state&TVIS_STATEIMAGEMASK)>>12==2)) flags|=tvi.lParam; - tvi.hItem=TreeView_GetNextSibling(hwndTree,tvi.hItem); + if (((tvi.state & TVIS_STATEIMAGEMASK)>>12 == 2)) + flags |= tvi.lParam; + tvi.hItem = TreeView_GetNextSibling(hwndTree,tvi.hItem); } return flags; } //Update the name on the menu -static void UpdateMenuItem() { +static void UpdateMenuItem() +{ + CLISTMENUITEM mi = { sizeof(mi) }; if (DBGetContactSettingByte(NULL, "Skin", "UseSound", 1)) mi.ptszName = TranslateT(DISABLE_SOUND); else mi.ptszName = TranslateT(ENABLE_SOUND); + mi.flags |= CMIM_NAME | CMIF_TCHAR; + CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)noSoundMenu,(LPARAM)&mi); } //Called when the sound setting in the database is changed @@ -108,23 +112,16 @@ static int SoundSettingChanged(WPARAM wParam,LPARAM lParam) if(lstrcmpA(cws->szModule, "Skin") || lstrcmpA(cws->szSetting, "UseSound")) return 0; UpdateMenuItem(); - - mi.flags |= CMIM_NAME; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)noSoundMenu,(LPARAM)&mi); - return 0; } -static int SetNotify(const long status){ +static int SetNotify(const long status) +{ DBWriteContactSettingByte(NULL,"Skin","UseSound", (BYTE) !(DBGetContactSettingDword(NULL,PLUGINNAME_SHORT,"NoSound",DEFAULT_NOSOUND) & status)); DBWriteContactSettingByte(NULL,"CList","DisableTrayFlash", (BYTE) (DBGetContactSettingDword(NULL,PLUGINNAME_SHORT,"NoBlink",DEFAULT_NOBLINK) & status)); DBWriteContactSettingByte(NULL,"CList","NoIconBlink", (BYTE) (DBGetContactSettingDword(NULL,PLUGINNAME_SHORT,"NoCLCBlink",DEFAULT_NOCLCBLINK) & status)); UpdateMenuItem(); - - mi.flags |= CMIM_NAME; - CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)noSoundMenu,(LPARAM)&mi); - return 0; } @@ -239,15 +236,13 @@ static INT_PTR NoSoundMenuCommand(WPARAM wParam,LPARAM lParam) extern "C" __declspec(dllexport) int Load(void) { - mir_getLP(&pluginInfoEx); //The menu item - begin - if (!DBGetContactSettingByte(NULL, PLUGINNAME_SHORT, "HideMenu", 1)) - { + if (!DBGetContactSettingByte(NULL, PLUGINNAME_SHORT, "HideMenu", 1)) { hSoundMenu = CreateServiceFunction(PLUGINNAME_SHORT "/MenuCommand", NoSoundMenuCommand); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; UpdateMenuItem(); diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 4b770d1fdf..45ca9a9694 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -869,45 +869,39 @@ int __cdecl CAimProto::UserIsTyping(HANDLE hContact, int type) int __cdecl CAimProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) { - switch (eventType) - { - case EV_PROTO_ONLOAD: - return OnModulesLoaded(0, 0); - -// case EV_PROTO_ONEXIT: -// return OnPreShutdown(0, 0); + switch (eventType) { + case EV_PROTO_ONLOAD: + return OnModulesLoaded(0, 0); - case EV_PROTO_ONMENU: - InitMainMenus(); - break; + case EV_PROTO_ONMENU: + InitMainMenus(); + break; - case EV_PROTO_ONOPTIONS: - return OnOptionsInit(wParam, lParam); + case EV_PROTO_ONOPTIONS: + return OnOptionsInit(wParam, lParam); - case EV_PROTO_ONERASE: + case EV_PROTO_ONERASE: { char szDbsettings[64]; mir_snprintf(szDbsettings, sizeof(szDbsettings), "%sP2P", m_szModuleName); CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings); - break; } + break; - case EV_PROTO_ONRENAME: - if (hMenuRoot) - { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; - clmi.ptszName = m_tszUserName; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuRoot, (LPARAM)&clmi); - } - break; + case EV_PROTO_ONRENAME: + if (hMenuRoot) { + CLISTMENUITEM clmi = { sizeof(clmi) }; + clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + clmi.ptszName = m_tszUserName; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuRoot, (LPARAM)&clmi); + } + break; - case EV_PROTO_ONCONTACTDELETED: - return OnContactDeleted(wParam, lParam); + case EV_PROTO_ONCONTACTDELETED: + return OnContactDeleted(wParam, lParam); - case EV_PROTO_DBSETTINGSCHANGED: - return OnDbSettingChanged(wParam, lParam); + case EV_PROTO_DBSETTINGSCHANGED: + return OnDbSettingChanged(wParam, lParam); } return 1; } diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index e31cc5d664..c496c2482e 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -259,11 +259,8 @@ int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/) HANDLE hContact = (HANDLE)wParam; bool isChatRoom = getByte(hContact, "ChatRoom", 0) != 0; - CLISTMENUITEM mi; - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); - //see if we should add the html away message context menu items + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; if (getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) != ID_STATUS_AWAY || isChatRoom) mi.flags |= CMIF_HIDDEN; @@ -315,8 +312,7 @@ void CAimProto::InitMainMenus(void) //Do not put any services below HTML get away message!!! char service_name[200]; - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); if (hRoot == NULL) { @@ -364,8 +360,7 @@ void CAimProto::InitContactMenus(void) //Do not put any services below HTML get away message!!! char service_name[200]; - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = service_name; mi.pszContactOwner = m_szModuleName; diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 5d7c002398..021e8a6fcc 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -200,8 +200,7 @@ void UninitContactMenus() void EnableMenuItem(HANDLE hMenuItem, bool enable) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if (!enable) clmi.flags |= CMIF_HIDDEN; @@ -236,13 +235,11 @@ int FacebookProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam) strcpy(text,m_szModuleName); char *tDest = text+strlen(text); - HGENMENU hRoot; CLISTMENUITEM mi = {sizeof(mi)}; mi.pszService = text; - hRoot = MO_GetProtoRootMenu(m_szModuleName); - if (hRoot == NULL) - { + HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + if (hRoot == NULL) { mi.popupPosition = 500085000; mi.hParentMenu = HGENMENU_ROOT; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | ( this->isOnline() ? 0 : CMIF_GRAYED ); @@ -311,8 +308,7 @@ int FacebookProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam) void FacebookProto::ToggleStatusMenuItems( BOOL bEnable ) { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof( CLISTMENUITEM ); + CLISTMENUITEM clmi = {sizeof(clmi)}; clmi.flags = CMIM_FLAGS | (( bEnable ) ? 0 : CMIF_GRAYED); CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRoot, ( LPARAM )&clmi ); diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp index 26c81a165f..bf81e0f5dd 100644 --- a/protocols/GTalkExt/src/menu.cpp +++ b/protocols/GTalkExt/src/menu.cpp @@ -41,8 +41,7 @@ INT_PTR OpenMailboxMenuHandler(WPARAM wParam, LPARAM lParam) int OnPrebuildMenu(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM cmi = {0}; - cmi.cbSize = sizeof(cmi); + CLISTMENUITEM cmi = { sizeof(cmi) }; cmi.flags = CMIM_FLAGS; if (!DBGetContactSettingByte((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) cmi.flags |= CMIF_HIDDEN; @@ -61,8 +60,7 @@ BOOL InitMenus(BOOL init) extern HICON g_hPopupIcon; - CLISTMENUITEM cmi = {0}; - cmi.cbSize = sizeof(cmi); + CLISTMENUITEM cmi = { sizeof(cmi) }; cmi.flags = CMIF_TCHAR; cmi.hIcon = g_hPopupIcon; cmi.ptszName = _T(OPEN_MAILBOX_ITEM_CAPTION); diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index a27b781590..2019872ee3 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -232,13 +232,11 @@ static GGPROTO* gg_getprotoinstance(HANDLE hContact) static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam) { const HANDLE hContact = (HANDLE)wParam; - CLISTMENUITEM mi = {0}; GGPROTO* gg = gg_getprotoinstance(hContact); - if (gg == NULL) return 0; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB; if ( db_get_dw(hContact, gg->m_szModuleName, GG_KEY_UIN, 0) == db_get_b(NULL, gg->m_szModuleName, GG_KEY_UIN, 0) || db_get_b(hContact, gg->m_szModuleName, "ChatRoom", 0) || @@ -246,7 +244,6 @@ static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam) mi.flags |= CMIF_HIDDEN; mi.pszName = db_get_b(hContact, gg->m_szModuleName, GG_KEY_BLOCK, 0) ? LPGEN("&Unblock") : LPGEN("&Block"); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gg->hBlockMenuItem, (LPARAM)&mi); - return 0; } @@ -267,14 +264,12 @@ INT_PTR GGPROTO::blockuser(WPARAM wParam, LPARAM lParam) #define GGS_BLOCKUSER "%s/BlockUser" void GGPROTO::block_init() { - CLISTMENUITEM mi = {0}; char service[64]; - - mi.cbSize = sizeof(mi); - mi.flags = CMIF_ICONFROMICOLIB; - mir_snprintf(service, sizeof(service), GGS_BLOCKUSER, m_szModuleName); createObjService(service, &GGPROTO::blockuser); + + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIF_ICONFROMICOLIB; mi.position = -500050000; mi.icolibItem = GetIconHandle(IDI_BLOCK); mi.pszName = LPGEN("&Block"); @@ -298,12 +293,10 @@ void GGPROTO::block_uninit() // Menus initialization void GGPROTO::menus_init() { - HGENMENU hGCRoot, hCLRoot, hRoot = MO_GetProtoRootMenu(m_szModuleName); - CLISTMENUITEM mi = {0}; + CLISTMENUITEM mi = { sizeof(mi) }; - mi.cbSize = sizeof(mi); - if (hRoot == NULL) - { + HGENMENU hGCRoot, hCLRoot, hRoot = MO_GetProtoRootMenu(m_szModuleName); + if (hRoot == NULL) { mi.ptszName = m_tszUserName; mi.position = 500090000; mi.hParentMenu = HGENMENU_ROOT; @@ -311,8 +304,7 @@ void GGPROTO::menus_init() mi.icolibItem = GetIconHandle(IDI_GG); hGCRoot = hCLRoot = hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi); } - else - { + else { mi.hParentMenu = hRoot; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE | CMIF_TCHAR; diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 541b4832a6..8911110ccf 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -841,8 +841,7 @@ int GGPROTO::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) case EV_PROTO_ONRENAME: if (hMenuRoot) { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.ptszName = m_tszUserName; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuRoot, (LPARAM)&mi); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 118a674439..c9e56fc777 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -61,12 +61,10 @@ int GGPROTO::gc_init() void GGPROTO::gc_menus_init(HGENMENU hRoot) { - if (gc_enabled) - { - CLISTMENUITEM mi = {0}; + if (gc_enabled) { char service[64]; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE; mi.hParentMenu = hRoot; diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 22d1f7fe14..0400891ba7 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -68,15 +68,13 @@ int gg_img_remove(GGIMAGEDLGDATA *dat); int GGPROTO::img_init() { - CLISTMENUITEM mi = {0}; char service[64]; - - mi.cbSize = sizeof(mi); - mi.flags = CMIF_ICONFROMICOLIB; - - // Send image contact menu item mir_snprintf(service, sizeof(service), GGS_SENDIMAGE, m_szModuleName); createObjService(service, &GGPROTO::img_sendimg); + + // Send image contact menu item + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIF_ICONFROMICOLIB; mi.position = -2000010000; mi.icolibItem = GetIconHandle(IDI_IMAGE); mi.pszName = LPGEN("&Image"); diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 1bb5725222..7fd3d73b59 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -597,16 +597,14 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam) void GGPROTO::import_init(HGENMENU hRoot) { - CLISTMENUITEM mi = {0}; + // Import from server item char service[64]; + mir_snprintf(service, sizeof(service), GGS_IMPORT_SERVER, m_szModuleName); + createObjService(service, &GGPROTO::import_server); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE; mi.hParentMenu = hRoot; - - // Import from server item - mir_snprintf(service, sizeof(service), GGS_IMPORT_SERVER, m_szModuleName); - createObjService(service, &GGPROTO::import_server); mi.position = 2000500001; mi.icolibItem = GetIconHandle(IDI_IMPORT_SERVER); mi.pszName = LPGEN("Import List From &Server"); @@ -616,6 +614,7 @@ void GGPROTO::import_init(HGENMENU hRoot) // Import from textfile mir_snprintf(service, sizeof(service), GGS_IMPORT_TEXT, m_szModuleName); createObjService(service, &GGPROTO::import_text); + mi.position = 2000500002; mi.icolibItem = GetIconHandle(IDI_IMPORT_TEXT); mi.pszName = LPGEN("Import List From &Text File..."); @@ -625,6 +624,7 @@ void GGPROTO::import_init(HGENMENU hRoot) // Remove from server mir_snprintf(service, sizeof(service), GGS_REMOVE_SERVER, m_szModuleName); createObjService(service, &GGPROTO::remove_server); + mi.position = 2000500003; mi.icolibItem = GetIconHandle(IDI_REMOVE_SERVER); mi.pszName = LPGEN("&Remove List From Server"); @@ -634,6 +634,7 @@ void GGPROTO::import_init(HGENMENU hRoot) // Export to server mir_snprintf(service, sizeof(service), GGS_EXPORT_SERVER, m_szModuleName); createObjService(service, &GGPROTO::export_server); + mi.position = 2005000001; mi.icolibItem = GetIconHandle(IDI_EXPORT_SERVER); mi.pszName = LPGEN("Export List To &Server"); @@ -643,6 +644,7 @@ void GGPROTO::import_init(HGENMENU hRoot) // Export to textfile mir_snprintf(service, sizeof(service), GGS_EXPORT_TEXT, m_szModuleName); createObjService(service, &GGPROTO::export_text); + mi.position = 2005000002; mi.icolibItem = GetIconHandle(IDI_EXPORT_TEXT); mi.pszName = LPGEN("Export List To &Text File..."); diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 50a8a6ac54..7cc0c37215 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -44,7 +44,6 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) list_t l = g_Instances; GGPROTO *gg = NULL; uin_t uin; - CLISTMENUITEM mi = {0}; int items = 0; if (list_count(l) == 0) @@ -64,20 +63,18 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) if (!uin) return 1; - for (mi.cbSize = sizeof(mi); l; l = l->next) - { + for (; l; l = l->next) { GGPROTO *gginst = (GGPROTO*)l->data; + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; - if (gginst->m_iStatus > ID_STATUS_OFFLINE) - { + if (gginst->m_iStatus > ID_STATUS_OFFLINE) { ++items; gg = (GGPROTO*)l->data; mi.flags |= CMIM_ICON; mi.hIcon = LoadSkinnedProtoIcon(gg->m_szModuleName, gg->m_iStatus); } - else - { + else { mi.flags |= CMIF_HIDDEN; mi.hIcon = NULL; } @@ -87,8 +84,7 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) Skin_ReleaseIcon(mi.hIcon); } - if (items > 1) - { + if (items > 1) { ListParam param = {0}; HMENU hMenu = CreatePopupMenu(); POINT pt; diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 2888b5136f..48c460e432 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -425,19 +425,14 @@ BOOL GGPROTO::sessions_closedlg() void GGPROTO::sessions_menus_init(HGENMENU hRoot) { - CLISTMENUITEM mi = {0}; char service[64]; + mir_snprintf(service, sizeof(service), GGS_CONCUR_SESS, m_szModuleName); + createObjService(service, &GGPROTO::sessions_view); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE | CMIF_TCHAR; mi.hParentMenu = hRoot; - - mir_snprintf(service, sizeof(service), GGS_CONCUR_SESS, m_szModuleName); - createObjService(service, &GGPROTO::sessions_view); - if (hMenuRoot) - mi.position = 2050000001; - else - mi.position = 200003; + mi.position = (hMenuRoot) ? 2050000001 : 200003; mi.icolibItem = GetIconHandle(IDI_SESSIONS); mi.ptszName = LPGENT("Concurrent &sessions"); mi.pszService = service; diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index b176a01f00..83bbd9689e 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2331,12 +2331,11 @@ void CIrcProto::OnIrcDisconnected() memcpy( m_nick, m_pNick, sizeof( m_nick )); setTString( "Nick", m_pNick ); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS | CMIF_GRAYED; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_GRAYED; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi ); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -2362,12 +2361,11 @@ bool CIrcProto::DoOnConnect( const CIrcMessage* ) bPerformDone = true; nickflag = true; - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi ); int Temp = m_iStatus; m_iStatus = ID_STATUS_ONLINE; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index eb40452d47..3331c9aa93 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -1058,11 +1058,10 @@ int __cdecl CIrcProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM case EV_PROTO_ONRENAME: if ( hMenuRoot ) { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; - clmi.ptszName = m_tszUserName; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.ptszName = m_tszUserName; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&mi ); } break; diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 25fcc1a971..1bde54a395 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -797,13 +797,11 @@ void CConnectPrefsDlg::OnApply() m_proto->m_oldStyleModes = m_oldStyle.GetState(); m_proto->m_useServer = m_useServer.GetState(); - CLISTMENUITEM clmi; - memset( &clmi, 0, sizeof( clmi )); - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; if ( !m_proto->m_useServer ) - clmi.flags |= CMIF_GRAYED; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_proto->hMenuServer, ( LPARAM )&clmi ); + mi.flags |= CMIF_GRAYED; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_proto->hMenuServer, ( LPARAM )&mi ); m_proto->m_joinOnInvite = m_autoJoin.GetState(); m_proto->m_hideServerWindow = !m_showServer.GetState(); diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 78aa938026..e1987e9e0f 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -28,8 +28,7 @@ void CIrcProto::InitMainMenus(void) char temp[ MAXMODULELABELLENGTH ]; char *d = temp + sprintf( temp, m_szModuleName ); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = temp; if ( bChatInstalled ) { @@ -130,14 +129,13 @@ static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam) int IrcPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi ); CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam); return (ppro) ? ppro->OnMenuPreBuild(wParam, lParam) : 0; @@ -148,8 +146,7 @@ void InitContactMenus(void) char temp[MAXMODULELABELLENGTH]; char *d = temp + sprintf(temp, "IRC"); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = temp; mi.flags = CMIF_ICONFROMICOLIB; @@ -1014,47 +1011,46 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM) if ( !hContact ) return 0; - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; char *szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) wParam, 0); if ( szProto && !lstrcmpiA(szProto, m_szModuleName)) { bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE)== ID_STATUS_OFFLINE ? false : true; if ( getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM) { // context menu for chatrooms - clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi ); } else if ( !getTString( hContact, "Default", &dbv )) { // context menu for contact BYTE bDcc = getByte( hContact, "DCC", 0) ; - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi ); - clmi.flags = CMIM_FLAGS; + mi.flags = CMIM_FLAGS; if ( bDcc ) { // for DCC contact - clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi ); } else { // for normal contact - clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; + mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; if ( !IsConnected()) - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi ); if (bIsOnline) { DBVARIANT dbv3; if ( !getString( hContact, "Host", &dbv3)) { if (dbv3.pszVal[0] == 0) - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; DBFreeVariant( &dbv3 ); } } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi ); } DBFreeVariant( &dbv ); } } diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 6694b6145b..a5d3d684e5 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -92,8 +92,7 @@ static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam) static void sttEnableMenuItem( HANDLE hMenuItem, bool bEnable ) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if ( !bEnable ) clmi.flags |= CMIF_HIDDEN; @@ -126,8 +125,7 @@ void g_MenuInit(void) char str[MAXMODULELABELLENGTH], *pszDest = str + 3; strcpy( str, "ICQ" ); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = str; mi.flags = CMIF_ICONFROMICOLIB; @@ -238,9 +236,7 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0); if (bXStatus && !m_bHideXStatusUI) { - CLISTMENUITEM clmi = {0}; - - clmi.cbSize = sizeof(clmi); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_ICON; if (bXStatus > 0 && bXStatus <= XSTATUS_COUNT) diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index f5b659d867..89b530e607 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -789,12 +789,10 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) { - CLISTMENUITEM mi = {0}; BYTE bOldXStatus = getSettingByte(NULL, DBSETTING_XSTATUS_ID, 0); - mi.cbSize = sizeof(mi); - if (!m_bHideXStatusUI) { + CLISTMENUITEM mi = { sizeof(mi) }; if (bOldXStatus <= XSTATUS_COUNT) { mi.flags = CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hXStatusItems[bOldXStatus], (LPARAM)&mi); @@ -854,8 +852,7 @@ INT_PTR CIcqProto::menuXStatus(WPARAM wParam,LPARAM lParam,LPARAM fParam) void CIcqProto::InitXStatusItems(BOOL bAllowStatus) { - CLISTMENUITEM mi; - int i = 0, len = strlennull(m_szModuleName); + int len = strlennull(m_szModuleName); char srvFce[MAX_PATH + 64]; char szItem[MAX_PATH + 64]; int bXStatusMenuBuilt = 0; @@ -873,12 +870,13 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) return; null_snprintf(szItem, sizeof(szItem), Translate("%s Custom Status"), m_szModuleName); - mi.cbSize = sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszPopupName = szItem; mi.popupPosition = 500084000; mi.position = 2000040000; - for (i = 0; i <= XSTATUS_COUNT; i++) { + for (int i = 0; i <= XSTATUS_COUNT; i++) { null_snprintf(srvFce, sizeof(srvFce), "%s/menuXStatus%d", m_szModuleName, i); mi.position++; diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 6ee98fa8bb..de4c5ff4be 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -147,9 +147,7 @@ extern "C" int __declspec(dllexport) Unload(void) void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow) { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; if (bShow) mi.flags = CMIM_FLAGS; else @@ -160,11 +158,8 @@ void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow) static void CListSetMenuItemIcon(HANDLE hMenuItem, HICON hIcon) { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIM_ICON; - mi.hIcon = hIcon; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi); } diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 1a490f1eb9..95c0ee8b36 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -166,8 +166,7 @@ static INT_PTR JabberMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPAR static void sttEnableMenuItem(HANDLE hMenuItem, BOOL bEnable) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if ( !bEnable) clmi.flags |= CMIF_HIDDEN; @@ -219,8 +218,7 @@ void g_MenuInit(void) ////////////////////////////////////////////////////////////////////////////////////// // Contact menu initialization - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; // "Request authorization" mi.pszName = LPGEN("Request authorization"); @@ -389,9 +387,9 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) DBVARIANT dbv; if ( !JGetStringT(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) { db_free(&dbv); - CLISTMENUITEM clmi = { 0 }; sttEnableMenuItem(g_hMenuConvert, TRUE); - clmi.cbSize = sizeof(clmi); + + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.pszName = bIsChatRoom ? (char *)LPGEN("&Convert to Contact") : (char *)LPGEN("&Convert to Chat Room"); clmi.flags = CMIM_NAME | CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuConvert, (LPARAM)&clmi); @@ -403,8 +401,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) sttEnableMenuItem(g_hMenuDirectPresence[0], TRUE); for (int i = 0; i < SIZEOF(PresenceModeArray); ++i) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_ICON|CMIM_FLAGS; clmi.hIcon = (HICON)LoadSkinnedProtoIcon(m_szModuleName, PresenceModeArray[i].mode); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuDirectPresence[i+1], (LPARAM)&clmi); @@ -446,8 +443,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) if (item->resourceCount >= 1) { sttEnableMenuItem(g_hMenuResourcesRoot, TRUE); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON|CMIM_FLAGS; mi.icolibItem = GetIconHandle(IDI_JABBER); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesRoot, (LPARAM)&mi); @@ -464,7 +460,6 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) size_t nModuleNameLength = strlen(text); char* tDest = text + nModuleNameLength; - mi.cbSize = sizeof(CLISTMENUITEM); mi.flags = CMIF_CHILDPOPUP; mi.position = 0; mi.icolibItem = GetIconHandle(IDI_REQUEST); @@ -482,8 +477,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) m_phMenuResourceItems[i] = Menu_AddContactMenuItem(&mi); } if (i < item->resourceCount) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME|CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_TCHAR; if ((item->resourceMode == RSMODE_MANUAL) && (item->manualResource == i)) clmi.flags |= CMIF_CHECKED; @@ -503,14 +497,11 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) else sttEnableMenuItem(m_phMenuResourceItems[i], FALSE); } - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(CLISTMENUITEM); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_ICONFROMICOLIB | + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | ((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesActive, (LPARAM)&mi); - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_ICONFROMICOLIB | + mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesServer, (LPARAM)&mi); @@ -699,12 +690,11 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM wParam, LPARAM) void CJabberProto::MenuInit() { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(CLISTMENUITEM); - char text[ 200 ]; strcpy(text, m_szModuleName); char* tDest = text + strlen(text); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; HGENMENU hJabberRoot = MO_GetProtoRootMenu(m_szModuleName); @@ -894,11 +884,11 @@ void CJabberProto::UpdatePriorityMenu(short priority) return; TCHAR szName[128]; - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + mir_sntprintf(szName, SIZEOF(szName), TranslateT("Resource priority [%d]"), (int)priority); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR | CMIM_NAME; mi.ptszName = szName; - mir_sntprintf(szName, SIZEOF(szName), TranslateT("Resource priority [%d]"), (int)priority); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPriorityRoot, (LPARAM)&mi); m_priorityMenuVal = priority; @@ -1024,8 +1014,7 @@ void CJabberProto::EnableMenuItems(BOOL bEnable) void CJabberProto::CheckMenuItems() { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if ( !m_menuItemsStatus) clmi.flags |= CMIF_GRAYED; @@ -1280,8 +1269,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink) return g_Instances[i]; } - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; int nItems = 0, lastItemId = 0; for (int i = 0; i < g_Instances.getCount(); ++i) { diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 15a10b143b..c2ec58912e 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -2250,8 +2250,7 @@ INT_PTR __cdecl CJabberProto::menuSetPrivacyList(WPARAM, LPARAM, LPARAM iList) void CJabberProto::BuildPrivacyMenu() { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 200005; mi.pszContactOwner = m_szModuleName; mi.icolibItem = GetIconHandle(IDI_AGENTS); @@ -2285,8 +2284,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) i = 0; char srvFce[MAX_PATH + 64], *svcName = srvFce+strlen(m_szModuleName); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 2000040000; mi.flags = CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR; mi.hParentMenu = m_hPrivacyMenuRoot; diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 0e4417f961..e7e19cf2e2 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -475,8 +475,7 @@ void CPepGuiService::RebuildMenu() char szService[128]; mir_snprintf(szService, SIZEOF(szService), "%s/AdvStatusSet/%s", m_proto->m_szModuleName, m_name); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.hParentMenu = hJabberRoot; mi.pszService = szService; mi.position = 200010; diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index f24ffb42f3..be4790745f 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -168,8 +168,7 @@ void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMain strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction)); pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -1999901008; HGENMENU (*fnAddFunc)(CLISTMENUITEM*); diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index eb6497f506..37e8e60f0c 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1144,11 +1144,10 @@ DWORD CMraProto::CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReaso void CMraProto::CListShowMenuItem(HANDLE hMenuItem, BOOL bShow) { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; - if (bShow == FALSE) mi.flags |= CMIF_HIDDEN; + if (bShow == FALSE) + mi.flags |= CMIF_HIDDEN; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi); } @@ -1286,7 +1285,6 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP WCHAR szBuff[STATUS_TITLE_MAX+STATUS_DESC_MAX]; size_t dwBuffSize; WNDPROC OldMessageEditProc; - CLISTMENUITEM mi = {0}; SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)0); @@ -1314,7 +1312,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP dat->ppro->mraSetStringExW(NULL, szValueName, szBuff, dwBuffSize); dat->ppro->mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, szBuff, dwBuffSize); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = (CMIM_NAME|CMIF_UNICODE); mi.ptszName = szBuff; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)dat->ppro->hXStatusMenuItems[dat->dwXStatus], (LPARAM)&mi); diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 46175c5bfc..d221ec848b 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -661,8 +661,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM wParam, LPARAM lParam) WCHAR szItem[MAX_PATH+64], szStatusTitle[STATUS_TITLE_MAX+4]; mir_sntprintf(szItem, SIZEOF(szItem), L"%s Custom Status", m_tszUserName); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 2000060000; mi.popupPosition = 500085000; mi.ptszPopupName = szItem; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 1d8c813377..25ffe6447f 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -140,18 +140,16 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) const HANDLE hContact = (HANDLE)wParam; char szEmail[MSN_MAX_EMAIL_LEN]; - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - - if (!MSN_IsMyContact(hContact)) return 0; + if ( !MSN_IsMyContact(hContact)) + return 0; bool isMe = MSN_IsMeByContact(hContact, szEmail); - if (szEmail[0]) - { + if (szEmail[0]) { int listId = Lists_GetMask(szEmail); bool noChat = !(listId & LIST_FL) || isMe || getByte(hContact, "ChatRoom", 0); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB; if (noChat) mi.flags |= CMIF_HIDDEN; mi.pszName = (char*)((listId & LIST_BL) ? "&Unblock" : "&Block"); @@ -295,12 +293,10 @@ void CMsnProto::MsnInitMainMenu(void) strcpy(servicefunction, m_szModuleName); char* tDest = servicefunction + strlen(servicefunction); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); - if (hRoot == NULL) - { + if (hRoot == NULL) { mi.popupPosition = 500085000; mi.hParentMenu = HGENMENU_ROOT; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; @@ -308,8 +304,7 @@ void CMsnProto::MsnInitMainMenu(void) mi.ptszName = m_tszUserName; hRoot = mainMenuRoot = Menu_AddProtoMenuItem(&mi); } - else - { + else { MsnRemoveMainMenus(); mainMenuRoot = NULL; } @@ -364,20 +359,16 @@ void CMsnProto::MsnRemoveMainMenus(void) void CMsnProto::MSN_EnableMenuItems(bool bEnable) { - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; if (!bEnable) mi.flags |= CMIF_GRAYED; for (unsigned i=0; i < SIZEOF(menuItemsMain); i++) - { if (menuItemsMain[i] != NULL) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[i], (LPARAM)&mi); - } - if (bEnable) - { + if (bEnable) { mi.flags = CMIM_FLAGS; if (!emailEnabled) mi.flags |= CMIF_HIDDEN; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[1], (LPARAM)&mi); @@ -425,8 +416,7 @@ static INT_PTR MsnMenuSendHotmail(WPARAM wParam, LPARAM lParam) static void sttEnableMenuItem(HANDLE hMenuItem, bool bEnable) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS; if (!bEnable) clmi.flags |= CMIF_HIDDEN; @@ -457,8 +447,7 @@ void MSN_InitContactMenu(void) strcpy(servicefunction, "MSN"); char* tDest = servicefunction + strlen(servicefunction); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.pszService = servicefunction; diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 229aaf3673..1d92edf44f 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -1219,10 +1219,8 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l } case EV_PROTO_ONRENAME: - if (mainMenuRoot) - { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + if (mainMenuRoot) { + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME | CMIF_TCHAR; clmi.ptszName = m_tszUserName; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)mainMenuRoot, (LPARAM)&clmi); diff --git a/protocols/Tlen/src/jabber_iqid.cpp b/protocols/Tlen/src/jabber_iqid.cpp index 49df5a88be..3cf0e0f2ae 100644 --- a/protocols/Tlen/src/jabber_iqid.cpp +++ b/protocols/Tlen/src/jabber_iqid.cpp @@ -241,14 +241,11 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) } /////////////////////////////////////// { - CLISTMENUITEM clmi; - memset(&clmi, 0, sizeof(CLISTMENUITEM)); - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_FLAGS; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuMUC, (LPARAM) &clmi); - if (proto->hMenuChats != NULL){ - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuChats, (LPARAM) &clmi); - } + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuMUC, (LPARAM) &mi); + if (proto->hMenuChats != NULL) + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuChats, (LPARAM)&mi); } proto->isOnline = TRUE; diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp index 0c4ba468e5..450446f640 100644 --- a/protocols/Tlen/src/jabber_svc.cpp +++ b/protocols/Tlen/src/jabber_svc.cpp @@ -1213,11 +1213,10 @@ int __cdecl TlenProtocol::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPAR case EV_PROTO_ONEXIT: return TlenPreShutdown(this, 0, 0 ); case EV_PROTO_ONRENAME: { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof( CLISTMENUITEM ); - clmi.flags = CMIM_NAME | CMIF_TCHAR; - clmi.ptszName = m_tszUserName; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_NAME | CMIF_TCHAR; + mi.ptszName = m_tszUserName; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&mi ); /* FIXME: Rename network user as well */ } } diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp index 291d1208a5..6daf6ce0f3 100644 --- a/protocols/Tlen/src/jabber_thread.cpp +++ b/protocols/Tlen/src/jabber_thread.cpp @@ -114,11 +114,9 @@ void __cdecl JabberServerThread(ThreadData *info) int numRetry; int reconnectTime; char *str; - CLISTMENUITEM clmi; int loginErr = 0; JabberLog(info->proto, "Thread started"); - // Normal server connection, we will fetch all connection parameters // e.g. username, password, etc. from the database. @@ -353,13 +351,11 @@ void __cdecl JabberServerThread(ThreadData *info) info->proto->isOnline = FALSE; info->proto->isConnected = FALSE; - memset(&clmi, 0, sizeof(CLISTMENUITEM)); - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_FLAGS | CMIF_GRAYED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuMUC, (LPARAM) &clmi); - if (info->proto->hMenuChats != NULL){ - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuChats, (LPARAM) &clmi); - } + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_GRAYED; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuMUC, (LPARAM) &mi); + if (info->proto->hMenuChats != NULL) + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuChats, (LPARAM) &mi); // Set status to offline oldStatus = info->proto->m_iStatus; diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index d8a0a00652..05c76957f5 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -156,10 +156,9 @@ int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam) { HANDLE hContact; DBVARIANT dbv; - CLISTMENUITEM clmi = {0}; + CLISTMENUITEM clmi = { sizeof(clmi) }; JABBER_LIST_ITEM *item; TlenProtocol *proto = (TlenProtocol *)ptr; - clmi.cbSize = sizeof(CLISTMENUITEM); if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) { if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) { if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) { @@ -353,13 +352,9 @@ int TlenPreShutdown(void *ptr, WPARAM wParam, LPARAM lParam) static void initMenuItems(TlenProtocol *proto) { - char text[_MAX_PATH]; - CLISTMENUITEM mi, clmi; - memset(&mi, 0, sizeof(CLISTMENUITEM)); - mi.cbSize = sizeof(CLISTMENUITEM); - memset(&clmi, 0, sizeof(CLISTMENUITEM)); - clmi.cbSize = sizeof(CLISTMENUITEM); + + CLISTMENUITEM mi = { sizeof(mi) }, clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_GRAYED; mi.pszContactOwner = proto->m_szModuleName; @@ -411,7 +406,6 @@ static void initMenuItems(TlenProtocol *proto) mi.hParentMenu = NULL; - // "Send picture" sprintf(text, "%s/SendPicture", proto->m_szModuleName); CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleSendPicture); diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index bf13f01c76..5cfb37a568 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -322,11 +322,11 @@ int TwitterProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam) if (hRoot == NULL) return 0; - CLISTMENUITEM mi = {sizeof(mi)}; - char text[200]; strcpy(text,m_szModuleName); char *tDest = text+strlen(text); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = text; mi.hParentMenu = hRoot; diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 835c8e6aa0..196584b580 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -431,19 +431,17 @@ void Xfire_game::writeToDB(unsigned dbid) //erzeugt ein menüpunkt void Xfire_game::createMenuitem(unsigned int pos,int dbid) { - CLISTMENUITEM mi = { 0 }; char servicefunction[100]; + strcpy(servicefunction, protocolname); + strcat(servicefunction, "StartGame%d"); if(dbid<0) dbid=pos; - memset(&mi,0,sizeof(CLISTMENUITEM)); - strcpy(servicefunction, protocolname); - strcat(servicefunction, "StartGame%d"); + CLISTMENUITEM mi = { sizeof(mi) }; mi.popupPosition = 500084000; mi.pszPopupName = Translate("Start game"); mi.pszContactOwner=protocolname; - mi.cbSize = sizeof( mi ); sprintf(temp,servicefunction,this->id); //wenn die servicefunktion schon exisitert vernichten, hehe @@ -475,13 +473,12 @@ void Xfire_game::refreshMenuitem() { if(menuhandle!=NULL) { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; if(this->notinstartmenu) - clmi.flags|= CMIF_HIDDEN; + mi.flags|= CMIF_HIDDEN; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )menuhandle, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )menuhandle, ( LPARAM )&mi ); } } \ No newline at end of file diff --git a/protocols/Xfire/src/Xfire_gamelist.cpp b/protocols/Xfire/src/Xfire_gamelist.cpp index 3496a2e3f1..c4fb12ee20 100644 --- a/protocols/Xfire/src/Xfire_gamelist.cpp +++ b/protocols/Xfire/src/Xfire_gamelist.cpp @@ -246,16 +246,14 @@ void Xfire_gamelist::clearGamelist() { //erstellt ein dummyeintrag void Xfire_gamelist::createDummyMenuItem() { - CLISTMENUITEM midummy = { 0 }; - midummy.cbSize = sizeof( midummy ); - midummy.position = 500090001; - midummy.pszName = Translate("Please wait ..."); - //midummy.flags = CMIF_GRAYED; geht nicht bei 0.8.1 - midummy.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); - midummy.popupPosition = 500084000; - midummy.pszPopupName = Translate("Start game"); - midummy.pszContactOwner=protocolname; - dummymenuitem=Menu_AddMainMenuItem(&midummy); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 500090001; + mi.pszName = Translate("Please wait ..."); + mi.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(ID_OP)); + mi.popupPosition = 500084000; + mi.pszPopupName = Translate("Start game"); + mi.pszContactOwner=protocolname; + dummymenuitem = Menu_AddMainMenuItem(&mi); } //entfernt dummymenueintrag diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 9b6af47d47..2add029050 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1215,9 +1215,7 @@ extern "C" __declspec(dllexport) int Load(void) CreateDirectory(AvatarsFolder,NULL); //erweiterte Kontextmenüpunkte - CLISTMENUITEM mi = { 0 }; - memset(&mi,0,sizeof(CLISTMENUITEM)); - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszPopupName = protocolname; //gotoprofilemenüpunkt @@ -2256,6 +2254,7 @@ static INT_PTR GotoProfileAct(WPARAM wParam,LPARAM lParam) int RebuildContactMenu( WPARAM wParam, LPARAM lParam ) { + // !!!!!!!! check it later CLISTMENUITEM clmi = { 0 }; clmi.cbSize = sizeof( clmi ); CLISTMENUITEM clmi2 = { 0 }; diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 8e9517a036..e7d1137c30 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -149,7 +149,6 @@ void Scan4Games( LPVOID lparam ) BOOL multiexe=FALSE; BOOL somethingfound=TRUE; int i3=0; - CLISTMENUITEM mi = { 0 }; DWORD gpps=1; DWORD last_gpps=0; static BOOL searching=FALSE; diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 6d42641ec4..124048995f 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -755,11 +755,10 @@ int __cdecl CYahooProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARA case EV_PROTO_ONRENAME: if ( mainMenuRoot ) { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; - clmi.ptszName = m_tszUserName; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )mainMenuRoot, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.ptszName = m_tszUserName; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)mainMenuRoot, (LPARAM)&mi ); } break; diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 40166100ed..641b4e609c 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -378,8 +378,7 @@ void CYahooProto::MenuMainInit( void ) lstrcpyA( servicefunction, m_szModuleName ); char* tDest = servicefunction + lstrlenA( servicefunction ); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = servicefunction; HGENMENU hRoot = MO_GetProtoRootMenu( m_szModuleName ); @@ -480,8 +479,7 @@ void CYahooProto::MenuContactInit( void ) lstrcpyA( servicefunction, m_szModuleName ); char* tDest = servicefunction + lstrlenA( servicefunction ); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.pszService = servicefunction; mi.pszContactOwner = m_szModuleName; @@ -507,24 +505,19 @@ void CYahooProto::MenuUninit( void ) int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) { - const HANDLE hContact = (HANDLE)wParam; - - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - + const HANDLE hContact = (HANDLE)wParam; if (!IsMyContact(hContact)) { DebugLog("[OnPrebuildContactMenu] Not a Yahoo Contact!!!"); return 0; } + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; - - if (GetWord( hContact, "yprotoid", 0) != 0) + if (GetWord( hContact, "yprotoid", 0) != 0) mi.flags |= CMIF_HIDDEN; - - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowProfileMenuItem, (LPARAM)&mi); - return 0; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowProfileMenuItem, (LPARAM)&mi); + return 0; } diff --git a/src/core/stdaway/awaymsg.cpp b/src/core/stdaway/awaymsg.cpp index 4419e34b53..af06a8c4f7 100644 --- a/src/core/stdaway/awaymsg.cpp +++ b/src/core/stdaway/awaymsg.cpp @@ -132,29 +132,26 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) { - CLISTMENUITEM clmi; TCHAR str[128]; - char *szProto; + char *szProto = GetContactProto((HANDLE)wParam); - szProto = GetContactProto((HANDLE)wParam); - ZeroMemory(&clmi, sizeof(clmi)); - clmi.cbSize = sizeof(clmi); - clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR; if (szProto != NULL) { int chatRoom = szProto ? DBGetContactSettingByte((HANDLE)wParam, szProto, "ChatRoom", 0) : 0; if ( !chatRoom) { int status = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s Message"), pcli->pfnGetStatusModeDescription(status, 0)); - clmi.ptszName = str; + mi.ptszName = str; if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) { if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) { - clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_NOTOFFLINE | CMIM_ICON | CMIF_TCHAR; - clmi.hIcon = LoadSkinProtoIcon(szProto, status); + mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_NOTOFFLINE | CMIM_ICON | CMIF_TCHAR; + mi.hIcon = LoadSkinProtoIcon(szProto, status); } } } } - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAwayMsgMenuItem, (LPARAM)&clmi); - IcoLib_ReleaseIcon(clmi.hIcon, 0); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hAwayMsgMenuItem, (LPARAM)&mi); + IcoLib_ReleaseIcon(mi.hIcon, 0); return 0; } @@ -166,12 +163,10 @@ static int AwayMsgPreShutdown(WPARAM, LPARAM) int LoadAwayMsgModule(void) { - CLISTMENUITEM mi = {0}; - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000005000; mi.flags = CMIF_NOTOFFLINE; mi.pszName = LPGEN("Re&ad Status Message"); diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index 83467c0c71..687ed7f50b 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -197,28 +197,27 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if ( hContact ) { char* szProto = GetContactProto(hContact); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; if ( szProto ) { // display this menu item only for chats if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 )) { // still hide it for offline protos if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE ) { - clmi.flags &= ~CMIF_HIDDEN; - clmi.flags |= CMIM_NAME; + mi.flags &= ~CMIF_HIDDEN; + mi.flags |= CMIM_NAME; if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) - clmi.pszName = ( char* )LPGEN("Join chat"); + mi.pszName = ( char* )LPGEN("Join chat"); else - clmi.pszName = ( char* )LPGEN("Open chat window"); + mi.pszName = ( char* )LPGEN("Open chat window"); } } } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hJoinMenuItem, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hJoinMenuItem, ( LPARAM )&mi ); - clmi.flags &= ~(CMIM_NAME | CMIF_DEFAULT); - clmi.flags |= CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hLeaveMenuItem, ( LPARAM )&clmi ); + mi.flags &= ~(CMIM_NAME | CMIF_DEFAULT); + mi.flags |= CMIF_NOTOFFLINE; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hLeaveMenuItem, ( LPARAM )&mi ); } return 0; } diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp index 6d08843093..247b71b3c9 100644 --- a/src/core/stdchat/src/services.cpp +++ b/src/core/stdchat/src/services.cpp @@ -219,8 +219,7 @@ static int ModulesLoaded(WPARAM wParam,LPARAM lParam) AddIcons(); LoadIcons(); { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090001; mi.flags = CMIF_DEFAULT | CMIF_ICONFROMICOLIB; mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN ); diff --git a/src/core/stdemail/email.cpp b/src/core/stdemail/email.cpp index b18743d809..30d054c417 100644 --- a/src/core/stdemail/email.cpp +++ b/src/core/stdemail/email.cpp @@ -51,8 +51,7 @@ static INT_PTR SendEMailCommand(WPARAM wParam, LPARAM lParam) static int EMailPreBuildMenu(WPARAM wParam, LPARAM) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; DBVARIANT dbv = { 0 }; @@ -68,8 +67,7 @@ static int EMailPreBuildMenu(WPARAM wParam, LPARAM) int LoadSendRecvEMailModule(void) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000010000; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_SENDEMAIL); diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index dfb77b086b..baa7aaeb2f 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -308,8 +308,7 @@ static void RemoveUnreadFileEvents(void) static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_HIDDEN; char *szProto = GetContactProto((HANDLE)wParam); @@ -327,8 +326,7 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) static int SRFileModulesLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000020000; mi.icolibItem = GetSkinIconHandle(SKINICON_EVENT_FILE); mi.pszName = LPGEN("&File"); @@ -426,8 +424,7 @@ int LoadSendRecvFileModule(void) { CreateServiceFunction("FtMgr/Show", FtMgrShowCommand); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_EVENT_FILE); mi.position = 1900000000; diff --git a/src/core/stdhelp/help.cpp b/src/core/stdhelp/help.cpp index f077ee6261..3a01c3476f 100644 --- a/src/core/stdhelp/help.cpp +++ b/src/core/stdhelp/help.cpp @@ -84,8 +84,7 @@ int LoadHelpModule(void) hBugEvent = CreateHookableEvent(ME_HELP_BUGREPORT); SetHookDefaultForHookableEvent(hBugEvent, BugCommandEvent); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_MIRANDA); mi.pszPopupName = LPGEN("&Help"); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 6167c53214..66dbc0b8e0 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -313,8 +313,7 @@ static int SplitmsgModulesLoaded(WPARAM wParam, LPARAM lParam) RegisterSRMMFonts(); LoadMsgLogIcons(); { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090000; mi.flags = CMIF_ICONFROMICOLIB | CMIF_DEFAULT; mi.icolibItem = LoadSkinnedIconHandle( SKINICON_EVENT_MESSAGE ); @@ -376,8 +375,7 @@ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if ( hContact ) { char* szProto = GetContactProto(hContact); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); + CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; if ( szProto ) { diff --git a/src/core/stduihist/history.cpp b/src/core/stduihist/history.cpp index e67a32dc8e..e0567f2dcc 100644 --- a/src/core/stduihist/history.cpp +++ b/src/core/stduihist/history.cpp @@ -413,8 +413,7 @@ int PreShutdownHistoryModule(WPARAM, LPARAM) int LoadHistoryModule(void) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1000090000; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_HISTORY); diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index 767828dc3c..0b1f8c8714 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -115,8 +115,7 @@ static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) static int SRUrlPreBuildMenu(WPARAM wParam, LPARAM) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_HIDDEN; char *szProto = GetContactProto((HANDLE)wParam); @@ -130,8 +129,7 @@ static int SRUrlPreBuildMenu(WPARAM wParam, LPARAM) static int SRUrlModulesLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000040000; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_EVENT_URL); diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 612be5cd8e..8fcc0a3120 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -91,17 +91,14 @@ static int MenuItem_PreBuild(WPARAM, LPARAM) TCHAR cls[128]; HANDLE hItem; HWND hwndClist = GetFocus(); - CLISTMENUITEM mi; - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS; GetClassName(hwndClist, cls, SIZEOF(cls)); hwndClist = ( !lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList; hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); - if ( !hItem) { + if ( !hItem) mi.flags = CMIM_FLAGS | CMIF_HIDDEN; - } CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hRenameMenuItem, (LPARAM) & mi); return 0; } @@ -356,8 +353,7 @@ int LoadCLUIModule(void) 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); } { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact); mi.position = 2000070000; diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 56a5e89ddb..0e5bfd5420 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -66,8 +66,7 @@ static TCHAR* PrepareGroupName(TCHAR* str) static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, bool checked) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.hParentMenu = hRoot; mi.popupPosition = param; // param to pszService - only with CMIF_CHILDPOPUP !!!!!! mi.position = pos; @@ -87,11 +86,8 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) int i; OBJLIST groups(10, GroupItemSort::compare); - if ( !hMoveToGroupItem) - { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); + if ( !hMoveToGroupItem) { + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 100000; mi.pszName = LPGEN("&Move to Group"); mi.flags = CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB; diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 4d8d71c438..4af9638e87 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -1417,8 +1417,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) static int OptModulesLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_OPTIONS); mi.position = 1900000000; diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 31f3302252..847fd15839 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -1033,8 +1033,7 @@ static INT_PTR OptProtosShow(WPARAM, LPARAM) int OptProtosLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ACCMGR); mi.position = 1900000000; -- cgit v1.2.3