diff options
Diffstat (limited to 'plugins')
99 files changed, 1047 insertions, 1151 deletions
diff --git a/plugins/AddContactPlus/main.cpp b/plugins/AddContactPlus/main.cpp index 7d1475d72c..932105e175 100644 --- a/plugins/AddContactPlus/main.cpp +++ b/plugins/AddContactPlus/main.cpp @@ -110,7 +110,7 @@ static int OnAccListChanged(WPARAM, LPARAM) mi.icolibItem = hIconLibItem;
mi.ptszName = LPGENT("&Add Contact...");
mi.pszService = MS_ADDCONTACTPLUS_SHOW;
- hMainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMainMenuItem = Menu_AddMainMenuItem(&mi);
if (ServiceExists(MS_TB_ADDBUTTON))
{
diff --git a/plugins/Alarms/frame.cpp b/plugins/Alarms/frame.cpp index e298cae41d..cc36c3bc86 100644 --- a/plugins/Alarms/frame.cpp +++ b/plugins/Alarms/frame.cpp @@ -567,17 +567,17 @@ int CreateFrame() // create menu item
CreateServiceFunction(MODULE "/ShowHideReminders", ShowHideMenuFunc);
- CLISTMENUITEM menu = {0};
+ CLISTMENUITEM mi = {0};
- menu.cbSize=sizeof(menu);
- menu.flags = CMIM_ALL;
+ mi.cbSize=sizeof(mi);
+ mi.flags = CMIM_ALL;
- menu.hIcon=hIconMenuShowHide;
- menu.pszName = Translate("Show Reminders");
- menu.pszService= MODULE "/ShowHideReminders";
- menu.pszPopupName = Translate("Alarms");
- menu.position = 500010000;
- hMenuShowReminders = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&menu);
+ mi.hIcon=hIconMenuShowHide;
+ mi.pszName = Translate("Show Reminders");
+ mi.pszService= MODULE "/ShowHideReminders";
+ mi.pszPopupName = Translate("Alarms");
+ mi.position = 500010000;
+ hMenuShowReminders = Menu_AddMainMenuItem(&mi);
/////////////////////
if (!options.auto_showhide) {
diff --git a/plugins/Alarms/options.cpp b/plugins/Alarms/options.cpp index 4b6076e6bb..9f2b9d1222 100644 --- a/plugins/Alarms/options.cpp +++ b/plugins/Alarms/options.cpp @@ -696,22 +696,20 @@ void AddMenuItem() {
if (hMainMenuItem) return;
- CLISTMENUITEM menu = {0};
-
- menu.cbSize=sizeof(menu);
- menu.flags = CMIM_ALL;
- menu.hIcon=hIconMenuSet;
-
- menu.pszName = Translate("Set Alarm");
- menu.pszService= MODULE "/NewAlarm";
- menu.position = 500010000;
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(mi);
+ mi.flags = CMIM_ALL;
+ mi.hIcon = hIconMenuSet;
+ mi.pszName = "Set Alarm";
+ mi.pszService = MODULE "/NewAlarm";
+ mi.position = 500010000;
if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
- menu.pszPopupName = Translate("Alarms");
- if (ServiceExists(MS_CLIST_ADDGROUPMENUITEM)) {
+ mi.pszPopupName = "Alarms";
+ if (ServiceExists(MS_CLIST_REMOVEGROUPMENUITEM)) {
GroupMenuParam gmp = {0};
- hGroupMenuItem = (HANDLE)CallService(MS_CLIST_ADDGROUPMENUITEM,(WPARAM)&gmp,(LPARAM)&menu);
+ hGroupMenuItem = Menu_AddGroupMenuItem(&gmp, &mi);
}
- hMainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+ hMainMenuItem = Menu_AddMainMenuItem(&mi);
}
///////////////////////
diff --git a/plugins/AuthState/main.cpp b/plugins/AuthState/main.cpp index ba5a006f2d..890e3689b1 100644 --- a/plugins/AuthState/main.cpp +++ b/plugins/AuthState/main.cpp @@ -369,7 +369,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) mi.flags = CMIF_TCHAR;
mi.ptszName = _T("Enable AuthState icons");
mi.pszService = "AuthState/MenuItem";
- hUserMenu = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hUserMenu = Menu_AddContactMenuItem(&mi);
}
g_IECClear.cbSize = sizeof(IconExtraColumn);
diff --git a/plugins/AutoRun/main.c b/plugins/AutoRun/main.c index 31eb9790cd..c1c7263d68 100644 --- a/plugins/AutoRun/main.c +++ b/plugins/AutoRun/main.c @@ -1,3 +1,5 @@ +#define _CRT_SECURE_NO_WARNINGS
+
#include <windows.h>
#include "autorun.h"
diff --git a/plugins/BasicHistory/BasicHistory.cpp b/plugins/BasicHistory/BasicHistory.cpp index bbe74a1629..975cd061ed 100644 --- a/plugins/BasicHistory/BasicHistory.cpp +++ b/plugins/BasicHistory/BasicHistory.cpp @@ -140,18 +140,18 @@ void InitMenuItems() mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
mi.pszName = LPGEN("View &History");
mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
- hContactMenu = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hContactMenu = Menu_AddContactMenuItem(&mi);
mi.position = 500060000;
mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.position = 1000090001;
mi.flags = CMIF_ICONFROMICOLIB;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE);
mi.pszName = LPGEN("Delete All User History");
mi.pszService = MS_HISTORY_DELETEALLCONTACTHISTORY;
- hDeleteContactMenu = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hDeleteContactMenu = Menu_AddContactMenuItem(&mi);
hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
}
@@ -168,7 +168,7 @@ void InitTaskMenuItems() mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
mi.pszName = LPGEN("Execute history task");
- hTaskMainMenu = (HGENMENU)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ hTaskMainMenu = Menu_AddMainMenuItem(&mi);
}
std::vector<TaskOptions>::iterator taskIt = Options::instance->taskOptions.begin();
@@ -202,7 +202,7 @@ void InitTaskMenuItems() mi.hParentMenu = hTaskMainMenu;
mi.popupPosition = pos++;
mi.ptszName = (TCHAR*)taskIt->taskName.c_str();
- HGENMENU menu = (HGENMENU)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ HGENMENU menu = Menu_AddMainMenuItem(&mi);
taskMenus.push_back(menu);
}
}
diff --git a/plugins/Boltun/boltun.cpp b/plugins/Boltun/boltun.cpp index c67c56949f..a26b68c862 100644 --- a/plugins/Boltun/boltun.cpp +++ b/plugins/Boltun/boltun.cpp @@ -668,19 +668,19 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) mi.pszContactOwner = NULL;
mi.pszName = BOLTUN_AUTO_CHAT;
mi.pszService = SERV_CONTACT_AUTO_CHAT;
- hMenuItemAutoChat = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hMenuItemAutoChat = Menu_AddContactMenuItem(&mi);
mi.position = -50010001; //TODO: check the warning
mi.pszName = BOLTUN_NOT_TO_CHAT;
mi.pszService = SERV_CONTACT_NOT_TO_CHAT;
- hMenuItemNotToChat = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hMenuItemNotToChat = Menu_AddContactMenuItem(&mi);
mi.flags = CMIF_NOTOFFLINE;
mi.position = -50010000; //TODO: check the warning
- mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RECVMSG));
+ mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RECVMSG));
mi.pszName = BOLTUN_START_CHATTING;
mi.pszService = SERV_CONTACT_START_CHATTING;
- hMenuItemStartChatting = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hMenuItemStartChatting = Menu_AddContactMenuItem(&mi);
}
int line;
blInit = LoadMind(Config.MindFileName, line);
diff --git a/plugins/BossKeyPlus/BossKey.cpp b/plugins/BossKeyPlus/BossKey.cpp index b0a21ef6d2..8cf8e3cfdc 100644 --- a/plugins/BossKeyPlus/BossKey.cpp +++ b/plugins/BossKeyPlus/BossKey.cpp @@ -659,7 +659,7 @@ void BossKeyMenuItemInit(void) // Add menu item mi.ptszName = _T("Hide");
mi.pszService = MS_BOSSKEY_HIDE;
- g_hMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ g_hMenuItem = Menu_AddMainMenuItem(&mi);
g_hmGenMenuInit = HookEvent(ME_CLIST_PREBUILDMAINMENU, GenMenuInit);
}
diff --git a/plugins/BuddyExpectator/BuddyExpectator.cpp b/plugins/BuddyExpectator/BuddyExpectator.cpp index c8d1aebeac..ebf4625b93 100644 --- a/plugins/BuddyExpectator/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/BuddyExpectator.cpp @@ -818,7 +818,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.position = 200000;
mi.pszName = Translate("Enable Miss You");
mi.pszService = "BuddyExpectator/actionMissYouClick";
- hContactMenu = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hContactMenu = Menu_AddContactMenuItem(&mi);
}
// Updater plugin support
diff --git a/plugins/CSList/cslist.cpp b/plugins/CSList/cslist.cpp index f354d68519..edb87b0175 100644 --- a/plugins/CSList/cslist.cpp +++ b/plugins/CSList/cslist.cpp @@ -424,7 +424,7 @@ void CSList::addProtoStatusMenuItem( char* protoName, void* arg ) mi.position = 2000040000;
mi.pszService = buf;
mi.ptszPopupName = pdescr->tszAccountName;
- CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddStatusMenuItem(&mi);
cslist->registerHotkeys(buf, pdescr->tszAccountName, pdescr->iOrder);
}
diff --git a/plugins/Chat/services.c b/plugins/Chat/services.c index 5687e9cb99..53ed1a03c0 100644 --- a/plugins/Chat/services.c +++ b/plugins/Chat/services.c @@ -227,14 +227,14 @@ static int ModulesLoaded(WPARAM wParam,LPARAM lParam) mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN );
mi.pszName = LPGEN("&Join");
mi.pszService = "GChat/JoinChat";
- hJoinMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hJoinMenuItem = Menu_AddContactMenuItem(&mi);
mi.position = -2000090000;
mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_LEAVE );
mi.flags = CMIF_NOTOFFLINE | CMIF_ICONFROMICOLIB;
mi.pszName = LPGEN("&Leave");
mi.pszService = "GChat/LeaveChat";
- hLeaveMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
}
g_hFontsChanged = HookEvent(ME_FONT_RELOAD, FontsChanged);
diff --git a/plugins/ClientChangeNotify/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/ClientChangeNotify.cpp index ee629a7409..a19c41e128 100644 --- a/plugins/ClientChangeNotify/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/ClientChangeNotify.cpp @@ -442,7 +442,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) mi.pszService = MS_CCN_TOGGLEPOPUPS;
mi.ptszPopupName = TranslateT("PopUps");
- g_hTogglePopupsMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi);
}
// seems that Fingerprint is not installed
diff --git a/plugins/Clist/clcfonts.c b/plugins/Clist/clcfonts.c index b1720e0814..9ff56524a4 100644 --- a/plugins/Clist/clcfonts.c +++ b/plugins/Clist/clcfonts.c @@ -59,11 +59,6 @@ static int fontListOrder[CLIST_FONTID_MAX + 1] = CLIST_FONTID_DIVIDERS
};
-#define CLCDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE)
-#define CLCDEFAULT_SELTEXTCOLOUR GetSysColor(COLOR_HIGHLIGHTTEXT)
-#define CLCDEFAULT_HOTTEXTCOLOUR (IsWinVer98Plus()?RGB(0,0,255):GetSysColor(COLOR_HOTLIGHT))
-#define CLCDEFAULT_QUICKSEARCHCOLOUR RGB(255,255,0)
-
static int FS_FontsChanged(WPARAM wParam, LPARAM lParam)
{
pcli->pfnClcOptionsChanged();
diff --git a/plugins/Clist_nicer/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/CLUIFrames/cluiframes.cpp index f260db6058..3bf3eb1700 100644 --- a/plugins/Clist_nicer/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/CLUIFrames/cluiframes.cpp @@ -646,7 +646,7 @@ int CLUIFramesGetalClientFrame(void) return -1;
}
-HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *addservice)
+HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU (*pfnAdd )( CLISTMENUITEM* ))
{
CLISTMENUITEM mi;
//TMO_MenuItem tmi;
@@ -665,7 +665,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.pszName = LPGEN("&FrameTitle");
mi.flags = CMIF_CHILDPOPUP | CMIF_GRAYED | CMIF_ICONFROMICOLIB;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMITitle = menuid;
else Frames[framepos].MenuHandles.MITitle = menuid;
@@ -679,7 +679,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED;
mi.pszContactOwner = (char *)0;
mi.pszService = MS_CLIST_FRAMES_SHFRAME;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIVisible = menuid;
else Frames[framepos].MenuHandles.MIVisible = menuid;
@@ -690,7 +690,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMITBVisible = menuid;
else Frames[framepos].MenuHandles.MITBVisible = menuid;
@@ -704,7 +704,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_ULFRAME;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMILock = menuid;
else Frames[framepos].MenuHandles.MILock = menuid;
@@ -715,7 +715,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIColl = menuid;
else Frames[framepos].MenuHandles.MIColl = menuid;
@@ -727,7 +727,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP;
mi.pszService = "Set_Floating";
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIFloating = menuid;
else Frames[framepos].MenuHandles.MIFloating = menuid;
@@ -741,7 +741,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETUNBORDER;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIBorder = menuid;
else Frames[framepos].MenuHandles.MIBorder = menuid;
@@ -754,7 +754,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETSKINNED;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMISkinned = menuid;
else Frames[framepos].MenuHandles.MISkinned = menuid;
@@ -769,7 +769,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP;
mi.pszService = "";
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignRoot = menuid;
else Frames[framepos].MenuHandles.MIAlignRoot = menuid;
@@ -781,7 +781,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.pszName = LPGEN("&Top");
mi.pszService = CLUIFRAMESSETALIGNALTOP;
mi.pszContactOwner = (char *)alTop;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignTop = menuid;
else Frames[framepos].MenuHandles.MIAlignTop = menuid;
@@ -791,7 +791,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.pszName = LPGEN("&Client");
mi.pszService = CLUIFRAMESSETALIGNALCLIENT;
mi.pszContactOwner = (char *)alClient;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignClient = menuid;
else Frames[framepos].MenuHandles.MIAlignClient = menuid;
@@ -800,7 +800,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.pszName = LPGEN("&Bottom");
mi.pszService = CLUIFRAMESSETALIGNALBOTTOM;
mi.pszContactOwner = (char *)alBottom;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignBottom = menuid;
else Frames[framepos].MenuHandles.MIAlignBottom = menuid;
@@ -815,7 +815,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTPOPUP;
mi.pszService = "";
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice, 0, (LPARAM) & mi);
+ menuid = pfnAdd(&mi);
mi.pszPopupName = (char *)menuid;
mi.popupPosition = frameid;
@@ -824,7 +824,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP;
mi.pszService = CLUIFRAMESMOVEUP;
mi.pszContactOwner = (char *)1;
- CallService(addservice, 0, (LPARAM)&mi);
+ pfnAdd(&mi);
mi.pszPopupName = (char *)menuid;
mi.popupPosition = frameid;
@@ -833,8 +833,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, char *ad mi.flags = CMIF_CHILDPOPUP;
mi.pszService = CLUIFRAMESMOVEDOWN;
mi.pszContactOwner = (char *) - 1;
- CallService(addservice, 0, (LPARAM)&mi);
-
+ pfnAdd(&mi);
}
return 0;
@@ -1633,7 +1632,7 @@ static int CLUIFramesLoadMainMenu() mi.pszPopupName = (char*) - 1;
mi.pszName = LPGEN("Frames");
mi.pszService = 0;
- MainMIRoot = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) & mi);
+ MainMIRoot = Menu_AddMainMenuItem(&mi);
// create frames menu
separator = (int)3000200000;
@@ -1644,8 +1643,8 @@ static int CLUIFramesLoadMainMenu() mi.pszPopupName = (char*)MainMIRoot;
mi.ptszName = Frames[i].TitleBar.tbname ? Frames[i].TitleBar.tbname : Frames[i].name;
mi.pszService = 0;
- Frames[i].MenuHandles.MainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) & mi);
- CLUIFramesCreateMenuForFrame(Frames[i].id, (int)Frames[i].MenuHandles.MainMenuItem, separator, MS_CLIST_ADDMAINMENUITEM);
+ Frames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi);
+ CLUIFramesCreateMenuForFrame(Frames[i].id, (int)Frames[i].MenuHandles.MainMenuItem, separator, Menu_AddMainMenuItem);
CLUIFramesModifyMainMenuItems(Frames[i].id, 0);
//NotifyEventHooks(hPreBuildFrameMenuEvent,i,(LPARAM)Frames[i].MenuHandles.MainMenuItem);
CallService(MS_CLIST_FRAMEMENUNOTIFY, (WPARAM)Frames[i].id, (LPARAM)Frames[i].MenuHandles.MainMenuItem);
@@ -1661,7 +1660,7 @@ static int CLUIFramesLoadMainMenu() mi.pszPopupName = (char*)MainMIRoot;
mi.pszName = LPGEN("Show All Frames");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// create "show all titlebars" menu
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP));
@@ -1670,7 +1669,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_CHILDPOPUP;
mi.pszName = LPGEN("Show All Titlebars");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// create "hide all titlebars" menu
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP));
@@ -1679,7 +1678,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_CHILDPOPUP;
mi.pszName = LPGEN("Hide All Titlebars");
mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
return 0;
}
@@ -3363,7 +3362,7 @@ static int CLUIFrameOnModulesLoad(WPARAM wParam, LPARAM lParam) hThreadMFUpdate = (HANDLE)mir_forkthreadex(reinterpret_cast<pThreadFuncEx>(MF_UpdateThread), NULL, 0, NULL);
SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE);
CLUIFramesLoadMainMenu();
- CLUIFramesCreateMenuForFrame(-1, -1, 000010000, MS_CLIST_ADDCONTEXTFRAMEMENUITEM);
+ CLUIFramesCreateMenuForFrame(-1, -1, 000010000, Menu_AddContextFrameMenuItem);
return 0;
}
@@ -3371,7 +3370,7 @@ static int CLUIFrameOnModulesUnload(WPARAM wParam, LPARAM lParam) {
mf_updatethread_running = FALSE;
- SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_NORMAL);
+ SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_NORMAL);
SetEvent(g_hEventThread);
WaitForSingleObject(hThreadMFUpdate, 2000);
CloseHandle(hThreadMFUpdate);
diff --git a/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp index 818f32ffd5..1d5b0dd850 100644 --- a/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp @@ -210,7 +210,7 @@ int InitFramesMenus(void) CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
- CreateServiceFunction(MS_CLIST_ADDCONTEXTFRAMEMENUITEM,AddContextFrameMenuItem);
+ CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
hPreBuildFrameMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
diff --git a/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp index 82786d9a45..52bdb33c01 100644 --- a/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp @@ -321,7 +321,7 @@ void InitGroupMenus(void) CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper",UseGroupsHelper);
CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper",HideOfflineRootHelper);
- CreateServiceFunction(MS_CLIST_ADDGROUPMENUITEM,AddGroupMenuItem);
+ CreateServiceFunction("CList/AddGroupMenuItem",AddGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu);
hPreBuildGroupMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
@@ -673,7 +673,7 @@ void InitSubGroupMenus(void) //CreateServiceFunction("CLISTMENUSSubGroup/UseSubGroupsHelper",UseSubGroupsHelper);
//CreateServiceFunction("CLISTMENUSSubGroup/HideOfflineRootHelper",HideOfflineRootHelper);
- CreateServiceFunction(MS_CLIST_ADDSUBGROUPMENUITEM,AddSubGroupMenuItem);
+ CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu);
hPreBuildSubGroupMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
diff --git a/plugins/Clist_nicer/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/CLUIFrames/movetogroup.cpp index 5bb1218408..89bc2a42e4 100644 --- a/plugins/Clist_nicer/CLUIFrames/movetogroup.cpp +++ b/plugins/Clist_nicer/CLUIFrames/movetogroup.cpp @@ -23,7 +23,7 @@ static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam) if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0))
mi.flags=CMIF_CHECKED;
}
- hFloatingItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hFloatingItem = Menu_AddContactMenuItem(&mi);
}
else if (!bSetting && hFloatingItem)
{
diff --git a/plugins/Clist_nicer/SRC/clistmenus.cpp b/plugins/Clist_nicer/SRC/clistmenus.cpp index 074bbcf355..bd28435954 100644 --- a/plugins/Clist_nicer/SRC/clistmenus.cpp +++ b/plugins/Clist_nicer/SRC/clistmenus.cpp @@ -478,7 +478,7 @@ int InitCustomMenus(void) mi.pszPopupName = ( char* )-1;
mi.pszService = "CList/SetContactIgnore";
mi.pszName = LPGEN("&Contact list settings...");
- hIgnoreItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hIgnoreItem = Menu_AddContactMenuItem(&mi);
}
}
hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
diff --git a/plugins/Console/Console.c b/plugins/Console/Console.c index 9d4567da11..7692260239 100644 --- a/plugins/Console/Console.c +++ b/plugins/Console/Console.c @@ -1384,7 +1384,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) mi.position=1000000000;
mi.ptszName=(IsWindowVisible(hwndConsole))?TranslateT("Hide Console"):TranslateT("Show Console");
mi.pszService=MS_CONSOLE_SHOW_HIDE;
- hMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ hMenu = Menu_AddMainMenuItem(&mi);
OnFontChange(0,0);
OnColourChange(0,0);
diff --git a/plugins/ContactsPlus/main.cpp b/plugins/ContactsPlus/main.cpp index b1fa14744e..b8b86731c0 100644 --- a/plugins/ContactsPlus/main.cpp +++ b/plugins/ContactsPlus/main.cpp @@ -200,8 +200,8 @@ static int HookModulesLoaded(WPARAM wParam, LPARAM lParam) mi.flags |= CMIF_UNICODE;
mi.pszService = MS_CONTACTS_SEND;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS));
+ hContactMenuItem = Menu_AddContactMenuItem(&mi);
- hContactMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
hHookPreBuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, HookPreBuildContactMenu);
ghSendWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); // no need to destroy this
diff --git a/plugins/CyrTranslit/MirandaContact.cpp b/plugins/CyrTranslit/MirandaContact.cpp index 0906db3769..1a0f149ef8 100644 --- a/plugins/CyrTranslit/MirandaContact.cpp +++ b/plugins/CyrTranslit/MirandaContact.cpp @@ -120,11 +120,7 @@ void MirandaContact::generateMenuItemsForAllContacts() {
CLISTMENUITEM mi;
fillInMenuItem(mi);
-
- int hItem = CallService(
- MS_CLIST_ADDCONTACTMENUITEM, 0, reinterpret_cast<LPARAM>(&mi));
-
- hTransliterateCmdMenuItem = reinterpret_cast<HANDLE>(hItem);
+ hTransliterateCmdMenuItem = Menu_AddContactMenuItem(&mi);
}
//------------------------------------------------------------------------------
diff --git a/plugins/CyrTranslit/main.cpp b/plugins/CyrTranslit/main.cpp index dc675ff654..4d07deb714 100644 --- a/plugins/CyrTranslit/main.cpp +++ b/plugins/CyrTranslit/main.cpp @@ -20,21 +20,21 @@ #include "plugin.h"
#include "MirandaContact.h"
-
HINSTANCE hInst;
PLUGINLINK *pluginLink;
struct UTF8_INTERFACE utfi;
struct MM_INTERFACE mmi;
+int hLangpack = 0;
PLUGININFOEX pluginInfoEx={
sizeof(PLUGININFOEX),
- PLG_SHORTNAME,
+ PLG_SHORTNAME,
PLG_VERSION,
PLG_DESCRIPTION,
- PLG_AUTHOR,
- PLG_AUTHOREMAIL,
- PLG_COPYRIGHT,
- PLG_HOMEPAGE,
+ PLG_AUTHOR,
+ PLG_AUTHOREMAIL,
+ PLG_COPYRIGHT,
+ PLG_HOMEPAGE,
PLG_FLAGS,
PLG_REPLACESDEFMODULE,
MIID_V_CYRTRANSLIT,
@@ -59,32 +59,22 @@ static const MUUID interfaces[] = {MIID_V_CYRTRANSLIT, MIID_LAST}; extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
- //#if defined (_UNICODE)
- pluginInfoEx.flags = 1; // dynamic UNICODE_AWARE
- //#endif
return interfaces;
}
-
//------------------------------------------------------------------------------
extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
{
//system inits:
pluginLink = link;
-
- memset(&utfi, 0, sizeof(utfi));
mir_getUTFI(&utfi);
-
- memset(&mmi, 0, sizeof(mmi));
mir_getMMI(&mmi);
-
+ mir_getLP(&pluginInfoEx);
//plugin inits: PLACE IT ONLY AFTER THIS LINE
- CyrTranslit::MirandaContact::initialize();
-
-
+ CyrTranslit::MirandaContact::initialize();
return 0;
}
diff --git a/plugins/CyrTranslit/plugin.h b/plugins/CyrTranslit/plugin.h index fd76b71391..48310a1a3a 100644 --- a/plugins/CyrTranslit/plugin.h +++ b/plugins/CyrTranslit/plugin.h @@ -41,7 +41,7 @@ #include "m_protosvc.h"
#include "m_system.h"
#include "m_clist.h"
-
+#include "m_langpack.h"
/****** PLUGIN DEFINES *******************************************************/
diff --git a/plugins/Db_autobackups/main.c b/plugins/Db_autobackups/main.c index c7183820c3..e90f08b0c8 100644 --- a/plugins/Db_autobackups/main.c +++ b/plugins/Db_autobackups/main.c @@ -86,22 +86,22 @@ static void IcoLibInit(void) static void MenuInit(void)
{
- CLISTMENUITEM menu = {0};
- menu.cbSize = sizeof(menu);
- menu.flags = CMIF_TCHAR;
- menu.hIcon=(HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"backup");
- menu.ptszPopupName = LPGENT("Database");
-
- menu.ptszName = LPGENT("Backup Profile");
- menu.pszService = MS_AB_BACKUP;
- menu.position = 500100000;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
-
- menu.hIcon=(HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"saveas");
- menu.ptszName = LPGENT("Save Profile As...");
- menu.pszService = MS_AB_SAVEAS;
- menu.position = 500100001;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(mi);
+ mi.flags = CMIF_TCHAR;
+ mi.hIcon=(HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"backup");
+ mi.ptszPopupName = LPGENT("Database");
+
+ mi.ptszName = LPGENT("Backup Profile");
+ mi.pszService = MS_AB_BACKUP;
+ mi.position = 500100000;
+ Menu_AddMainMenuItem(&mi);
+
+ mi.hIcon=(HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"saveas");
+ mi.ptszName = LPGENT("Save Profile As...");
+ mi.pszService = MS_AB_SAVEAS;
+ mi.position = 500100001;
+ Menu_AddMainMenuItem(&mi);
}
static void TriggerActionInit(void)
diff --git a/plugins/Dbx_mmap_SA/Import_SA/main.c b/plugins/Dbx_mmap_SA/Import_SA/main.c index 87a3a76b0b..f6fd4bc67a 100644 --- a/plugins/Dbx_mmap_SA/Import_SA/main.c +++ b/plugins/Dbx_mmap_SA/Import_SA/main.c @@ -143,7 +143,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) mi.pszName = LPGEN("&Import...");
mi.position = 500050000;
mi.pszService = IMPORT_SERVICE;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
}
hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
hHookOnExit = HookEvent(ME_SYSTEM_OKTOEXIT, OnExit);
diff --git a/plugins/Dbx_mmap_SA/dialogs.c b/plugins/Dbx_mmap_SA/dialogs.c index 15405ff5ee..eda06729d6 100644 --- a/plugins/Dbx_mmap_SA/dialogs.c +++ b/plugins/Dbx_mmap_SA/dialogs.c @@ -126,7 +126,7 @@ static int ModulesLoad(WPARAM wParam, LPARAM lParam) menu.pszService = MS_DB_CHANGEPASSWORD;
menu.position = 500100000;
- hSetPwdMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+ hSetPwdMenu = Menu_AddMainMenuItem(&menu);
ZeroMemory(&menu,sizeof(menu));
menu.cbSize = sizeof(menu);
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 8df1bcf648..77711caee3 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -375,7 +375,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK * link) mi.position = 1900000000;
mi.pszName = LPGEN("&Favourite Contacts...");
mi.pszService = MS_FAVCONTACTS_SHOWMENU;
- CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi );
+ Menu_AddMainMenuItem(&mi);
#endif
return 0;
diff --git a/plugins/FloatingContacts/main.cpp b/plugins/FloatingContacts/main.cpp index 17c2c238e1..e8b47a684c 100644 --- a/plugins/FloatingContacts/main.cpp +++ b/plugins/FloatingContacts/main.cpp @@ -1079,7 +1079,7 @@ static void LoadMenus() mi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( IDI_HIDE ) );
mi.ptszName = _T("Remove thumb");
mi.pszService = sModule "/RemoveThumb";
- hMenuItemRemove = (HANDLE)CallService( MS_CLIST_ADDCONTACTMENUITEM, 0, ( LPARAM )&mi );
+ hMenuItemRemove = Menu_AddContactMenuItem(&mi);
// Hide all thumbs main menu item
hMainHideAllThumbs = CreateServiceFunction( sModule "/MainHideAllThumbs", OnMainMenu_HideAll );
@@ -1091,7 +1091,7 @@ static void LoadMenus() mi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE ) );
mi.ptszName = fcOpt.bHideAll ? _T("Show all thumbs") : _T("Hide all thumbs");
mi.pszService = sModule "/MainHideAllThumbs";
- hMainMenuItemHideAll = (HANDLE)CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi );
+ Menu_AddMainMenuItem(&mi);
if (ServiceExists(MS_HOTKEY_REGISTER)) {
HOTKEYDESC hkd = {0};
diff --git a/plugins/Folders/folders.cpp b/plugins/Folders/folders.cpp index 7967aae009..c7e51d486f 100644 --- a/plugins/Folders/folders.cpp +++ b/plugins/Folders/folders.cpp @@ -194,7 +194,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) mi.hIcon=0;
mi.pszName=Translate("Test folders");
mi.pszService=MS_FOLDERS_TEST_PLUGIN;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
#endif
#if _MSC_VER >= 1300
Log("%s", "Hooking events ...");
diff --git a/plugins/Gender/commonheaders.h b/plugins/Gender/commonheaders.h index dd81cada93..e2add20d25 100644 --- a/plugins/Gender/commonheaders.h +++ b/plugins/Gender/commonheaders.h @@ -26,6 +26,7 @@ #ifndef COMMHEADERS_H
#define COMMHEADERS_H
+#define _CRT_SECURE_NO_WARNINGS
#define MIRANDA_VER 0x0A00
#include <stdio.h> //needed by m_utils.h
diff --git a/plugins/Gender/main.cpp b/plugins/Gender/main.cpp index fb66488c48..a95d5593c9 100644 --- a/plugins/Gender/main.cpp +++ b/plugins/Gender/main.cpp @@ -315,7 +315,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) // Adding menu items, submenu even if clist supports that
if (bContactMenuItems)
{
- if(ServiceExists(MS_CLIST_ADDSUBGROUPMENUITEM))
+ if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP))
{
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(CLISTMENUITEM);
@@ -325,7 +325,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) mi.position = 203;
mi.ptszName = LPGENT("Set Gender");
mi.pszService = NULL;
- hContactMenu = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
+ hContactMenu = Menu_AddContactMenuItem(&mi);
mi.flags = CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.position = 1001;
@@ -334,46 +334,42 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) mi.ptszName = LPGENT("Male");
mi.icolibItem = g_hIconMale;
mi.pszService = "Gender/MenuItemSetMale";
- hContactMenuMale = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
+ hContactMenuMale = Menu_AddContactMenuItem(&mi);
mi.ptszName = LPGENT("Female");
mi.icolibItem = g_hIconFemale;
mi.pszService = "Gender/MenuItemSetFemale";
- hContactMenuFemale = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
+ hContactMenuFemale = Menu_AddContactMenuItem(&mi);
mi.ptszName = LPGENT("Undefined");
mi.hIcon = NULL;
mi.pszService = "Gender/MenuItemSetUndef";
- hContactMenuNotDef = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
+ hContactMenuNotDef = Menu_AddContactMenuItem(&mi);
}
else
{
- CLISTMENUITEM mimale = {0};
- mimale.cbSize = sizeof(CLISTMENUITEM);
- mimale.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mimale.position = 1001;
- mimale.ptszName = LPGENT("Set Male");
- mimale.icolibItem = g_hIconMale;
- mimale.pszService = "Gender/MenuItemSetMale";
- hContactMenuMale = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mimale);
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(CLISTMENUITEM);
+ mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
+ mi.position = 1001;
+ mi.ptszName = LPGENT("Set Male");
+ mi.icolibItem = g_hIconMale;
+ mi.pszService = "Gender/MenuItemSetMale";
+ hContactMenuMale = Menu_AddContactMenuItem(&mi);
- CLISTMENUITEM mifemale = {0};
- mifemale.cbSize = sizeof(CLISTMENUITEM);
- mifemale.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mifemale.position = 1002;
- mifemale.ptszName = LPGENT("Set Female");
- mifemale.icolibItem = g_hIconFemale;
- mifemale.pszService = "Gender/MenuItemSetFemale";
- hContactMenuFemale = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mifemale);
+ mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
+ mi.position = 1002;
+ mi.ptszName = LPGENT("Set Female");
+ mi.icolibItem = g_hIconFemale;
+ mi.pszService = "Gender/MenuItemSetFemale";
+ hContactMenuFemale = Menu_AddContactMenuItem(&mi);
- CLISTMENUITEM miundef = {0};
- miundef.cbSize = sizeof(CLISTMENUITEM);
- miundef.flags = CMIF_TCHAR;
- miundef.position = 1003;
- miundef.ptszName = LPGENT("Set Undefined");
- miundef.pszService = "Gender/MenuItemSetUndef";
- miundef.hIcon = NULL;
- hContactMenuNotDef = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &miundef);
+ mi.flags = CMIF_TCHAR;
+ mi.position = 1003;
+ mi.ptszName = LPGENT("Set Undefined");
+ mi.pszService = "Gender/MenuItemSetUndef";
+ mi.hIcon = NULL;
+ hContactMenuNotDef = Menu_AddContactMenuItem(&mi);
}
}
diff --git a/plugins/HistoryLinkListPlus/linklist.c b/plugins/HistoryLinkListPlus/linklist.c index f41ce4de97..d6e3462d7f 100644 --- a/plugins/HistoryLinkListPlus/linklist.c +++ b/plugins/HistoryLinkListPlus/linklist.c @@ -120,7 +120,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) linklistmenuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON));
linklistmenuitem.ptszName = LPGENT("&Create Linklist");
linklistmenuitem.pszService = "Linklist/MenuCommand";
- CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&linklistmenuitem);
+ Menu_AddContactMenuItem(&linklistmenuitem);
hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
diff --git a/plugins/Import/main.c b/plugins/Import/main.c index 6777702db0..36589b486e 100644 --- a/plugins/Import/main.c +++ b/plugins/Import/main.c @@ -145,7 +145,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) mi.pszName = LPGEN("&Import...");
mi.position = 500050000;
mi.pszService = IMPORT_SERVICE;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
}
hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
hHookOnExit = HookEvent(ME_SYSTEM_OKTOEXIT, OnExit);
diff --git a/plugins/LangMan/main.cpp b/plugins/LangMan/main.cpp index cc023a91fa..a1e9b1bd3f 100644 --- a/plugins/LangMan/main.cpp +++ b/plugins/LangMan/main.cpp @@ -143,7 +143,7 @@ __declspec(dllexport) int Load(PLUGINLINK *link) mi.icolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RELOAD));
mi.pszName = LPGEN("Reload langpack");
mi.pszService = MS_LANGPACK_RELOAD;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
/* installation */
InstallFile(_T("LangMan-Readme.txt"), _T("Docs\\"));
diff --git a/plugins/ListeningTo/listeningto.cpp b/plugins/ListeningTo/listeningto.cpp index f5fbfd6d20..0dfb23d68b 100644 --- a/plugins/ListeningTo/listeningto.cpp +++ b/plugins/ListeningTo/listeningto.cpp @@ -60,7 +60,7 @@ static std::vector<HANDLE> hHooks; static std::vector<HANDLE> hServices;
static HANDLE hEnableStateChangedEvent;
HANDLE hExtraIcon, hIcon1, hIcon2;
-static HANDLE hMainMenuGroup = NULL;
+static HGENMENU hMainMenuGroup = NULL;
static HANDLE hListeningInfoChangedEvent = NULL;
static HANDLE hTTB = NULL;
@@ -237,7 +237,7 @@ void RebuildMenu() | (ListeningToEnabled(info->proto, TRUE) ? CMIF_CHECKED : 0)
| (opts.enable_sending ? 0 : CMIF_GRAYED);
- info->hMenu = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ info->hMenu = Menu_AddMainMenuItem(&mi);
}
UpdateGlobalStatusMenus();
@@ -367,12 +367,11 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.pszName = "Listening to";
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB;
mi.icolibItem = hIcon1;
-
- hMainMenuGroup = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
+ hMainMenuGroup = Menu_AddMainMenuItem(&mi);
IcoLib_ReleaseIcon(mi.hIcon);
- mi.pszPopupName = (char *) hMainMenuGroup;
+ mi.hParentMenu = hMainMenuGroup;
mi.popupPosition = 500080000;
mi.position = 0;
mi.pszService = MS_LISTENINGTO_MAINMENU;
@@ -384,7 +383,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) | (ListeningToEnabled(NULL, TRUE) ? CMIF_CHECKED : 0)
| (opts.enable_sending ? 0 : CMIF_GRAYED);
proto_itens.resize(1);
- proto_itens[0].hMenu = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ proto_itens[0].hMenu = Menu_AddMainMenuItem(&mi);
proto_itens[0].proto[0] = 0;
proto_itens[0].account[0] = 0;
proto_itens[0].old_xstatus = 0;
diff --git a/plugins/MenuItemEx/main.c b/plugins/MenuItemEx/main.c index 6bce1486b3..537d277262 100644 --- a/plugins/MenuItemEx/main.c +++ b/plugins/MenuItemEx/main.c @@ -39,7 +39,7 @@ struct { TCHAR *fullName;
char flag;
}
-static const statusMsg[]={
+static const statusMsg[] = {
{ "CList", "StatusMsg", LPGENT("Status message"), 1 },
{ 0, "XStatusName", LPGENT("XStatus title"), 4 },
{ 0, "XStatusMsg", LPGENT("XStatus message"), 2 },
@@ -124,9 +124,9 @@ int GetSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBV {
DBCONTACTGETSETTING cgs;
- cgs.szModule=szModule;
- cgs.szSetting=szSetting;
- cgs.pValue=dbv;
+ cgs.szModule = szModule;
+ cgs.szSetting = szSetting;
+ cgs.pValue = dbv;
dbv->type = 0;
return CallService(MS_DB_CONTACT_GETSETTING_STR,(WPARAM)hContact,(LPARAM)&cgs);
@@ -290,7 +290,7 @@ BOOL DirectoryExists(HANDLE hContact) char path[MAX_PATH];
CallService(MS_FILE_GETRECEIVEDFILESFOLDER, (WPARAM)hContact, (LPARAM)&path);
attr = GetFileAttributesA(path);
- return (attr!=-1) && (attr&FILE_ATTRIBUTE_DIRECTORY);
+ return (attr != -1) && (attr&FILE_ATTRIBUTE_DIRECTORY);
}
void CopyToClipboard(HWND hwnd,LPSTR pszMsg, LPTSTR ptszMsg)
@@ -360,14 +360,14 @@ void GetID(HANDLE hContact,LPSTR szProto,LPSTR szID) if ( uID == (LPSTR)CALLSERVICE_NOTFOUND )
uID = NULL;
- *szID='\0';
+ *szID = '\0';
- if ( uID && DBGetContactSetting(hContact, szProto, uID ,&dbv_uniqueid)==0 ) {
- if (dbv_uniqueid.type ==DBVT_DWORD)
+ if ( uID && DBGetContactSetting(hContact, szProto, uID ,&dbv_uniqueid) == 0 ) {
+ if (dbv_uniqueid.type == DBVT_DWORD)
wsprintfA(szID, "%u", dbv_uniqueid.dVal);
- else if (dbv_uniqueid.type ==DBVT_WORD)
+ else if (dbv_uniqueid.type == DBVT_WORD)
wsprintfA(szID, "%u", dbv_uniqueid.wVal);
- else if (dbv_uniqueid.type ==DBVT_BLOB)
+ else if (dbv_uniqueid.type == DBVT_BLOB)
wsprintfA(szID, "%s", dbv_uniqueid.cpbVal);
else
wsprintfA(szID, "%s", dbv_uniqueid.pszVal);
@@ -380,7 +380,7 @@ int StatusMsgExists(HANDLE hContact) {
LPSTR module,msg;
char par[32];
- BOOL ret=0;
+ BOOL ret = 0;
int i;
module = (LPSTR) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -413,13 +413,13 @@ BOOL IPExists(HANDLE hContact) mIP = DBGetContactSettingDword(hContact, szProto, "IP", 0);
rIP = DBGetContactSettingDword(hContact, szProto, "RealIP", 0);
- return (mIP!=0 || rIP!=0);
+ return (mIP != 0 || rIP != 0);
}
BOOL MirVerExists(HANDLE hContact)
{
LPSTR szProto, msg;
- BOOL ret=0;
+ BOOL ret = 0;
szProto = (LPSTR) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (!szProto) return 0;
@@ -435,8 +435,8 @@ BOOL MirVerExists(HANDLE hContact) void getIP(HANDLE hContact,LPSTR szProto,LPSTR szIP)
{
- char szmIP[64]={0};
- char szrIP[64]={0};
+ char szmIP[64] = {0};
+ char szrIP[64] = {0};
DWORD mIP = DBGetContactSettingDword(hContact, szProto, "IP", 0);
DWORD rIP = DBGetContactSettingDword(hContact, szProto, "RealIP", 0);
if ( mIP ) wsprintfA(szmIP, "External IP: %d.%d.%d.%d\r\n", mIP>>24,(mIP>>16)&0xFF,(mIP>>8)&0xFF,mIP&0xFF);
@@ -492,7 +492,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) OldAuthReqEditProc = SetWindowLongPtr(GetDlgItem(hdlg, IDC_REASON), GWLP_WNDPROC, (LONG_PTR)AuthReqEditSubclassProc);
SendDlgItemMessage(hdlg, IDC_REASON, EM_LIMITTEXT, (WPARAM)255, 0);
SetDlgItemText(hdlg, IDC_REASON, TranslateT("Please authorize me to add you to my contact list."));
- hcontact=(HANDLE)lparam;
+ hcontact = (HANDLE)lparam;
break;
case WM_COMMAND:
@@ -530,15 +530,15 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) BOOL isVisSupport(HANDLE hContact)
{
- char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if(szProto==NULL) return 0;
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ if(szProto == NULL) return 0;
return CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0)&PF1_INVISLIST;
}
BOOL isInvSupport(HANDLE hContact)
{
- char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if(szProto==NULL) return 0;
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ if(szProto == NULL) return 0;
return CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0)&PF1_VISLIST;
}
@@ -559,9 +559,9 @@ INT_PTR onSendAuthRequest(WPARAM wparam,LPARAM lparam) DWORD flags;
char *szProto;
- szProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0);
+ szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0);
- flags=CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_4,0);
+ flags = CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_4,0);
if (flags&PF4_NOCUSTOMAUTH)
CallContactService((HANDLE)wparam,PSS_AUTHREQUEST,0, (LPARAM)"");
else
@@ -579,14 +579,14 @@ INT_PTR onSendAdded(WPARAM wparam,LPARAM lparam) // set the invisible-flag in db
INT_PTR onSetInvis(WPARAM wparam,LPARAM lparam)
{
- CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(DBGetContactSettingWord((HANDLE)wparam,(const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0),"ApparentMode",0)==ID_STATUS_OFFLINE)?0:ID_STATUS_OFFLINE,0);
+ CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(DBGetContactSettingWord((HANDLE)wparam,(const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0),"ApparentMode",0) == ID_STATUS_OFFLINE)?0:ID_STATUS_OFFLINE,0);
return 0;
}
// set visible-flag in db
INT_PTR onSetVis(WPARAM wparam,LPARAM lparam)
{
- CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(DBGetContactSettingWord((HANDLE)wparam,(const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0),"ApparentMode",0)==ID_STATUS_ONLINE)?0:ID_STATUS_ONLINE,0);
+ CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(DBGetContactSettingWord((HANDLE)wparam,(const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0),"ApparentMode",0) == ID_STATUS_ONLINE)?0:ID_STATUS_ONLINE,0);
return 0;
}
@@ -599,7 +599,7 @@ INT_PTR onHide(WPARAM wparam,LPARAM lparam) void ShowItem(CLISTMENUITEM *cli, HANDLE hmenu)
{
- cli->flags=CMIM_FLAGS | CMIF_TCHAR;
+ cli->flags = CMIM_FLAGS | CMIF_TCHAR;
CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenu,(LPARAM)cli);
}
@@ -682,7 +682,7 @@ void ModifyCopyID(CLISTMENUITEM *cli, HANDLE hContact, BOOL bShowID, BOOL bTrimI cli->ptszName = _T("Copy ID");
}
else {
- cli->flags=CMIM_FLAGS|CMIF_HIDDEN;
+ cli->flags = CMIM_FLAGS|CMIF_HIDDEN;
}
CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hmenuCopyID,(LPARAM)cli);
DestroyIcon(hIconCID);
@@ -737,7 +737,7 @@ void ModifyCopyMirVer(CLISTMENUITEM *cli,HANDLE hContact) {
LPSTR msg;
cli->flags|=CMIM_ICON;
- cli->hIcon=NULL;
+ cli->hIcon = NULL;
if(ServiceExists(MS_FP_GETCLIENTICON)) {
msg = getMirVer(hContact);
if(msg) {
@@ -793,12 +793,12 @@ INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) char par[32];
TCHAR buffer[2048];
int i;
- DWORD flags=DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default);
+ DWORD flags = DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default);
module = (LPSTR) CallService(MS_PROTO_GETCONTACTBASEPROTO, wparam, 0);
if (!module) return 0;
- buffer[0]=0;
+ buffer[0] = 0;
for(i = 0; i < SIZEOF(statusMsg); i++) {
if (statusMsg[i].flag & 8)
mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name);
@@ -929,27 +929,27 @@ INT_PTR onIgnore(WPARAM wparam,LPARAM lparam) static HANDLE AddSubmenuItem(HANDLE hRoot, TCHAR* name, HICON icon, DWORD flag, char* service, int pos, int param)
{
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
- mi.hParentMenu = hRoot;
- mi.pszPopupName = (char*)hRoot; // for Miranda 0.7
- mi.popupPosition = param;
- mi.position = pos;
- mi.ptszName = name;
- mi.hIcon = icon;
- mi.flags = CMIF_TCHAR | CMIF_CHILDPOPUP;
+ CLISTMENUITEM mi = { 0 };
+ mi.cbSize = sizeof(mi);
+ mi.hParentMenu = hRoot;
+ mi.pszPopupName = (char*)hRoot; // for Miranda 0.7
+ mi.popupPosition = param;
+ mi.position = pos;
+ mi.ptszName = name;
+ mi.hIcon = icon;
+ mi.flags = CMIF_TCHAR | CMIF_CHILDPOPUP;
if (flag)
mi.flags |= flag;
- mi.pszService = service;
- return ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, param, (LPARAM)&mi);
+ mi.pszService = service;
+ return Menu_AddContactMenuItem(&mi);
}
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 = { 0 };
+ mi.cbSize = sizeof(mi);
+ mi.ptszName = name;
+ mi.flags = CMIM_FLAGS | CMIF_TCHAR;
if ( checked )
mi.flags |= CMIF_CHECKED;
if ( hidden )
@@ -960,8 +960,8 @@ static void ModifySubmenuItem(HANDLE hItem, TCHAR* name, int checked, int hidden // called when the contact-menu is built
int BuildMenu(WPARAM wparam,LPARAM lparam)
{
- CLISTMENUITEM miAV={0},miNV,miHFL,miIGN,miPROTO,miADD,miREQ,miCID,miRECV,miSTAT,miCIP,miCMV;
- DWORD flags=DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default);
+ CLISTMENUITEM miAV = {0},miNV,miHFL,miIGN,miPROTO,miADD,miREQ,miCID,miRECV,miSTAT,miCIP,miCMV;
+ DWORD flags = DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default);
int i = 0, j = 0, check = 0, all = 0, hide = 0;
BOOL bIsOnline = FALSE, bShowAll = CTRL_IS_PRESSED;
PROTOACCOUNT* pa;
@@ -972,11 +972,11 @@ int BuildMenu(WPARAM wparam,LPARAM lparam) bIsOnline = isProtoOnline(pszProto);
- miAV.cbSize=sizeof(CLISTMENUITEM);
- miAV.flags=CMIM_FLAGS | CMIF_TCHAR;
- miAV.hIcon=NULL;
- miAV.pszContactOwner=NULL;
- miNV=miHFL=miIGN=miPROTO=miADD=miREQ=miCID=miRECV=miSTAT=miCIP=miCMV=miAV;
+ miAV.cbSize = sizeof(CLISTMENUITEM);
+ miAV.flags = CMIM_FLAGS | CMIF_TCHAR;
+ miAV.hIcon = NULL;
+ miAV.pszContactOwner = NULL;
+ miNV = miHFL = miIGN = miPROTO = miADD = miREQ = miCID = miRECV = miSTAT = miCIP = miCMV = miAV;
if(bShowAll || flags&VF_VS) {
ShowItem(&miAV,hmenuVis);
@@ -1078,10 +1078,10 @@ int BuildMenu(WPARAM wparam,LPARAM lparam) if(bShowAll || (flags&VF_VS))
{
- int apparent=DBGetContactSettingWord((HANDLE)wparam,(const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0),"ApparentMode",0);
- if(isVisSupport((HANDLE)wparam)) ModifyVisibleSet(&miAV,apparent==ID_STATUS_ONLINE,flags&VF_SAI);
+ int apparent = DBGetContactSettingWord((HANDLE)wparam,(const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wparam,0),"ApparentMode",0);
+ if(isVisSupport((HANDLE)wparam)) ModifyVisibleSet(&miAV,apparent == ID_STATUS_ONLINE,flags&VF_SAI);
else HideItem(&miAV,hmenuVis);
- if(isInvSupport((HANDLE)wparam)) ModifyInvisSet(&miNV,apparent==ID_STATUS_OFFLINE,flags&VF_SAI);
+ if(isInvSupport((HANDLE)wparam)) ModifyInvisSet(&miNV,apparent == ID_STATUS_OFFLINE,flags&VF_SAI);
else HideItem(&miAV,hmenuOff);
}
return 0;
@@ -1117,7 +1117,7 @@ int EnumProtoSubmenu(WPARAM wparam, LPARAM lparam) // Tabsrmm toolbar support
static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam)
{
- CustomButtonClickData *cbcd=(CustomButtonClickData *)lParam;
+ CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
if (!strcmp(cbcd->pszModule, MODULENAME) && cbcd->dwButtonId == 0)
onRecvFiles(wParam, 0);
@@ -1229,8 +1229,8 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) IconsInit();
- bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT)!=0;
- bMir_08 = ServiceExists(MS_PROTO_GETACCOUNT)!=0;
+ bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0;
+ bMir_08 = ServiceExists(MS_PROTO_GETACCOUNT) != 0;
hServices[0] = CreateServiceFunction(MS_SETINVIS,onSetInvis);
hServices[1] = CreateServiceFunction(MS_SETVIS,onSetVis);
@@ -1246,40 +1246,39 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hServices[10] = CreateServiceFunction(MS_COPYIP,onCopyIP);
hServices[11] = CreateServiceFunction(MS_COPYMIRVER,onCopyMirVer);
- mi.cbSize=sizeof(CLISTMENUITEM);
+ mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIF_TCHAR;
- mi.hIcon=NULL;
- mi.pszContactOwner=NULL;
+ mi.hIcon = NULL;
+ mi.pszContactOwner = NULL;
- mi.position=120000;
- mi.ptszName=LPGENT("Always visible");
- mi.pszService=MS_SETVIS;
- hmenuVis=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.position = 120000;
+ mi.ptszName = LPGENT("Always visible");
+ mi.pszService = MS_SETVIS;
+ hmenuVis = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=LPGENT("Never visible");
- mi.pszService=MS_SETINVIS;
- hmenuOff=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Never visible");
+ mi.pszService = MS_SETINVIS;
+ hmenuOff = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=NULL;
- mi.pszService=MS_HIDE;
- hmenuHide=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = NULL;
+ mi.pszService = MS_HIDE;
+ hmenuHide = Menu_AddContactMenuItem(&mi);
mi.position++;
mi.pszPopupName = (char*)-1; // for Miranda 0.7
- mi.ptszName=LPGENT("Ignore");
+ mi.ptszName = LPGENT("Ignore");
mi.pszService = 0;
mi.flags |= CMIF_ROOTHANDLE;
- mi.hIcon=(HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_ignore" );
- hmenuIgnore=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.hIcon = (HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_ignore" );
+ hmenuIgnore = Menu_AddContactMenuItem(&mi);
hIgnoreItem[0] = AddSubmenuItem(hmenuIgnore, ii[0].name, LoadSkinnedIcon(ii[0].icon), 0, MS_IGNORE, pos, ii[0].type );
pos += 100000; // insert separator
for (i = 1; i < SIZEOF(ii); i++)
- {
hIgnoreItem[i] = AddSubmenuItem(hmenuIgnore, ii[i].name, LoadSkinnedIcon(ii[i].icon), 0, MS_IGNORE, pos++, ii[i].type );
- }
+
pos += 100000; // insert separator
ood.cbSize = sizeof(ood);
ood.pszGroup = "Events";
@@ -1287,13 +1286,12 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), (HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_ignore"), 0, MS_OPT_OPENOPTIONS, pos, (int)&ood );
mi.pszPopupName = 0;
- if (bMir_08)
- {
+ if (bMir_08) {
mi.position++;
- mi.ptszName=LPGENT("Copy to Account");
- mi.pszService=MS_PROTO;
- mi.hIcon=( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_protocol");
- hmenuProto=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Copy to Account");
+ mi.pszService = MS_PROTO;
+ mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_protocol");
+ hmenuProto = Menu_AddContactMenuItem(&mi);
EnumProtoSubmenu(0, 0);
}
@@ -1301,43 +1299,43 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) mi.flags = CMIF_TCHAR;
mi.position++;
- mi.ptszName=LPGENT("Send 'You were added'");
- mi.pszService=MS_ADDED;
- mi.hIcon=( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_added");
- hmenuAdded=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Send 'You were added'");
+ mi.pszService = MS_ADDED;
+ mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_added");
+ hmenuAdded = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=LPGENT("Request authorization");
- mi.pszService=MS_AUTHREQ;
- mi.hIcon=( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_authorization");
- hmenuAuthReq=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Request authorization");
+ mi.pszService = MS_AUTHREQ;
+ mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_authorization");
+ hmenuAuthReq = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=LPGENT("Copy ID");
- mi.pszService=MS_COPYID;
- hmenuCopyID=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Copy ID");
+ mi.pszService = MS_COPYID;
+ hmenuCopyID = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=LPGENT("Browse Received Files");
- mi.pszService=MS_RECVFILES;
- mi.hIcon=( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_recfiles");
- hmenuRecvFiles=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Browse Received Files");
+ mi.pszService = MS_RECVFILES;
+ mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_recfiles");
+ hmenuRecvFiles = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=LPGENT("Copy Status Message");
- mi.pszService=MS_STATUSMSG;
- mi.hIcon=NULL;//LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ICON5));
- hmenuStatusMsg=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Copy Status Message");
+ mi.pszService = MS_STATUSMSG;
+ mi.hIcon = NULL;//LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ICON5));
+ hmenuStatusMsg = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=LPGENT("Copy IP");
- mi.pszService=MS_COPYIP;
- hmenuCopyIP=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Copy IP");
+ mi.pszService = MS_COPYIP;
+ hmenuCopyIP = Menu_AddContactMenuItem(&mi);
mi.position++;
- mi.ptszName=LPGENT("Copy MirVer");
- mi.pszService=MS_COPYMIRVER;
- hmenuCopyMirVer=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ mi.ptszName = LPGENT("Copy MirVer");
+ mi.pszService = MS_COPYMIRVER;
+ hmenuCopyMirVer = Menu_AddContactMenuItem(&mi);
hIcon[0] = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_copymver");
hIcon[1] = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_vis");
@@ -1376,7 +1374,7 @@ __declspec(dllexport) MUUID* MirandaPluginInterfaces(void) { __declspec(dllexport)int Load(PLUGINLINK *link)
{
- pluginLink=link;
+ pluginLink = link;
mir_getMMI( &mmi );
mir_getLP(&pluginInfoEx);
hHooks[7] = HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
@@ -1404,6 +1402,6 @@ __declspec(dllexport)int Unload(void) BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved)
{
- hinstance=hinst;
+ hinstance = hinst;
return 1;
}
diff --git a/plugins/MetaContacts/addto.c b/plugins/MetaContacts/addto.c index 6b9721d504..b92e97b978 100644 --- a/plugins/MetaContacts/addto.c +++ b/plugins/MetaContacts/addto.c @@ -73,16 +73,16 @@ int FillList(HWND list, BOOL sort) // get contact display name from clist
char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hMetaUser, 0);
- if(os_unicode_enabled) {
+ if (os_unicode_enabled) {
wchar_t *swzCDN = (wchar_t *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hMetaUser, GCDNF_UNICODE),
*swzContactDisplayName;
// detect if the clist provided unicode display name by comparing with non-unicode
- if(szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0) {
+ if (szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0) {
swzContactDisplayName = swzCDN;
} else {
// no? convert to unicode
- if(szCDN) {
+ if (szCDN) {
swzContactDisplayName = (wchar_t *) _alloca(sizeof(wchar_t) * (strlen(szCDN) + 1));
MultiByteToWideChar(CP_ACP, 0, (char *) szCDN, -1, swzContactDisplayName, (int)strlen((char *)szCDN) + 1);
} else {
@@ -91,15 +91,15 @@ int FillList(HWND list, BOOL sort) }
// don't insert huge strings that we have to compare with later
- if(wcslen(swzContactDisplayName) > 1023)
+ if (wcslen(swzContactDisplayName) > 1023)
swzContactDisplayName[1024] = 0;
- if(sort) {
+ if (sort) {
int j;
wchar_t buff[1024];
- for(j = 0; j < i; j++) {
+ for (j = 0; j < i; j++) {
SendMessageW(list, LB_GETTEXT, j, (LPARAM)buff);
- if(wcscmp(buff, swzContactDisplayName) > 0) break;
+ if (wcscmp(buff, swzContactDisplayName) > 0) break;
}
index = SendMessageW(list, LB_INSERTSTRING, (WPARAM)j, (LPARAM)swzContactDisplayName);
} else {
@@ -107,15 +107,15 @@ int FillList(HWND list, BOOL sort) }
} else {
// don't insert huge strings that we have to compare with later
- if(strlen(szCDN) > 1023)
+ if (strlen(szCDN) > 1023)
szCDN[1024] = 0;
- if(sort) {
+ if (sort) {
int j;
char buff[1024];
- for(j = 0; j < i; j++) {
+ for (j = 0; j < i; j++) {
SendMessage(list, LB_GETTEXT, j, (LPARAM)buff);
- if(strcmp(buff, szCDN) > 0) break;
+ if (strcmp(buff, szCDN) > 0) break;
}
index = SendMessage(list, LB_INSERTSTRING, (WPARAM)j, (LPARAM)szCDN);
} else {
@@ -172,14 +172,14 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault( hwndDlg );
- if(DBGetContactSettingDword((HANDLE)lParam,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1)
+ if (DBGetContactSettingDword((HANDLE)lParam,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1)
{
MessageBox(hwndDlg,Translate("This contact is a MetaContact.\nYou can't add a MetaContact to another MetaContact.\n\nPlease choose another."),
Translate("MetaContact Conflict"),MB_ICONERROR);
DestroyWindow(hwndDlg);
return TRUE;
}
- if(DBGetContactSettingDword((HANDLE)lParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1)
+ if (DBGetContactSettingDword((HANDLE)lParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1)
{
MessageBox(hwndDlg,Translate("This contact is already associated to a MetaContact.\nYou cannot add a contact to multiple MetaContacts."),
Translate("Multiple MetaContacts"),MB_ICONERROR);
@@ -195,9 +195,9 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Initialize the graphical part
CheckDlgButton(hwndDlg,IDC_ONLYAVAIL,BST_CHECKED); // Initially checked; display all metacontacts is only an option
// Besides, we can check if there is at least one metacontact to add the contact to.
- if(BuildList(GetDlgItem(hwndDlg,IDC_METALIST), FALSE)<=0)
+ if (BuildList(GetDlgItem(hwndDlg,IDC_METALIST), FALSE)<=0)
{
- if(MessageBox(hwndDlg,Translate("Either there is no MetaContact in the database (in this case you should first convert a contact into one)\n"
+ if (MessageBox(hwndDlg,Translate("Either there is no MetaContact in the database (in this case you should first convert a contact into one)\n"
"or there is none that can host this contact.\n"
"Another solution could be to convert this contact into a new MetaContact.\n\nConvert this contact into a new MetaContact?"),
Translate("No suitable MetaContact found"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)==IDYES)
@@ -211,17 +211,17 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // get contact display name from clist
char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, 0);
- if(os_unicode_enabled) {
+ if (os_unicode_enabled) {
wchar_t *swzCDN = (wchar_t *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, GCDNF_UNICODE),
*swzContactDisplayName;
wchar_t buf[256];
// detect if the clist provided unicode display name by comparing with non-unicode
- if(szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0) {
+ if (szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0) {
swzContactDisplayName = swzCDN;
} else {
// no? convert to unicode
- if(szCDN) {
+ if (szCDN) {
swzContactDisplayName = (wchar_t *) _alloca(sizeof(wchar_t) * (strlen(szCDN) + 1));
MultiByteToWideChar(CP_ACP, 0, (char *) szCDN, -1, swzContactDisplayName, (int)strlen((char *)szCDN) + 1);
} else {
@@ -249,7 +249,7 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
}
case WM_COMMAND:
- if(HIWORD(wParam)!=BN_CLICKED)
+ if (HIWORD(wParam)!=BN_CLICKED)
break; // Only clicks of buttons are relevant, let other COMMANDs through
switch(LOWORD(wParam))
{
@@ -275,9 +275,9 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_CHK_SRT:
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_METALIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_METALIST), GWL_STYLE) ^ LBS_SORT);
- if(BuildList(GetDlgItem(hwndDlg,IDC_METALIST), IsDlgButtonChecked(hwndDlg, IDC_CHK_SRT) ? TRUE : FALSE)<=0)
+ if (BuildList(GetDlgItem(hwndDlg,IDC_METALIST), IsDlgButtonChecked(hwndDlg, IDC_CHK_SRT) ? TRUE : FALSE)<=0)
{
- if(MessageBox(hwndDlg,Translate("Either there is no MetaContact in the database (in this case you should first convert a contact into one)\n"
+ if (MessageBox(hwndDlg,Translate("Either there is no MetaContact in the database (in this case you should first convert a contact into one)\n"
"or there is none that can host this contact.\n"
"Another solution could be to convert this contact into a new MetaContact.\n\nConvert this contact into a new MetaContact?"),
Translate("No suitable MetaContact found"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)==IDYES)
diff --git a/plugins/MetaContacts/edit.c b/plugins/MetaContacts/edit.c index d5c422d71c..bc4d94ba8a 100644 --- a/plugins/MetaContacts/edit.c +++ b/plugins/MetaContacts/edit.c @@ -63,7 +63,7 @@ void FillContactList(HWND hWndDlg, CHANGES *chg) { LvItemW.mask=LVIF_TEXT; // Text Style
LvItemW.cchTextMax = 256; // Max size of test
- for(i = 0; i < chg->num_contacts; i++) {
+ for (i = 0; i < chg->num_contacts; i++) {
LvItem.iItem = i;
LvItemW.iItem = i;
@@ -71,18 +71,18 @@ void FillContactList(HWND hWndDlg, CHANGES *chg) { char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)chg->hContact[i], 0);
- if(os_unicode_enabled) {
+ if (os_unicode_enabled) {
wchar_t *swzCDN = (wchar_t *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)chg->hContact[i], GCDNF_UNICODE),
*swzContactDisplayName;
LvItemW.iSubItem = 0; // clist display name
// detect if the clist provided unicode display name by comparing with non-unicode
- if(szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0 && wcslen(swzCDN) >= strlen(szCDN)) {
+ if (szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0 && wcslen(swzCDN) >= strlen(szCDN)) {
swzContactDisplayName = swzCDN;
} else {
// no? convert to unicode
- if(szCDN) {
+ if (szCDN) {
swzContactDisplayName = (wchar_t *) _alloca(sizeof(wchar_t) * (strlen(szCDN) + 1));
MultiByteToWideChar(CP_ACP, 0, (char *) szCDN, -1, swzContactDisplayName, (int)strlen((char *)szCDN) + 1);
} else {
@@ -104,7 +104,7 @@ void FillContactList(HWND hWndDlg, CHANGES *chg) { LvItem.iSubItem = 1; // id
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)chg->hContact[i], 0);
- if(proto) {
+ if (proto) {
field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
DBGetContactSetting(chg->hContact[i],proto,field,&dbv);
@@ -176,31 +176,31 @@ void ApplyChanges(CHANGES *chg) int i;
// remove removed contacts
- for(i = 0; i < chg->num_deleted; i++) {
+ for (i = 0; i < chg->num_deleted; i++) {
Meta_Delete((WPARAM)chg->hDeletedContacts[i], 0);
- if(chg->hDeletedContacts[i] == chg->hDefaultContact)
+ if (chg->hDeletedContacts[i] == chg->hDefaultContact)
chg->hDefaultContact = 0;
- if(chg->hDeletedContacts[i] == chg->hOfflineContact)
+ if (chg->hDeletedContacts[i] == chg->hOfflineContact)
chg->hOfflineContact = 0;
}
// set contact positions
- for(i = 0; i < chg->num_contacts; i++) {
- if(Meta_GetContactNumber(chg->hContact[i]) != i)
+ for (i = 0; i < chg->num_contacts; i++) {
+ if (Meta_GetContactNumber(chg->hContact[i]) != i)
Meta_SwapContacts(chg->hMeta, Meta_GetContactNumber(chg->hContact[i]), i);
}
NotifyEventHooks(hSubcontactsChanged, (WPARAM)chg->hMeta, (LPARAM)chg->hDefaultContact);
// set default
- if(chg->hDefaultContact)
+ if (chg->hDefaultContact)
DBWriteContactSettingDword(chg->hMeta, META_PROTO, "Default", Meta_GetContactNumber(chg->hDefaultContact));
else
DBWriteContactSettingDword(chg->hMeta, META_PROTO, "Default", 0);
NotifyEventHooks(hEventDefaultChanged, (WPARAM)chg->hMeta, (LPARAM)chg->hDefaultContact);
// set offline
- if(chg->hOfflineContact)
+ if (chg->hOfflineContact)
DBWriteContactSettingDword(chg->hMeta, META_PROTO, "OfflineSend", Meta_GetContactNumber(chg->hOfflineContact));
else
DBWriteContactSettingDword(chg->hMeta, META_PROTO, "OfflineSend", (DWORD)-1);
@@ -214,7 +214,7 @@ void ApplyChanges(CHANGES *chg) // fix avatar
most_online = Meta_GetMostOnlineSupporting(chg->hMeta, PFLAGNUM_4, PF4_AVATARS);
- if(most_online) {
+ if (most_online) {
PROTO_AVATAR_INFORMATION AI;
AI.cbSize = sizeof(AI);
@@ -226,7 +226,7 @@ void ApplyChanges(CHANGES *chg) DBWriteContactSettingString(chg->hMeta, "ContactPhoto", "File",AI.filename);
}
- if(MetaAPI_GetForceState((WPARAM)chg->hMeta, 0) != chg->force_default)
+ if (MetaAPI_GetForceState((WPARAM)chg->hMeta, 0) != chg->force_default)
MetaAPI_ForceDefault((WPARAM)chg->hMeta, 0);
}
@@ -253,7 +253,7 @@ LRESULT ProcessCustomDraw (LPARAM lParam) lplvcd->clrTextBk = RGB(255,255,255);
}
*/
- if(changes.hContact[(int)lplvcd->nmcd.dwItemSpec] == changes.hDefaultContact) {
+ if (changes.hContact[(int)lplvcd->nmcd.dwItemSpec] == changes.hDefaultContact) {
lplvcd->clrText = RGB(255, 0, 0);
}
return CDRF_NEWFONT;
@@ -346,7 +346,7 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR changes.num_deleted = 0;
changes.hDefaultContact = Meta_GetContactHandle((HANDLE)lParam, default_contact_number);
changes.hOfflineContact = Meta_GetContactHandle((HANDLE)lParam, offline_contact_number);
- for(i = 0; i < nb_contacts; i++)
+ for (i = 0; i < nb_contacts; i++)
changes.hContact[i] = Meta_GetContactHandle((HANDLE)lParam, i);
changes.force_default = MetaAPI_GetForceState((WPARAM)lParam, 0);
@@ -361,16 +361,16 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR {
char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, 0);
- if(os_unicode_enabled) {
+ if (os_unicode_enabled) {
wchar_t *swzCDN = (wchar_t *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, GCDNF_UNICODE),
*swzContactDisplayName;
// detect if the clist provided unicode display name by comparing with non-unicode
- if(szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0 && wcslen(swzCDN) >= strlen(szCDN)) {
+ if (szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0 && wcslen(swzCDN) >= strlen(szCDN)) {
swzContactDisplayName = swzCDN;
} else {
// no? convert to unicode
- if(szCDN) {
+ if (szCDN) {
swzContactDisplayName = (wchar_t *) _alloca(sizeof(wchar_t) * (strlen(szCDN) + 1));
MultiByteToWideChar(CP_ACP, 0, (char *) szCDN, -1, swzContactDisplayName, (int)strlen((char *)szCDN) + 1);
} else {
@@ -419,9 +419,9 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch(LOWORD(wParam))
{
case IDC_VALIDATE: // Apply changes, if there is still one contact attached to the metacontact.
- if(changes.num_contacts == 0) // Otherwise, delete the metacontact.
+ if (changes.num_contacts == 0) // Otherwise, delete the metacontact.
{
- if(MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
+ if (MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)!=IDYES)
return TRUE;
else
@@ -437,11 +437,11 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),FALSE);
break;
case IDOK:
- if(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_VALIDATE)))
+ if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_VALIDATE)))
{ // If there are changes that could be made,
- if(changes.num_contacts == 0) // do the work that would have be done if
+ if (changes.num_contacts == 0) // do the work that would have be done if
{ // the button 'Apply' has been clicked.
- if(MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
+ if (MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)!=IDYES)
{
return TRUE;
@@ -494,8 +494,8 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected
changes.num_contacts--;
changes.hDeletedContacts[changes.num_deleted++] = changes.hContact[sel];
- if(changes.hDefaultContact == changes.hContact[sel]) {
- if(changes.num_contacts > 0) {
+ if (changes.hDefaultContact == changes.hContact[sel]) {
+ if (changes.num_contacts > 0) {
changes.hDefaultContact = changes.hContact[0];
str = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)changes.hDefaultContact, 0);
SetWindowText(GetDlgItem(hwndDlg,IDC_ED_DEFAULT),str);
@@ -506,7 +506,7 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
- for(i = sel; i < changes.num_contacts; i++)
+ for (i = sel; i < changes.num_contacts; i++)
changes.hContact[i] = changes.hContact[i + 1];
FillContactList(hwndDlg, &changes);
// disable buttons
diff --git a/plugins/MetaContacts/meta_api.c b/plugins/MetaContacts/meta_api.c index 6a8781f6e1..331bdb55d5 100644 --- a/plugins/MetaContacts/meta_api.c +++ b/plugins/MetaContacts/meta_api.c @@ -41,7 +41,7 @@ INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam) { //returns a handle to the default contact, or null on failure
INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam) {
DWORD default_contact_number = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1);
- if(default_contact_number != -1) {
+ if (default_contact_number != -1) {
return (int)Meta_GetContactHandle((HANDLE)wParam, default_contact_number);
}
return 0;
@@ -86,11 +86,11 @@ INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam) { //returns 0 on success
INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) {
DWORD num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", -1);
- if(num_contacts == -1)
+ if (num_contacts == -1)
return 1;
if ((DWORD)lParam >= num_contacts || (DWORD)lParam < 0)
return 1;
- if(DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "Default", (DWORD)lParam))
+ if (DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "Default", (DWORD)lParam))
return 1;
NotifyEventHooks(hEventDefaultChanged, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, (int)lParam));
@@ -104,9 +104,9 @@ INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) {
HANDLE hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "Handle", 0);
DWORD contact_number = Meta_GetContactNumber((HANDLE)lParam);
- if(contact_number == -1 || !hMeta || hMeta != (HANDLE)wParam)
+ if (contact_number == -1 || !hMeta || hMeta != (HANDLE)wParam)
return 1;
- if(DBWriteContactSettingDword(hMeta, META_PROTO, "Default", contact_number))
+ if (DBWriteContactSettingDword(hMeta, META_PROTO, "Default", contact_number))
return 1;
NotifyEventHooks(hEventDefaultChanged, wParam, lParam);
@@ -150,7 +150,7 @@ INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) { //lParam=0
//returns 0 on success (will fail if 'force default' is in effect)
INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam) {
- if(DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
+ if (DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
return 1;
DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "ForceSend", 0);
@@ -184,17 +184,17 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) { if (!hMeta) return 0;
- if(DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) {
- if(lParam) *(DWORD *)lParam = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1);
+ if (DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) {
+ if (lParam) *(DWORD *)lParam = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1);
return 1;
}
hContact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0);
if (!hContact) {
- if(lParam) *(DWORD *)lParam = -1;
+ if (lParam) *(DWORD *)lParam = -1;
} else {
- if(lParam) *(DWORD *)lParam = (DWORD)Meta_GetContactNumber(hContact);
+ if (lParam) *(DWORD *)lParam = (DWORD)Meta_GetContactNumber(hContact);
}
return 0;
diff --git a/plugins/MetaContacts/meta_main.c b/plugins/MetaContacts/meta_main.c index 30681a211e..dbe2f67224 100644 --- a/plugins/MetaContacts/meta_main.c +++ b/plugins/MetaContacts/meta_main.c @@ -169,7 +169,7 @@ int __declspec(dllexport)Load(PLUGINLINK *link) os_unicode_enabled = IsUnicodeOS();
- if(ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+
+ if (ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Status"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/IdleTS"));
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/ContactCountCheck"));
@@ -191,7 +191,7 @@ int __declspec(dllexport)Load(PLUGINLINK *link) DBWriteContactSettingByte(hContact, META_PROTO, "ContactCountCheck", 0);
// restore any saved defaults that might have remained if miranda was closed or crashed while a convo was happening
- if(DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1) != (DWORD)-1) {
+ if (DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1) != (DWORD)-1) {
DBWriteContactSettingDword(hContact, META_PROTO, "Default", DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", 0));
DBWriteContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1);
}
@@ -212,7 +212,7 @@ int __declspec(dllexport)Load(PLUGINLINK *link) // also verifies that subcontacts: have metacontacts, and that contact numbers are reasonable,
// that metacontacts: have the correct number of subcontacts, and have reasonable defaults
- if(Meta_SetHandles()) {
+ if (Meta_SetHandles()) {
// error - db corruption
if (!DBGetContactSettingByte(0, META_PROTO, "DisabledMessageShown", 0)) {
MessageBox(0, Translate("Error - Database corruption.\nPlugin disabled."), Translate("MetaContacts"), MB_OK | MB_ICONERROR);
@@ -255,7 +255,7 @@ int __declspec(dllexport)Load(PLUGINLINK *link) // check protocol for jabber hack, and the proto modules must be loaded
//Meta_HideLinkedContactsAndSetHandles();
- if(ServiceExists(MS_MSG_GETWINDOWAPI)) {
+ if (ServiceExists(MS_MSG_GETWINDOWAPI)) {
message_window_api_enabled = TRUE;
}
diff --git a/plugins/MetaContacts/meta_menu.c b/plugins/MetaContacts/meta_menu.c index 37ceb1116a..6e7ad9f1c6 100644 --- a/plugins/MetaContacts/meta_menu.c +++ b/plugins/MetaContacts/meta_menu.c @@ -52,7 +52,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) hMetaContact = (HANDLE)CallService(MS_DB_CONTACT_ADD,0,0);
// Add the info for the metacontact
- if(hMetaContact)
+ if (hMetaContact)
{
DBWriteContactSettingDword(hMetaContact,META_PROTO,META_ID,nextMetaID);
@@ -62,8 +62,8 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) // Add the MetaContact protocol to the new meta contact
CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hMetaContact, ( LPARAM )META_PROTO );
- if(group) {
- if(ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
+ if (group) {
+ if (ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
DBWriteContactSettingStringUtf(hMetaContact,"CList","Group",group);
else
DBWriteContactSettingString(hMetaContact,"CList","Group",group);
@@ -147,7 +147,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0);
default_contact = DBGetContactSettingDword(hMeta, META_PROTO, "Default", -1);
- if(number >= 0 && number < num_contacts) {
+ if (number >= 0 && number < num_contacts) {
// get the handle
hContact = Meta_GetContactHandle(hMeta, number);
@@ -166,7 +166,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { //CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_PROTO);
CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
// stop ignoring, if we were
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
@@ -175,7 +175,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { // each contact from 'number' upwards will be moved down one
// and the last one will be deleted
- for(i = number + 1; i < num_contacts; i++) {
+ for (i = number + 1; i < num_contacts; i++) {
Meta_SwapContacts(hMeta, i, i-1);
}
@@ -203,9 +203,9 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { DBDeleteContactSetting(hMeta, META_PROTO, buffer);
// if the default contact was equal to or greater than 'number', decrement it (and deal with ends)
- if(default_contact >= number) {
+ if (default_contact >= number) {
default_contact--;
- if(default_contact < 0)
+ if (default_contact < 0)
default_contact = 0;
DBWriteContactSettingDword(hMeta, META_PROTO, "Default", (DWORD)default_contact);
@@ -223,7 +223,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { // fix avatar
hContact = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
- if(hContact) {
+ if (hContact) {
PROTO_AVATAR_INFORMATION AI;
AI.cbSize = sizeof(AI);
@@ -253,7 +253,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) if ((metaID=DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1)
{// The wParam is a metacontact
if (!lParam) { // check from recursion - see second half of this function
- if(MessageBox((HWND)CallService(MS_CLUI_GETHWND,0,0),Translate("This will remove the MetaContact permanently.\n\nProceed Anyway?"),
+ if (MessageBox((HWND)CallService(MS_CLUI_GETHWND,0,0),Translate("This will remove the MetaContact permanently.\n\nProceed Anyway?"),
Translate("Are you sure?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2)!=IDYES)
{
return 0;
@@ -263,7 +263,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
while(hContact)
{ // Scans the database to get all the contacts that have been previously linked to this MetaContact
- if(DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
+ if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
{ // This contact is assigned to the MetaContact that will be deleted, clear the "MetaContacts" information
DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact");
DBDeleteContactSetting(hContact,META_PROTO,META_LINK);
@@ -275,7 +275,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
// stop ignoring, if we were
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
@@ -288,7 +288,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) }
else
{// The wParam is a simple contact
- //if(lParam == 0)
+ //if (lParam == 0)
// return 1; // The function has been called by the menu of a simple contact. Should not happen.
//else
{// The function has been called by the edit dialog
@@ -297,8 +297,8 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) DWORD num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", -1);
- if(num_contacts == 1) {
- if(MessageBox(0,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
+ if (num_contacts == 1) {
+ if (MessageBox(0,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)==IDYES)
{
// recurse - once
@@ -345,7 +345,7 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam) */
INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam)
{
- if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
+ if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
{ // the wParam is a MetaContact
BOOL current = DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0);
@@ -354,7 +354,7 @@ INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam) DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "ForceSend", 0);
- if(current) NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1)));
+ if (current) NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1)));
else NotifyEventHooks(hEventUnforceSend, wParam, 0);
}
return 0;
@@ -408,7 +408,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) mi.flags = CMIM_FLAGS;
mi.cbSize = sizeof(CLISTMENUITEM);
- if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,-1) != (DWORD)-1)
+ if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,-1) != (DWORD)-1)
{
int num_contacts, i;
@@ -418,7 +418,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) // This is a MetaContact, show the edit, force default, and the delete menu, and hide the others
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
//mi.flags |= CMIM_NAME;
- //if(DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
+ //if (DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
// mi.pszName = Translate("Unforce Default");
//else
// mi.pszName = Translate("Force Default");
@@ -434,8 +434,8 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) //show subcontact menu items
num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", 0);
- for(i = 0; i < MAX_CONTACTS; i++) {
- if(i < num_contacts) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
+ if (i < num_contacts) {
hContact = Meta_GetContactHandle((HANDLE)wParam, i);
proto = _strdup((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0));
@@ -444,7 +444,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) else
status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
- if(options.menu_contact_label == DNT_UID) {
+ if (options.menu_contact_label == DNT_UID) {
strcpy(buf, "Login");
strcat(buf, _itoa(i, buffer2, 10));
@@ -473,7 +473,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) char *name = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
char *wname = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_UNICODE);
- if(wname && strncmp(name, wname, strlen(name)) != 0) {
+ if (wname && strncmp(name, wname, strlen(name)) != 0) {
mi.pszName = wname;
mi.flags = CMIF_UNICODE;
}
@@ -522,12 +522,12 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
- for(i = 0; i < MAX_CONTACTS; i++) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
- } else if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ } else if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// The contact is affected to a metacontact.
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
mi.flags |= CMIM_NAME;
@@ -537,7 +537,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
- for(i = 0; i < MAX_CONTACTS; i++) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
@@ -549,7 +549,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
- for(i = 0; i < MAX_CONTACTS; i++) {
+ for (i = 0; i < MAX_CONTACTS; i++) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
diff --git a/plugins/MetaContacts/meta_options.c b/plugins/MetaContacts/meta_options.c index af23243c5e..cceb484f6f 100644 --- a/plugins/MetaContacts/meta_options.c +++ b/plugins/MetaContacts/meta_options.c @@ -131,7 +131,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case IDC_RAD_UID:
hw = GetDlgItem(hwndDlg, IDC_RAD_UID);
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_UID)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_UID)) {
options_changes.menu_contact_label = DNT_UID;
CheckDlgButton(hwndDlg, IDC_RAD_DID, FALSE);
}
@@ -139,7 +139,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case IDC_RAD_DID:
hw = GetDlgItem(hwndDlg, IDC_RAD_DID);
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_DID)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DID)) {
options_changes.menu_contact_label = DNT_DID;
CheckDlgButton(hwndDlg, IDC_RAD_UID, FALSE);
}
@@ -147,7 +147,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case IDC_RAD_MSG:
hw = GetDlgItem(hwndDlg, IDC_RAD_MSG);
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_MSG)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_MSG)) {
options_changes.menu_function = FT_MSG;
CheckDlgButton(hwndDlg, IDC_RAD_MENU, FALSE);
CheckDlgButton(hwndDlg, IDC_RAD_INFO, FALSE);
@@ -156,7 +156,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case IDC_RAD_MENU:
hw = GetDlgItem(hwndDlg, IDC_RAD_MENU);
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_MENU)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_MENU)) {
options_changes.menu_function = FT_MENU;
CheckDlgButton(hwndDlg, IDC_RAD_MSG, FALSE);
CheckDlgButton(hwndDlg, IDC_RAD_INFO, FALSE);
@@ -165,7 +165,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case IDC_RAD_INFO:
hw = GetDlgItem(hwndDlg, IDC_RAD_INFO);
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_INFO)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_INFO)) {
options_changes.menu_function = FT_INFO;
CheckDlgButton(hwndDlg, IDC_RAD_MSG, FALSE);
CheckDlgButton(hwndDlg, IDC_RAD_MENU, FALSE);
@@ -174,7 +174,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case IDC_RAD_NICK:
hw = GetDlgItem(hwndDlg, IDC_RAD_NICK);
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_NICK)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_NICK)) {
options_changes.clist_contact_name = CNNT_NICK;
CheckDlgButton(hwndDlg, IDC_RAD_NAME, FALSE);
}
@@ -182,7 +182,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break;
case IDC_RAD_NAME:
hw = GetDlgItem(hwndDlg, IDC_RAD_NAME);
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_NAME)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_NAME)) {
options_changes.clist_contact_name = CNNT_DISPLAYNAME;
CheckDlgButton(hwndDlg, IDC_RAD_NICK, FALSE);
}
@@ -192,7 +192,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara hw = GetDlgItem(hwndDlg, IDC_CHK_SUBWINDOW);
options_changes.subcontact_windows = IsDlgButtonChecked(hwndDlg, IDC_CHK_SUBWINDOW);
- if(options_changes.subcontact_windows) {
+ if (options_changes.subcontact_windows) {
hw = GetDlgItem(hwndDlg, IDC_CHK_METAHISTORY);
EnableWindow(hw, TRUE);
hw = GetDlgItem(hwndDlg, IDC_CHK_SUBHISTORY);
@@ -223,7 +223,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
hw = GetDlgItem(hwndDlg, IDC_ED_DAYS);
GetWindowText(hw, buff, 512);
- if(strlen(buff) > 0)
+ if (strlen(buff) > 0)
options_changes.days_history = atoi(buff);
options = options_changes;
@@ -262,7 +262,7 @@ int Meta_WriteOptions(MetaOptions *opt) { else
DBWriteContactSettingByte(NULL, META_PROTO, "MetaHistory", (BYTE)(opt->metahistory ? 1 : 0));
- if(opt->subcontact_windows)
+ if (opt->subcontact_windows)
DBWriteContactSettingByte(NULL, META_PROTO, "SubcontactHistory", 1);
else
DBWriteContactSettingByte(NULL, META_PROTO, "SubcontactHistory", (BYTE)(opt->subhistory ? 1 : 0));
@@ -294,7 +294,7 @@ int Meta_ReadOptions(MetaOptions *opt) { else
opt->metahistory = (DBGetContactSettingByte(NULL, META_PROTO, "MetaHistory", 1) == 1 ? TRUE : FALSE);
- if(opt->subcontact_windows)
+ if (opt->subcontact_windows)
opt->subhistory = TRUE;
else
opt->subhistory = (DBGetContactSettingByte(NULL, META_PROTO, "SubcontactHistory", 1) == 1 ? TRUE : FALSE);
@@ -347,7 +347,7 @@ int GetRealPriority(char *proto, int status) { int prio;
mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", proto, status);
prio = DBGetContactSettingWord(0, META_PROTO, szSetting, 0xFFFF);
- if(prio == 0xFFFF) {
+ if (prio == 0xFFFF) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", status);
return DBGetContactSettingWord(0, META_PROTO, szSetting, GetDefaultPrio(status));
} else
@@ -366,14 +366,14 @@ void ReadPriorities() { CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
current = priorities = (ProtoStatusPrio *)malloc((num_protocols + 1) * sizeof(ProtoStatusPrio));
- for(i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", i);
current->def[i - ID_STATUS_OFFLINE] = TRUE;
current->prio[i - ID_STATUS_OFFLINE] = DBGetContactSettingWord(0, META_PROTO, szSetting, GetDefaultPrio(i));
}
- for(i = 0; i < num_protocols; i++) {
+ for (i = 0; i < num_protocols; i++) {
current = priorities + (i + 1);
- for(j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
+ for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szName, j);
current->prio[j - ID_STATUS_OFFLINE] = DBGetContactSettingWord(0, META_PROTO, szSetting, 0xFFFF);
current->def[j - ID_STATUS_OFFLINE] = (current->prio[j - ID_STATUS_OFFLINE] == 0xFFFF);
@@ -390,16 +390,16 @@ void WritePriorities() { CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
- for(i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", i);
- if(current->prio[i - ID_STATUS_OFFLINE] != GetDefaultPrio(i))
+ if (current->prio[i - ID_STATUS_OFFLINE] != GetDefaultPrio(i))
DBWriteContactSettingWord(0, META_PROTO, szSetting, (WORD)current->prio[i - ID_STATUS_OFFLINE]);
else
DBDeleteContactSetting(0, META_PROTO, szSetting);
}
- for(i = 0; i < num_protocols; i++) {
+ for (i = 0; i < num_protocols; i++) {
current = priorities + (i + 1);
- for(j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
+ for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szName, j);
if (!current->def[j - ID_STATUS_OFFLINE])
DBWriteContactSettingWord(0, META_PROTO, szSetting, (WORD)current->prio[j - ID_STATUS_OFFLINE]);
@@ -415,12 +415,12 @@ int GetIsDefault(int proto_index, int status) { BOOL GetPriority(int proto_index, int status) {
ProtoStatusPrio * current;
- if(proto_index == -1) {
+ if (proto_index == -1) {
current = priorities;
return current->prio[status - ID_STATUS_OFFLINE];
} else {
current = priorities + (proto_index + 1);
- if(current->def[status - ID_STATUS_OFFLINE]) {
+ if (current->def[status - ID_STATUS_OFFLINE]) {
current = priorities;
}
return current->prio[status - ID_STATUS_OFFLINE];
@@ -430,9 +430,9 @@ BOOL GetPriority(int proto_index, int status) { void SetPriority(int proto_index, int status, BOOL def, int prio) {
ProtoStatusPrio * current;
- if(prio < 0) prio = 0;
- if(prio > 500) prio = 500;
- if(proto_index == -1) {
+ if (prio < 0) prio = 0;
+ if (prio > 500) prio = 500;
+ if (proto_index == -1) {
current = priorities;
current->prio[status - ID_STATUS_OFFLINE] = prio;
} else {
@@ -453,13 +453,13 @@ void ResetPriorities() { CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
current = priorities;
- for(i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
current->def[i - ID_STATUS_OFFLINE] = TRUE;
current->prio[i - ID_STATUS_OFFLINE] = GetDefaultPrio(i);
}
- for(i = 0; i < num_protocols; i++) {
+ for (i = 0; i < num_protocols; i++) {
current = priorities + (i + 1);
- for(j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
+ for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
current->def[j - ID_STATUS_OFFLINE] = TRUE;
}
}
@@ -486,9 +486,9 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP hw = GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL);
index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)Translate("<default>"));
SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, -1);
- for(i = 0; i < num_protocols; i++) {
- if(pppDesc[i]->type == PROTOTYPE_PROTOCOL) {
- if(strcmp(pppDesc[i]->szName, META_PROTO) != 0) {
+ for (i = 0; i < num_protocols; i++) {
+ if (pppDesc[i]->type == PROTOTYPE_PROTOCOL) {
+ if (strcmp(pppDesc[i]->szName, META_PROTO) != 0) {
index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pppDesc[i]->szName);
SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, i);
}
@@ -503,19 +503,19 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WMU_FILLPRIODATA:
{
int sel = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
int index = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETITEMDATA, (WPARAM)sel, 0);
sel = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_STATUS), CB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
int status = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_STATUS), CB_GETITEMDATA, (WPARAM)sel, 0);
SetDlgItemInt(hwndDlg, IDC_ED_PRIORITY, GetPriority(index, status), FALSE);
- if(index == -1) {
+ if (index == -1) {
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_PRIORITY), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SP_PRIORITY), TRUE);
CheckDlgButton(hwndDlg, IDC_CHK_DEFAULT, TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DEFAULT), FALSE);
} else {
- if(GetIsDefault(index, status)) {
+ if (GetIsDefault(index, status)) {
CheckDlgButton(hwndDlg, IDC_CHK_DEFAULT, TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_PRIORITY), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SP_PRIORITY), FALSE);
@@ -534,13 +534,13 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WMU_FILLSTATUSCMB:
{
int sel = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
int index = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETITEMDATA, (WPARAM)sel, 0);
HWND hw = GetDlgItem(hwndDlg, IDC_CMB_STATUS);
SendMessage(hw, CB_RESETCONTENT, 0, 0);
- if(index == -1) {
+ if (index == -1) {
int i;
- for(i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)(char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, i, 0));
SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, i);
}
@@ -551,8 +551,8 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP caps = CallProtoService(pppDesc[index]->szName, PS_GETCAPS, PFLAGNUM_2, 0);
- for(i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- if(caps & Proto_Status2Flag(i)) {
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ if (caps & Proto_Status2Flag(i)) {
index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)(char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, i, 0));
SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, i);
}
@@ -569,13 +569,13 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_CHK_DEFAULT:
{
int sel = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
int index = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETITEMDATA, (WPARAM)sel, 0);
sel = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_STATUS), CB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
BOOL checked = IsDlgButtonChecked(hwndDlg, IDC_CHK_DEFAULT);
int status = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_STATUS), CB_GETITEMDATA, (WPARAM)sel, 0);
- if(checked) {
+ if (checked) {
SetPriority(index, status, TRUE, 0);
SetDlgItemInt(hwndDlg, IDC_ED_PRIORITY, GetPriority(index, status), FALSE);
} else {
@@ -599,14 +599,14 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
if ( HIWORD( wParam ) == EN_CHANGE && LOWORD(wParam) == IDC_ED_PRIORITY && ( HWND )lParam == GetFocus()) {
int sel = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
int index = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL), CB_GETITEMDATA, (WPARAM)sel, 0);
sel = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_STATUS), CB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
int status = SendMessage(GetDlgItem(hwndDlg, IDC_CMB_STATUS), CB_GETITEMDATA, (WPARAM)sel, 0);
int prio = GetDlgItemInt(hwndDlg, IDC_ED_PRIORITY, 0, FALSE);
SetPriority(index, status, FALSE, prio);
- if(prio != GetPriority(index, status))
+ if (prio != GetPriority(index, status))
SetDlgItemInt(hwndDlg, IDC_ED_PRIORITY, GetPriority(index, status), FALSE);
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
}
diff --git a/plugins/MetaContacts/meta_services.c b/plugins/MetaContacts/meta_services.c index 67644af23c..92e503568d 100644 --- a/plugins/MetaContacts/meta_services.c +++ b/plugins/MetaContacts/meta_services.c @@ -43,20 +43,21 @@ hHooks[NB_HOOKS] = {0}; //!< list of all hooks set up (see Meta_CloseHandles()) HANDLE *hNudgeEvents = 0;
int iNudgeProtos = 0;
-HANDLE hMenuConvert, //!< \c HANDLE to the convert menu item.
- hMenuAdd, //!< \c HANDLE to the add to menu item.
- hMenuEdit, //!< \c HANDLE to the edit menu item.
- hMenuDelete, //!< \c HANDLE to the delete menu item.
- hMenuDefault, //!< \c HANDLE to the delete menu item.
- hMenuForceDefault; //!< \c HANDLE to the delete menu item.
-
-HANDLE hMenuOnOff; //!< \c HANDLE to the enable/disable menu item.
-
-HANDLE hEventDefaultChanged, //!< \c HANDLE to the 'default changed' event
- hEventForceSend, //!< \c HANDLE to the 'force send' event
- hEventUnforceSend, //!< \c HANDLE to the 'unforce send' event
- hSubcontactsChanged, //!< \c HANDLE to the 'contacts changed' event
- hEventNudge;
+HGENMENU
+ hMenuConvert, //!< \c HANDLE to the convert menu item.
+ hMenuAdd, //!< \c HANDLE to the add to menu item.
+ hMenuEdit, //!< \c HANDLE to the edit menu item.
+ hMenuDelete, //!< \c HANDLE to the delete menu item.
+ hMenuDefault, //!< \c HANDLE to the delete menu item.
+ hMenuForceDefault, //!< \c HANDLE to the delete menu item.
+ hMenuOnOff; //!< \c HANDLE to the enable/disable menu item.
+
+HANDLE
+ hEventDefaultChanged, //!< \c HANDLE to the 'default changed' event
+ hEventForceSend, //!< \c HANDLE to the 'force send' event
+ hEventUnforceSend, //!< \c HANDLE to the 'unforce send' event
+ hSubcontactsChanged, //!< \c HANDLE to the 'contacts changed' event
+ hEventNudge;
DWORD nextMetaID; //!< Global variable specifying the ID value the next MetaContact will have.
@@ -130,7 +131,7 @@ INT_PTR Meta_GetName(WPARAM wParam,LPARAM lParam) {
char *name = (char *)Translate(META_PROTO);
size_t size = min(strlen(name),wParam-1); // copy only the first size bytes.
- if(strncpy((char *)lParam,name,size)==NULL)
+ if (strncpy((char *)lParam,name,size)==NULL)
return 1;
((char *)lParam)[size]='\0';
return 0;
@@ -189,7 +190,7 @@ void CALLBACK SetStatusThread(HWND hWnd, UINT msg, UINT_PTR id, DWORD dw) INT_PTR Meta_SetStatus(WPARAM wParam,LPARAM lParam)
{
// firstSetOnline starts out true - used to delay metacontact's 'onlineness' to prevent double status notifications on startup
- if(mcStatus == ID_STATUS_OFFLINE && firstSetOnline) {
+ if (mcStatus == ID_STATUS_OFFLINE && firstSetOnline) {
// causes crash on exit if miranda is closed in under options.set_status_from_offline milliseconds!
//CloseHandle( CreateThread( NULL, 0, SetStatusThread, (void *)wParam, 0, 0 ));
setStatusTimerId = SetTimer(0, 0, options.set_status_from_offline_delay, SetStatusThread);
@@ -269,18 +270,18 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam) }
// if subcontact sending, add db event to keep metacontact history correct
- if(options.metahistory && !(ccs->wParam & PREF_METANODB)) {
+ if (options.metahistory && !(ccs->wParam & PREF_METANODB)) {
// reject "file As Message" messages
- if(strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%fAM", 5) == 0)
+ if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%fAM", 5) == 0)
return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
// reject "data As Message" messages
- if(strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%dAM", 5) == 0)
+ if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%dAM", 5) == 0)
return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
// reject "OTR" messages
- if(strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "?OTR", 4) == 0)
+ if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "?OTR", 4) == 0)
return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
ZeroMemory(&dbei, sizeof(dbei));
@@ -289,8 +290,8 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam) dbei.flags = DBEF_SENT;
dbei.timestamp = time(NULL);
dbei.eventType = EVENTTYPE_MESSAGE;
- if(ccs->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
- if(ccs->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
+ if (ccs->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
+ if (ccs->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.cbBlob = (DWORD)strlen((char *)ccs->lParam) + 1;
if ( ccs->wParam & PREF_UNICODE )
dbei.cbBlob *= ( sizeof( wchar_t )+1 );
@@ -379,14 +380,14 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) // don't bypass filters etc
strncpy(szServiceName, PSS_MESSAGE, sizeof(szServiceName));
- if(ccs->wParam & PREF_UNICODE) {
+ if (ccs->wParam & PREF_UNICODE) {
char szTemp[100];
_snprintf(szTemp, sizeof(szTemp), "%s%sW", proto, PSS_MESSAGE);
if (ServiceExists(szTemp))
strncpy(szServiceName, PSS_MESSAGE "W", sizeof(szServiceName));
}
- if(options.subhistory && !(ccs->wParam & PREF_METANODB)) {
+ if (options.subhistory && !(ccs->wParam & PREF_METANODB)) {
// add sent event to subcontact
ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize = sizeof(dbei);
@@ -394,8 +395,8 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) dbei.flags = DBEF_SENT;
dbei.timestamp = time(NULL);
dbei.eventType = EVENTTYPE_MESSAGE;
- if(ccs->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
- if(ccs->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
+ if (ccs->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
+ if (ccs->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.cbBlob = (DWORD)strlen((char *)ccs->lParam) + 1;
if ( ccs->wParam & PREF_UNICODE )
dbei.cbBlob *= ( sizeof( wchar_t )+1 );
@@ -435,8 +436,8 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) return 0;
}
- if(options.set_default_on_recv) {
- if(options.temp_default && DBGetContactSettingDword(hMeta, META_PROTO, "SavedDefault", (DWORD)-1) == (DWORD)-1)
+ if (options.set_default_on_recv) {
+ if (options.temp_default && DBGetContactSettingDword(hMeta, META_PROTO, "SavedDefault", (DWORD)-1) == (DWORD)-1)
DBWriteContactSettingDword(hMeta, META_PROTO, "SavedDefault", DBGetContactSettingDword(hMeta, META_PROTO, "Default", 0));
DBWriteContactSettingDword(hMeta, META_PROTO, "Default", DBGetContactSettingDword(ccs->hContact, META_PROTO, "ContactNumber", 0));
NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)ccs->hContact); // nick set in event handler
@@ -451,7 +452,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) // add a clist event, so that e.g. there is an icon flashing
// (only add it when message api available, 'cause then we can remove the event when the message window is opened)
- if(message_window_api_enabled
+ if (message_window_api_enabled
&& DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) == 0
&& DBGetContactSettingByte(hMeta, META_PROTO, "WindowOpen", 0) == 0
&& options.flash_meta_message_icon)
@@ -471,23 +472,23 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) CallService(MS_CLIST_ADDEVENT, 0, (LPARAM) & cle);
}
- if(options.metahistory) {
+ if (options.metahistory) {
BOOL added = FALSE;
// should be able to do this, but some protos mess with the memory
- if(options.use_proto_recv)
+ if (options.use_proto_recv)
{
// use the subcontact's protocol 'recv' service to add the meta's history (AIMOSCAR removes HTML here!) if possible
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
- if(proto) {
+ if (proto) {
char service[256];
HANDLE hSub = ccs->hContact;
DWORD flags = pre->flags;
mir_snprintf(service, 256, "%s%s", proto, PSR_MESSAGE);
ccs->hContact = hMeta;
pre->flags |= (DBGetContactSettingByte(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
- if(ServiceExists(service) && !CallService(service, 0, (LPARAM)ccs))
+ if (ServiceExists(service) && !CallService(service, 0, (LPARAM)ccs))
added = TRUE;
ccs->hContact = hSub;
pre->flags = flags;
@@ -501,8 +502,8 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) dbei.szModule = META_PROTO;
dbei.timestamp = pre->timestamp;
dbei.flags = (DBGetContactSettingByte(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
- if(pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
- if(pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
+ if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
+ if (pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
if ( pre->flags & PREF_UNICODE ) {
@@ -521,13 +522,13 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) /*
// add event to subcontact history (would do it in meta_recvmessage, but here we have the hcontact)
// should be able to use the method below, except some protos can mess with the memory
- if(options.subhistory) {
+ if (options.subhistory) {
ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize = sizeof(dbei);
dbei.szModule = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0);
dbei.timestamp = pre->timestamp;
dbei.flags = (DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
- if(pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
+ if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = strlen(pre->szMessage) + 1;
if ( pre->flags & PREF_UNICODE )
@@ -546,7 +547,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) ccs->hContact = hSub;
}
- if(options.subhistory && !(ccs->wParam & PREF_METANODB)) {
+ if (options.subhistory && !(ccs->wParam & PREF_METANODB)) {
// allow event pass through and thereby be added to subcontact history
pre->flags |= (DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); // pass through as normal
@@ -575,12 +576,12 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam) return 0;
}
- if(options.use_proto_recv)
+ if (options.use_proto_recv)
{
// use the subcontact's protocol to add the db if possible (AIMOSCAR removes HTML here!)
HANDLE most_online = Meta_GetMostOnline(ccs->hContact);
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
- if(proto) {
+ if (proto) {
char service[256];
mir_snprintf(service, 256, "%s%s", proto, PSR_MESSAGE);
if (CallService(service, wParam, lParam) != CALLSERVICE_NOTFOUND)
@@ -595,8 +596,8 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam) dbei.szModule = META_PROTO;
dbei.timestamp = pre->timestamp;
dbei.flags = (pre->flags & PREF_CREATEREAD ? DBEF_READ : 0);
- if(pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
- if(pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
+ if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
+ if (pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
if ( pre->flags & PREF_UNICODE )
@@ -625,7 +626,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) ACKDATA *ack = (ACKDATA*) lParam;
HANDLE hUser;
- if(ack->hContact == 0 || (hUser = (HANDLE)DBGetContactSettingDword(ack->hContact,META_PROTO,"Handle",0)) == 0)
+ if (ack->hContact == 0 || (hUser = (HANDLE)DBGetContactSettingDword(ack->hContact,META_PROTO,"Handle",0)) == 0)
return 0; // Can't find the MetaID, let through the protocol chain
@@ -634,7 +635,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) }
// if it's for something we don't support, ignore
- if(ack->type != ACKTYPE_MESSAGE && ack->type != ACKTYPE_CHAT && ack->type != ACKTYPE_FILE && ack->type != ACKTYPE_AWAYMSG
+ if (ack->type != ACKTYPE_MESSAGE && ack->type != ACKTYPE_CHAT && ack->type != ACKTYPE_FILE && ack->type != ACKTYPE_AWAYMSG
&& ack->type != ACKTYPE_AVATAR && ack->type != ACKTYPE_GETINFO)
{
@@ -642,15 +643,15 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) }
// change the hContact in the avatar info struct, if it's the avatar we're using - else drop it
- if(ack->type == ACKTYPE_AVATAR) {
- if(ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED || ack->result == ACKRESULT_STATUS) {
+ if (ack->type == ACKTYPE_AVATAR) {
+ if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED || ack->result == ACKRESULT_STATUS) {
HANDLE most_online;
DBVARIANT dbv;
// change avatar if the most online supporting avatars changes, or if we don't have one
most_online = Meta_GetMostOnlineSupporting(hUser, PFLAGNUM_4, PF4_AVATARS);
- //if(AI.hContact == 0 || AI.hContact != most_online) {
- if(ack->hContact == 0 || ack->hContact != most_online) {
+ //if (AI.hContact == 0 || AI.hContact != most_online) {
+ if (ack->hContact == 0 || ack->hContact != most_online) {
return 0;
}
@@ -660,10 +661,10 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) DBFreeVariant(&dbv);
}
- if(ack->hProcess) {
+ if (ack->hProcess) {
PROTO_AVATAR_INFORMATION AI;
memcpy(&AI, (PROTO_AVATAR_INFORMATION *)ack->hProcess, sizeof(PROTO_AVATAR_INFORMATION));
- if(AI.hContact)
+ if (AI.hContact)
AI.hContact = hUser;
return ProtoBroadcastAck(META_PROTO,hUser,ack->type,ack->result, (HANDLE)&AI, ack->lParam);
@@ -696,7 +697,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // hide metacontacts when groups disabled
- if(wParam == 0
+ if (wParam == 0
&& ((strcmp(dcws->szModule, "CList") == 0 && strcmp(dcws->szSetting, "UseGroups") == 0)
|| (strcmp(dcws->szModule, META_PROTO) == 0 && strcmp(dcws->szSetting, "Enabled") == 0)))
{
@@ -704,7 +705,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) return 0;
}
- if(wParam == 0
+ if (wParam == 0
&& strcmp(dcws->szModule, "Import") == 0 && strcmp(dcws->szSetting, "Completed") == 0)
{
// import process has just been run...call startup routines...
@@ -724,7 +725,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) Meta_SuppressStatus(options.suppress_status);
}
- if(wParam == 0
+ if (wParam == 0
&& strcmp(dcws->szModule, "CListGroups") == 0 && dcws->value.type != DBVT_DELETED && strcmp(dcws->value.pszVal, META_HIDDEN_GROUP) == 0)
{
// someone is creating our hidden group!!
@@ -732,7 +733,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) }
// from here on, we're just interested in contact settings
- if(wParam == 0) return 0;
+ if (wParam == 0) return 0;
if ((hMeta=(HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0))!=0
&& CallService(MS_DB_CONTACT_IS, (WPARAM)hMeta, 0)) // just to be safe
@@ -740,7 +741,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) { // This contact is attached to a MetaContact.
contact_number = Meta_GetContactNumber((HANDLE)wParam);
- if(contact_number == -1) return 0; // exit - db corruption
+ if (contact_number == -1) return 0; // exit - db corruption
if (!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Group") &&
Meta_IsEnabled() && DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) {
@@ -748,7 +749,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // subcontact group reassigned - copy to saved group
MyDBWriteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value);
DBWriteContactSettingString((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
- } else if(dcws->value.type == DBVT_DELETED) {
+ } else if (dcws->value.type == DBVT_DELETED) {
DBDeleteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup");
DBWriteContactSettingString((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
}
@@ -756,7 +757,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // copy IP
if (!strcmp(dcws->szSetting, "IP")) {
- if(dcws->value.type == DBVT_DWORD)
+ if (dcws->value.type == DBVT_DWORD)
DBWriteContactSettingDword(hMeta, META_PROTO, "IP", dcws->value.dVal);
else
DBDeleteContactSetting(hMeta, META_PROTO, "IP");
@@ -764,7 +765,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // copy RealIP
if (!strcmp(dcws->szSetting, "RealIP")) {
- if(dcws->value.type == DBVT_DWORD)
+ if (dcws->value.type == DBVT_DWORD)
DBWriteContactSettingDword(hMeta, META_PROTO, "RealIP", dcws->value.dVal);
else
DBDeleteContactSetting(hMeta, META_PROTO, "RealIP");
@@ -797,7 +798,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
- if(MyDBGetContactSetting((HANDLE)wParam, "CList", "MyHandle", &dbv)) {
+ if (MyDBGetContactSetting((HANDLE)wParam, "CList", "MyHandle", &dbv)) {
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
@@ -813,29 +814,29 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } else
if (!strcmp(dcws->szSetting, "IdleTS")) {
- if(dcws->value.type == DBVT_DWORD)
+ if (dcws->value.type == DBVT_DWORD)
DBWriteContactSettingDword(hMeta, META_PROTO, "IdleTS", dcws->value.dVal);
- else if(dcws->value.type == DBVT_DELETED)
+ else if (dcws->value.type == DBVT_DELETED)
DBWriteContactSettingDword(hMeta, META_PROTO, "IdleTS", 0);
} else
if (!strcmp(dcws->szSetting, "LogonTS")) {
- if(dcws->value.type == DBVT_DWORD)
+ if (dcws->value.type == DBVT_DWORD)
DBWriteContactSettingDword(hMeta, META_PROTO, "LogonTS", dcws->value.dVal);
- else if(dcws->value.type == DBVT_DELETED)
+ else if (dcws->value.type == DBVT_DELETED)
DBWriteContactSettingDword(hMeta, META_PROTO, "LogonTS", 0);
} else
if (!strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) {
HANDLE most_online;
- if(dcws->value.type == DBVT_DELETED) {
+ if (dcws->value.type == DBVT_DELETED) {
DBVARIANT dbv;
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- if(proto && !MyDBGetContactSetting((HANDLE)wParam, proto, "Nick", &dbv)) {
+ if (proto && !MyDBGetContactSetting((HANDLE)wParam, proto, "Nick", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dbv);
DBFreeVariant(&dbv);
} else {
@@ -883,7 +884,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // most online contact with avatar support might have changed - update avatar
most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_AVATARS);
- if(most_online) {
+ if (most_online) {
PROTO_AVATAR_INFORMATION AI;
AI.cbSize = sizeof(AI);
@@ -896,11 +897,11 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) }
} else
- if(strcmp(dcws->szSetting, "XStatusId") == 0 || strcmp(dcws->szSetting, "XStatusMsg") == 0 || strcmp(dcws->szSetting, "XStatusName") == 0 || strcmp(dcws->szSetting, "StatusMsg") == 0) {
+ if (strcmp(dcws->szSetting, "XStatusId") == 0 || strcmp(dcws->szSetting, "XStatusMsg") == 0 || strcmp(dcws->szSetting, "XStatusName") == 0 || strcmp(dcws->szSetting, "StatusMsg") == 0) {
Meta_CopyData(hMeta);
} else
- if(strcmp(dcws->szSetting, "MirVer") == 0) {
+ if (strcmp(dcws->szSetting, "MirVer") == 0) {
Meta_CopyData(hMeta);
} else
@@ -922,7 +923,7 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) { // is a subcontact - update meta contact
hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Handle", 0);
- if(hMeta) {
+ if (hMeta) {
Meta_RemoveContactNumber(hMeta, DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "ContactNumber", -1));
NotifyEventHooks(hSubcontactsChanged, (WPARAM)hMeta, 0);
return 0;
@@ -932,14 +933,14 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) { int i;
HANDLE hContact;
- if(num_contacts) NotifyEventHooks(hSubcontactsChanged, (WPARAM)wParam, 0);
+ if (num_contacts) NotifyEventHooks(hSubcontactsChanged, (WPARAM)wParam, 0);
// remove & restore all subcontacts
- for(i = 0; i < num_contacts; i++) {
+ for (i = 0; i < num_contacts; i++) {
hContact = Meta_GetContactHandle((HANDLE)wParam, i);
- if(hContact && (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0) == (HANDLE)wParam) {
- if(DBGetContactSettingByte(hContact, META_PROTO, "IsSubcontact", 0) == 1)
+ if (hContact && (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0) == (HANDLE)wParam) {
+ if (DBGetContactSettingByte(hContact, META_PROTO, "IsSubcontact", 0) == 1)
DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact");
DBDeleteContactSetting(hContact,META_PROTO,META_LINK);
DBDeleteContactSetting(hContact,META_PROTO,"Handle");
@@ -949,7 +950,7 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) { CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)META_FILTER);
// stop ignoring, if we were
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
}
@@ -970,7 +971,7 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam) char *proto;
char buff[512];
- if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1) == (DWORD)-1)
+ if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1) == (DWORD)-1)
{
// This is a simple contact, let through the stack of protocols
return 0;
@@ -985,11 +986,11 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam) if (!most_online) return 0;
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
- if(proto) {
+ if (proto) {
strncpy(buff, proto, 512);
strncpy(buff + strlen(proto), PSS_USERISTYPING, 512 - strlen(proto));
- if(ServiceExists(buff)) {
+ if (ServiceExists(buff)) {
CallService(buff, (WPARAM)most_online, (LPARAM)lParam);
}
}
@@ -1036,7 +1037,7 @@ int Meta_UserInfo(WPARAM wParam, LPARAM lParam) {
DWORD default_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1);
- if(default_contact_number == -1) // not a meta contact
+ if (default_contact_number == -1) // not a meta contact
return 0;
CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)Meta_GetContactHandle((HANDLE)lParam, default_contact_number), 0);
@@ -1056,13 +1057,13 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { || DBGetContactSettingDword(mwed->hContact, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
{
// contact is subcontact of metacontact, or an actual metacontact - record whether window is open or closed
- if(mwed->uType == MSG_WINDOW_EVT_OPEN || mwed->uType == MSG_WINDOW_EVT_OPENING) {
+ if (mwed->uType == MSG_WINDOW_EVT_OPEN || mwed->uType == MSG_WINDOW_EVT_OPENING) {
DBWriteContactSettingByte(mwed->hContact, META_PROTO, "WindowOpen", 1);
- if(hMeta) { // subcontact window opened - remove clist events we added for metacontact
+ if (hMeta) { // subcontact window opened - remove clist events we added for metacontact
while(!CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hMeta, (LPARAM)mwed->hContact));
}
- } else if(mwed->uType == MSG_WINDOW_EVT_CLOSE || mwed->uType == MSG_WINDOW_EVT_CLOSING) {
+ } else if (mwed->uType == MSG_WINDOW_EVT_CLOSE || mwed->uType == MSG_WINDOW_EVT_CLOSING) {
DBWriteContactSettingByte(mwed->hContact, META_PROTO, "WindowOpen", 0);
if (!hMeta) { // hMeta is 0 for metacontact (sorry)
DWORD saved_def;
@@ -1070,9 +1071,9 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { MetaAPI_UnforceSendContact((WPARAM)mwed->hContact, 0);
// restore saved default contact
- if(options.set_default_on_recv) {
+ if (options.set_default_on_recv) {
saved_def = DBGetContactSettingDword(mwed->hContact, META_PROTO, "SavedDefault", -1);
- if(options.temp_default && saved_def != (DWORD)-1) {
+ if (options.temp_default && saved_def != (DWORD)-1) {
DBWriteContactSettingDword(mwed->hContact, META_PROTO, "Default", saved_def);
DBWriteContactSettingDword(mwed->hContact, META_PROTO, "SavedDefault", (DWORD)-1);
NotifyEventHooks(hEventDefaultChanged, (WPARAM)mwed->hContact, (LPARAM)Meta_GetContactHandle(hMeta, saved_def)); // nick set in event handler
@@ -1091,12 +1092,12 @@ int Meta_LoadIcons(WPARAM wParam, LPARAM lParam) { //MessageBox(0, "LoadIcons", "Event", MB_OK);
- if(ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
+ if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
int index = 0, i;
CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&proto_count,(LPARAM)&protos);
- for(i = 0; i < proto_count && i < MAX_PROTOCOLS; i++) {
- if(protos[i]->type!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0)
+ for (i = 0; i < proto_count && i < MAX_PROTOCOLS; i++) {
+ if (protos[i]->type!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0)
continue;
strncpy(proto_names + (index * 128), protos[i]->szName, 128);
@@ -1126,8 +1127,8 @@ int Meta_CListMW_ExtraIconsRebuild(WPARAM wParam, LPARAM lParam) { //MessageBox(0, "IconsRebuild", "Event", MB_OK);
Meta_LoadIcons(0, 0);
- if(ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
- for(i = 0; i < proto_count; i++) {
+ if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
+ for (i = 0; i < proto_count; i++) {
hExtraImage[i * 2] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hProtoIcons[i * 2], 0);
hExtraImage[i * 2 + 1] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hProtoIcons[i * 2 + 1], 0);
}
@@ -1140,20 +1141,20 @@ int Meta_CListMW_ExtraIconsApply(WPARAM wParam, LPARAM lParam) { //MessageBox(0, "IconsApply", "Event", MB_OK);
- if(DBGetContactSettingDword((HANDLE)wParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) {
- if(ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
+ if (DBGetContactSettingDword((HANDLE)wParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) {
+ if (ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
IconExtraColumn iec;
HANDLE most_online_im = Meta_GetMostOnline((HANDLE)wParam);
int i;
- if(most_online_im) {
+ if (most_online_im) {
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online_im, 0);
- if(proto) {
+ if (proto) {
WORD status = DBGetContactSettingWord(most_online_im, proto, "Status", ID_STATUS_OFFLINE);
iec.cbSize = sizeof(iec);
- for(i = 0; i < proto_count; i++) {
+ for (i = 0; i < proto_count; i++) {
if (!strcmp((proto_names + i * 128), proto)) {
- if(hExtraImage[i * 2 + (status == ID_STATUS_OFFLINE ? 1 : 0)]) {
+ if (hExtraImage[i * 2 + (status == ID_STATUS_OFFLINE ? 1 : 0)]) {
iec.hImage = hExtraImage[i * 2 + (status == ID_STATUS_OFFLINE ? 1 : 0)];
iec.ColumnType = EXTRA_ICON_ADV2;
CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)wParam, (LPARAM)&iec);
@@ -1172,7 +1173,7 @@ int Meta_CListMW_ExtraIconsApply(WPARAM wParam, LPARAM lParam) { */
int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) {
- if(DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Default",(WORD)-1) == (WORD)-1)
+ if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Default",(WORD)-1) == (WORD)-1)
{
// This is a simple contact
return 0;
@@ -1189,8 +1190,8 @@ int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) { if (!most_online)
return 0;
- if(options.subcontact_windows) {
- if(lParam) {
+ if (options.subcontact_windows) {
+ if (lParam) {
// contact from incoming message in lParam via (at this point) clist message event
CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)lParam, 0);
} else {
@@ -1201,7 +1202,7 @@ int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) { } else {
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
- if(proto) {
+ if (proto) {
strcpy(buffer, proto);
strcat(buffer, PS_GETCAPS);
@@ -1237,7 +1238,7 @@ int NudgeRecieved(WPARAM wParam, LPARAM lParam) { /*
// already being forwarded by someone
HANDLE hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO, "Handle", (DWORD)0);
- if(hMeta)
+ if (hMeta)
NotifyEventHooks(hEventNudge, (WPARAM)hMeta, 0);
*/
return 0;
@@ -1250,15 +1251,14 @@ int NudgeRecieved(WPARAM wParam, LPARAM lParam) { */
int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM menu = {0};
+ CLISTMENUITEM mi = {0};
char buffer[512], buffer2[512], buffer3[512];
int i;
- if(ServiceExists(MS_MSG_GETWINDOWAPI)) {
+ if (ServiceExists(MS_MSG_GETWINDOWAPI))
message_window_api_enabled = TRUE;
- }
- if(ServiceExists(MS_UPDATE_REGISTER)) {
+ if (ServiceExists(MS_UPDATE_REGISTER)) {
// register with updater
Update update = {0};
char szVersion[16];
@@ -1285,19 +1285,17 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
}
-
// disable group hack for older nicer versions without the fix
- if(ServiceExists(MS_CLUI_GETVERSION)) {
+ if (ServiceExists(MS_CLUI_GETVERSION)) {
char *version = (char *)CallService(MS_CLUI_GETVERSION, 0, 0);
- if(version && strlen(version) >= strlen("CList Nicer+") && strncmp(version, "CList Nicer+", strlen("CList Nicer+")) == 0)
+ if (version && strlen(version) >= strlen("CList Nicer+") && strncmp(version, "CList Nicer+", strlen("CList Nicer+")) == 0)
meta_group_hack_disabled = TRUE;
}
// for database editor++ ver 3+
- if(ServiceExists("DBEditorpp/RegisterSingleModule"))
+ if (ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule",(WPARAM)META_PROTO,0);
-
hHooks[11] = (HANDLE)HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Meta_ModifyMenu);
hHooks[12] = (HANDLE)HookEvent(ME_CLIST_DOUBLECLICKED, Meta_ClistDoubleClicked );
//hHooks[13] = (HANDLE)HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, Meta_CListMW_ExtraIconsRebuild);
@@ -1307,56 +1305,60 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) // (BUT, the me_clist_extra_list_rebuild is send FIRST...so, we ignore this one...)
hHooks[15] = 0;//(HANDLE)HookEvent(ME_SKIN_ICONSCHANGED, Meta_LoadIcons);
- menu.cbSize=sizeof(menu);
- menu.flags = CMIM_ALL;
+ mi.cbSize = sizeof(mi);
+ mi.flags = CMIM_ALL;
// main menu item
- menu.pszName = "Toggle MetaContacts Off";
- menu.pszService = "MetaContacts/OnOff";
- menu.position = 500010000;
- hMenuOnOff = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+ mi.pszName = "Toggle MetaContacts Off";
+ mi.pszService = "MetaContacts/OnOff";
+ mi.position = 500010000;
+ hMenuOnOff = Menu_AddMainMenuItem(&mi);
// contact menu items
- menu.position = -200010;
- menu.pszName = "Convert to MetaContact";
- menu.pszService = "MetaContacts/Convert";
- hMenuConvert = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
- menu.position = -200009;
- menu.pszName = "Add to existing MetaContact...";
- menu.pszService = "MetaContacts/AddTo";
- hMenuAdd = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
-
- menu.position = -200010;
- menu.pszName = "Edit MetaContact...";
- menu.pszService = "MetaContacts/Edit";
- hMenuEdit = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
- menu.position = -200009;
- menu.pszName = "Set as MetaContact default";
- menu.pszService = "MetaContacts/Default";
- hMenuDefault = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
- menu.position = -200008;
- menu.pszName = "Delete MetaContact";
- menu.pszService = "MetaContacts/Delete";
- hMenuDelete = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
- //menu.pszName = "Force Default";
- //menu.pszService = "MetaContacts/ForceDefault";
- //hMenuForceDefault = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
-
- menu.flags |= CMIF_HIDDEN;
- menu.pszContactOwner = META_PROTO;
-
- menu.position = -99000;
- for(i = 0; i < MAX_CONTACTS; i++) {
- menu.position--;
+ mi.position = -200010;
+ mi.pszName = "Convert to MetaContact";
+ mi.pszService = "MetaContacts/Convert";
+ hMenuConvert = Menu_AddContactMenuItem(&mi);
+
+ mi.position = -200009;
+ mi.pszName = "Add to existing MetaContact...";
+ mi.pszService = "MetaContacts/AddTo";
+ hMenuAdd = Menu_AddContactMenuItem(&mi);
+
+ mi.position = -200010;
+ mi.pszName = "Edit MetaContact...";
+ mi.pszService = "MetaContacts/Edit";
+ hMenuEdit = Menu_AddContactMenuItem(&mi);
+
+ mi.position = -200009;
+ mi.pszName = "Set as MetaContact default";
+ mi.pszService = "MetaContacts/Default";
+ hMenuDefault = Menu_AddContactMenuItem(&mi);
+
+ mi.position = -200008;
+ mi.pszName = "Delete MetaContact";
+ mi.pszService = "MetaContacts/Delete";
+ hMenuDelete = Menu_AddContactMenuItem(&mi);
+
+ //mi.pszName = "Force Default";
+ //mi.pszService = "MetaContacts/ForceDefault";
+ //hMenuForceDefault = Menu_AddContactMenuItem(&mi);
+
+ mi.flags |= CMIF_HIDDEN;
+ mi.pszContactOwner = META_PROTO;
+
+ mi.position = -99000;
+ for (i = 0; i < MAX_CONTACTS; i++) {
+ mi.position--;
strcpy(buffer3, (char *)Translate("Context"));
strcat(buffer3, _itoa(i, buffer2, 10));
- menu.pszName = buffer3;
+ mi.pszName = buffer3;
strcpy(buffer, "MetaContacts/MenuFunc");
strcat(buffer, _itoa(i, buffer2, 10));
- menu.pszService= buffer;
+ mi.pszService= buffer;
- hMenuContact[i] = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
+ hMenuContact[i] = Menu_AddContactMenuItem(&mi);
}
nextMetaID = DBGetContactSettingDword(NULL,META_PROTO,"NextMetaID",(DWORD)0);
@@ -1365,7 +1367,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) //hHooks[] = (HANDLE)HookEvent(ME_USERINFO_INITIALISE, Meta_UserInfo);
// loop and copy data from subcontacts
- if(options.copydata) {
+ if (options.copydata) {
HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
int meta_id;
while ( hContact != NULL ) {
@@ -1383,9 +1385,9 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) if (!Meta_IsEnabled())
{
// modify main menu item
- menu.flags = CMIM_NAME;
- menu.pszName = "Toggle MetaContacts On";
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&menu);
+ mi.flags = CMIM_NAME;
+ mi.pszName = "Toggle MetaContacts On";
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&mi);
Meta_HideMetaContacts(TRUE);
} else {
@@ -1394,7 +1396,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) // hook srmm window close/open events - message api ver 0.0.0.1+
hHooks[16] = (HANDLE)HookEvent(ME_MSG_WINDOWEVENT, Meta_MessageWindowEvent);
- if(hHooks[16]) // message api available
+ if (hHooks[16]) // message api available
message_window_api_enabled = TRUE;
// hook protocol nudge events to forward to subcontacts
@@ -1404,16 +1406,16 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) HANDLE hNudgeEvent = NULL;
PROTOCOLDESCRIPTOR ** ppProtocolDescriptors;
ret = CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM) &numberOfProtocols,(LPARAM)&ppProtocolDescriptors);
- if(ret == 0)
+ if (ret == 0)
{
- for(i = 0; i < numberOfProtocols ; i++)
+ for (i = 0; i < numberOfProtocols ; i++)
{
- if(ppProtocolDescriptors[i]->type == PROTOTYPE_PROTOCOL)
+ if (ppProtocolDescriptors[i]->type == PROTOTYPE_PROTOCOL)
{
- if(strcmp(ppProtocolDescriptors[i]->szName, META_PROTO)) {
+ if (strcmp(ppProtocolDescriptors[i]->szName, META_PROTO)) {
sprintf(str,"%s/Nudge",ppProtocolDescriptors[i]->szName);
hNudgeEvent = HookEvent(str, NudgeRecieved);
- if(hNudgeEvent != NULL) {
+ if (hNudgeEvent != NULL) {
++iNudgeProtos;
hNudgeEvents = realloc(hNudgeEvents, sizeof(HANDLE) * iNudgeProtos);
hNudgeEvents[iNudgeProtos - 1] = hNudgeEvent;
@@ -1449,7 +1451,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { HANDLE hContact;
hContact = Meta_GetContactHandle((HANDLE)wParam, (int)lParam);
- if(options.menu_function == FT_MSG) {
+ if (options.menu_function == FT_MSG) {
// open message window if protocol supports message sending or chat, else simulate double click
int caps;
@@ -1458,7 +1460,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if(proto) {
+ if (proto) {
strcpy(buffer, proto);
strcat(buffer, PS_GETCAPS);
@@ -1476,10 +1478,10 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { // protocol does not support messaging - simulate double click
CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)hContact, 0);
- } else if(options.menu_function == FT_MENU) {
+ } else if (options.menu_function == FT_MENU) {
// show contact's context menu
CallFunctionAsync(sttMenuThread, hContact);
- } else if(options.menu_function == FT_INFO) {
+ } else if (options.menu_function == FT_INFO) {
// show user info for subcontact
CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
}
@@ -1497,7 +1499,7 @@ INT_PTR Meta_FileResume(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
- if(DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
+ if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1534,7 +1536,7 @@ INT_PTR Meta_FileAllow(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
- if(DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
+ if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1570,7 +1572,7 @@ INT_PTR Meta_FileDeny(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
- if(DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
+ if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1607,7 +1609,7 @@ INT_PTR Meta_FileRecv(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
- if(DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
+ if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1645,7 +1647,7 @@ int Meta_FileCancel(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam;
char *proto = 0;
- if(DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
+ if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1706,7 +1708,7 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam) proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
//Meta_CopyContactNick(ccs->hContact, most_online, proto);
- if(proto) {
+ if (proto) {
//ccs->hContact = most_online;
//Meta_SetNick(proto);
@@ -1892,25 +1894,25 @@ int Meta_CallMostOnline(WPARAM wParam, LPARAM lParam) { INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam) {
- CLISTMENUITEM menu;
- menu.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM mi;
+ mi.cbSize = sizeof(CLISTMENUITEM);
// just write to db - the rest is handled in the Meta_SettingChanged function
- if(DBGetContactSettingByte(0, META_PROTO, "Enabled", 1)) {
+ if (DBGetContactSettingByte(0, META_PROTO, "Enabled", 1)) {
DBWriteContactSettingByte(0, META_PROTO, "Enabled", 0);
- // modify main menu item
- menu.flags = CMIM_NAME | CMIM_ICON;
- menu.hIcon = LoadIconEx(I_MENU);
- menu.pszName = "Toggle MetaContacts On";
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&menu);
+ // modify main mi item
+ mi.flags = CMIM_NAME | CMIM_ICON;
+ mi.hIcon = LoadIconEx(I_MENU);
+ mi.pszName = "Toggle MetaContacts On";
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&mi);
} else {
DBWriteContactSettingByte(0, META_PROTO, "Enabled", 1);
- // modify main menu item
- menu.flags = CMIM_NAME | CMIM_ICON;
- menu.hIcon = LoadIconEx(I_MENUOFF);
- menu.pszName = "Toggle MetaContacts Off";
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&menu);
+ // modify main mi item
+ mi.flags = CMIM_NAME | CMIM_ICON;
+ mi.hIcon = LoadIconEx(I_MENUOFF);
+ mi.pszName = "Toggle MetaContacts Off";
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&mi);
}
- ReleaseIconEx(menu.hIcon);
+ ReleaseIconEx(mi.hIcon);
return 0;
}
@@ -1924,7 +1926,7 @@ int Meta_PreShutdown(WPARAM wParam, LPARAM lParam) { //MessageBox(0, "Status is OFFLINE", "MC", MB_OK);
//MessageBox(0, "Preshutdown complete", "MC", MB_OK);
- if(setStatusTimerId) KillTimer(0, setStatusTimerId);
+ if (setStatusTimerId) KillTimer(0, setStatusTimerId);
return 0;
}
@@ -1949,9 +1951,9 @@ void Meta_InitServices() previousMode = mcStatus = ID_STATUS_OFFLINE;
// set hooks pointers and services pointers to zero - in case we do not initialize them all correctly
- for(i=0;i<NB_HOOKS;i++)
+ for (i=0;i<NB_HOOKS;i++)
hHooks[i] = 0;
- for(i=0;i<NB_SERVICES;i++)
+ for (i=0;i<NB_SERVICES;i++)
hServices[i] = 0;
hServices[0] = CreateServiceFunction("MetaContacts/Convert",Meta_Convert);
@@ -2077,17 +2079,17 @@ void Meta_CloseHandles() {
int i;
- for(i=0;i<iNudgeProtos;i++) // Idem for the hooks.
+ for (i=0;i<iNudgeProtos;i++) // Idem for the hooks.
{
UnhookEvent(hNudgeEvents[i]);
}
free(hNudgeEvents);
iNudgeProtos = 0;
- for(i=0;i<NB_HOOKS;i++) // Idem for the hooks.
- if(hHooks[i]) UnhookEvent(hHooks[i]);
+ for (i=0;i<NB_HOOKS;i++) // Idem for the hooks.
+ if (hHooks[i]) UnhookEvent(hHooks[i]);
- if(ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
+ if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
proto_count = 0;
}
@@ -2099,8 +2101,8 @@ void Meta_CloseHandles() DestroyHookableEvent(hEventNudge);
// lets leave them, hey? (why?)
- for(i=0;i<NB_SERVICES;i++) // Scan each 'HANDLE' and Destroy the service attached to it.
- if(hServices[i]) DestroyServiceFunction(hServices[i]);
+ for (i=0;i<NB_SERVICES;i++) // Scan each 'HANDLE' and Destroy the service attached to it.
+ if (hServices[i]) DestroyServiceFunction(hServices[i]);
DeinitIcons();
}
diff --git a/plugins/MetaContacts/meta_utils.c b/plugins/MetaContacts/meta_utils.c index ccee31e2a5..9fa350497f 100644 --- a/plugins/MetaContacts/meta_utils.c +++ b/plugins/MetaContacts/meta_utils.c @@ -43,7 +43,7 @@ INT_PTR MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char if (!strsvcset) {strsvc = ServiceExists(MS_DB_CONTACT_GETSETTING_STR); strsvcset = TRUE;}
// preserve unicode strings - this service should return other data types unchanged
- if(strsvc) return DBGetContactSettingW(hContact, szModule, szSetting, dbv);
+ if (strsvc) return DBGetContactSettingW(hContact, szModule, szSetting, dbv);
return DBGetContactSetting(hContact, szModule, szSetting, dbv);
}
@@ -51,7 +51,7 @@ INT_PTR MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id) {
DWORD res = 1;
int i;
- if(dbv->type == id->type)
+ if (dbv->type == id->type)
{ // If the id parameter and the value returned by the DBGetContactSetting
// are the same, this is the correct HANDLE, return it.
switch(dbv->type)
@@ -59,13 +59,13 @@ int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id) { case DBVT_DELETED:
return 1;
case DBVT_BYTE:
- if(dbv->bVal == id->bVal)
+ if (dbv->bVal == id->bVal)
return 1;
case DBVT_WORD:
- if(dbv->wVal == id->wVal)
+ if (dbv->wVal == id->wVal)
return 1;
case DBVT_DWORD:
- if(dbv->dVal == id->dVal)
+ if (dbv->dVal == id->dVal)
return 1;
break;
case DBVT_ASCIIZ:
@@ -76,18 +76,18 @@ int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id) { if (!wcscmp(dbv->pwszVal,id->pwszVal))
return 1;
case DBVT_BLOB:
- if(dbv->cpbVal == id->cpbVal)
+ if (dbv->cpbVal == id->cpbVal)
{
- for(i=dbv->cpbVal;res && i<=0;i--)
+ for (i=dbv->cpbVal;res && i<=0;i--)
res = (dbv->pbVal[i] == id->pbVal[i]);
- if(res)
+ if (res)
{
return 1;
}
}
break;
} // end switch
- } // end if(dbv.type == id.type)
+ } // end if (dbv.type == id.type)
return 0;
}
@@ -119,7 +119,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) { // Scan the database and retrieve the field for each contact
if (!DBGetContactSetting(hUser,protocol,field,&dbv))
{
- if(dbv.type == id->type)
+ if (dbv.type == id->type)
{ // If the id parameter and the value returned by the DBGetContactSetting
// are the same, this is the correct HANDLE, return it.
switch(dbv.type)
@@ -127,15 +127,15 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) case DBVT_DELETED:
break;
case DBVT_BYTE:
- if(dbv.bVal == id->bVal)
+ if (dbv.bVal == id->bVal)
return hUser;
break;
case DBVT_WORD:
- if(dbv.wVal == id->wVal)
+ if (dbv.wVal == id->wVal)
return hUser;
break;
case DBVT_DWORD:
- if(dbv.dVal == id->dVal)
+ if (dbv.dVal == id->dVal)
return hUser;
break;
case DBVT_ASCIIZ:
@@ -162,11 +162,11 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) break;
}
case DBVT_BLOB:
- if(dbv.cpbVal == id->cpbVal)
+ if (dbv.cpbVal == id->cpbVal)
{
- for(i=dbv.cpbVal;res && i<=0;i--)
+ for (i=dbv.cpbVal;res && i<=0;i--)
res = (dbv.pbVal[i] == id->pbVal[i]);
- if(res)
+ if (res)
{
DBFreeVariant(&dbv);
return hUser;
@@ -201,29 +201,29 @@ int Meta_SetNick(char *proto) ci.dwFlag = CNF_DISPLAY;
ci.hContact = NULL;
ci.szProto = proto;
- if(CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci))
+ if (CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci))
return 1;
switch(ci.type)
{
case CNFT_BYTE:
- if(DBWriteContactSettingByte(NULL,META_PROTO,"Nick",ci.bVal))
+ if (DBWriteContactSettingByte(NULL,META_PROTO,"Nick",ci.bVal))
return 1;
break;
case CNFT_WORD:
- if(DBWriteContactSettingWord(NULL,META_PROTO,"Nick",ci.wVal))
+ if (DBWriteContactSettingWord(NULL,META_PROTO,"Nick",ci.wVal))
return 1;
break;
case CNFT_DWORD:
- if(DBWriteContactSettingDword(NULL,META_PROTO,"Nick",ci.dVal))
+ if (DBWriteContactSettingDword(NULL,META_PROTO,"Nick",ci.dVal))
return 1;
break;
case CNFT_ASCIIZ:
- if(DBWriteContactSettingString(NULL,META_PROTO,"Nick",ci.pszVal))
+ if (DBWriteContactSettingString(NULL,META_PROTO,"Nick",ci.pszVal))
return 1;
mir_free(ci.pszVal);
break;
default:
- if(DBWriteContactSettingString(NULL,META_PROTO,"Nick",(char *)Translate("Sender")))
+ if (DBWriteContactSettingString(NULL,META_PROTO,"Nick",(char *)Translate("Sender")))
return 1;
break;
}
@@ -264,20 +264,20 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // Get the login of the subcontact
field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
- if(DBGetContactSetting(src,proto,field,&cws.value)) {
+ if (DBGetContactSetting(src,proto,field,&cws.value)) {
MessageBox(0, Translate("Could not get unique id of contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Check that is is 'on the list'
- if(DBGetContactSettingByte(src, "CList", "NotOnList", 0) == 1) {
+ if (DBGetContactSettingByte(src, "CList", "NotOnList", 0) == 1) {
MessageBox(0, Translate("Contact is 'Not on List' - please add the contact to your contact list before assigning."), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
DBFreeVariant(&cws.value);
return FALSE;
}
num_contacts++;
- if(num_contacts >= MAX_CONTACTS) {
+ if (num_contacts >= MAX_CONTACTS) {
MessageBox(0, Translate("MetaContact is full"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
DBFreeVariant(&cws.value);
return FALSE;
@@ -287,7 +287,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) strcpy(buffer, "Protocol");
strcat(buffer, _itoa((int)(num_contacts -1), buffer2, 10));
- if(DBWriteContactSettingString(dest, META_PROTO, buffer, proto)) {
+ if (DBWriteContactSettingString(dest, META_PROTO, buffer, proto)) {
MessageBox(0, Translate("Could not write contact protocol to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
DBFreeVariant(&cws.value);
return FALSE;
@@ -300,7 +300,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) cws.szModule=META_PROTO;
cws.szSetting=buffer;
- if(CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
+ if (CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
MessageBox(0, Translate("Could not write unique id of contact to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
DBFreeVariant(&cws.value);
return FALSE;
@@ -317,7 +317,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) cws.szModule=META_PROTO;
cws.szSetting=buffer;
- if(CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
+ if (CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
MessageBox(0, Translate("Could not write nickname of contact to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -334,7 +334,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) strcpy(buffer, "CListName");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
- if(wname && strncmp(name, (char *)wname, strlen(name)) != 0) {
+ if (wname && strncmp(name, (char *)wname, strlen(name)) != 0) {
DBWriteContactSettingWString(dest, META_PROTO, buffer, wname);
} else
DBWriteContactSettingString(dest, META_PROTO, buffer, name);
@@ -349,7 +349,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // write the status
strcpy(buffer, "Status");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
- if(DBWriteContactSettingWord(dest, META_PROTO, buffer, status)) {
+ if (DBWriteContactSettingWord(dest, META_PROTO, buffer, status)) {
MessageBox(0, Translate("Could not write contact status to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -357,7 +357,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // write the handle
strcpy(buffer, "Handle");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
- if(DBWriteContactSettingDword(dest, META_PROTO, buffer, (DWORD)src)) {
+ if (DBWriteContactSettingDword(dest, META_PROTO, buffer, (DWORD)src)) {
MessageBox(0, Translate("Could not write contact handle to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -366,7 +366,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) strcpy(buffer, "StatusString");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
Meta_GetStatusString(status, buffer2, 512);
- if(DBWriteContactSettingString(dest, META_PROTO, buffer, buffer2)) {
+ if (DBWriteContactSettingString(dest, META_PROTO, buffer, buffer2)) {
MessageBox(0, Translate("Could not write contact status string to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -377,30 +377,30 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) CallService( MS_PROTO_ADDTOCONTACT, (WPARAM)src, ( LPARAM )META_FILTER );
// Write the link in the contact
- if(DBWriteContactSettingDword(src,META_PROTO,META_LINK,metaID)) {
+ if (DBWriteContactSettingDword(src,META_PROTO,META_LINK,metaID)) {
MessageBox(0, Translate("Could not write MetaContact id to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Write the contact number in the contact
- if(DBWriteContactSettingDword(src,META_PROTO,"ContactNumber",(DWORD)(num_contacts - 1))) {
+ if (DBWriteContactSettingDword(src,META_PROTO,"ContactNumber",(DWORD)(num_contacts - 1))) {
MessageBox(0, Translate("Could not write MetaContact contact number to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Write the handle in the contact
- if(DBWriteContactSettingDword(src,META_PROTO,"Handle",(DWORD)dest)) {
+ if (DBWriteContactSettingDword(src,META_PROTO,"Handle",(DWORD)dest)) {
MessageBox(0, Translate("Could not write MetaContact contact number to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// update count of contacts
- if(DBWriteContactSettingDword(dest,META_PROTO,"NumContacts",num_contacts)) {
+ if (DBWriteContactSettingDword(dest,META_PROTO,"NumContacts",num_contacts)) {
MessageBox(0, Translate("Could not write contact count to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
- if(set_as_default) {
+ if (set_as_default) {
DBWriteContactSettingDword(dest, META_PROTO, "Default", (WORD)(num_contacts - 1));
NotifyEventHooks(hEventDefaultChanged, (WPARAM)dest, (LPARAM)src);
}
@@ -415,7 +415,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // if the new contact is the most online contact with avatar support, get avatar info
most_online = Meta_GetMostOnlineSupporting(dest, PFLAGNUM_4, PF4_AVATARS);
- if(most_online == src) {
+ if (most_online == src) {
PROTO_AVATAR_INFORMATION AI;
AI.cbSize = sizeof(AI);
@@ -431,11 +431,11 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) Meta_SetGroup(src);
// copy history
- if(options.copy_subcontact_history)
+ if (options.copy_subcontact_history)
copyHistory(src, dest);
// Ignore status if the option is on
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_IGNORE, (WPARAM)src, (WPARAM)IGNOREEVENT_USERONLINE);
// copy other data
@@ -477,36 +477,36 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca }
// if the default is beyond the end of the list (eek!) return null
- if(default_contact_number >= (num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0)))
+ if (default_contact_number >= (num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0)))
return NULL;
most_online_contact = Meta_GetContactHandle(hMeta, default_contact_number);
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online_contact, 0);
caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
- if(proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
+ if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
// we are forced to do use default for sending - '-1' capability indicates no specific capability, but respect 'Force Default'
- if(proto && DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0) && capability != 0 && (capability == -1 || (caps & capability) == capability)) // capability is 0 when we're working out status
+ if (proto && DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0) && capability != 0 && (capability == -1 || (caps & capability) == capability)) // capability is 0 when we're working out status
return most_online_contact;
// a subcontact is being temporarily 'forced' to do sending
if ((most_online_contact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0))) {
caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
- if(proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
- if(proto && (caps & capability) == capability && capability != 0) // capability is 0 when we're working out status
+ if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
+ if (proto && (caps & capability) == capability && capability != 0) // capability is 0 when we're working out status
return most_online_contact;
}
most_online_contact = Meta_GetContactHandle(hMeta, default_contact_number);
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online_contact, 0);
- if(proto && CallProtoService(proto, PS_GETSTATUS, 0, 0) >= ID_STATUS_ONLINE) {
+ if (proto && CallProtoService(proto, PS_GETSTATUS, 0, 0) >= ID_STATUS_ONLINE) {
caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
- if(proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
- if(proto && (capability == -1 || (caps & capability) == capability)) {
+ if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
+ if (proto && (capability == -1 || (caps & capability) == capability)) {
most_online_status = DBGetContactSettingWord(most_online_contact, proto, "Status", ID_STATUS_OFFLINE);
// if our default is not offline, and option to use default is set - return default
// and also if our default is online, return it
- if(most_online_status == ID_STATUS_ONLINE || (most_online_status != ID_STATUS_OFFLINE && options.always_use_default)) {
+ if (most_online_status == ID_STATUS_ONLINE || (most_online_status != ID_STATUS_OFFLINE && options.always_use_default)) {
return most_online_contact;
}
} else
@@ -516,8 +516,8 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca most_online_proto = proto;
// otherwise, check all the subcontacts for the one closest to the ONLINE state which supports the required capability
- for(i = 0; i < num_contacts; i++) {
- if(i == default_contact_number) // already checked that (i.e. initial value of most_online_contact and most_online_status are those of the default contact)
+ for (i = 0; i < num_contacts; i++) {
+ if (i == default_contact_number) // already checked that (i.e. initial value of most_online_contact and most_online_status are those of the default contact)
continue;
hContact = Meta_GetContactHandle(hMeta, i);
@@ -527,19 +527,19 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca continue;
caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
- if(proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
- if(proto && (capability == -1 || (caps & capability) == capability)) {
+ if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
+ if (proto && (capability == -1 || (caps & capability) == capability)) {
status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
- if(status == ID_STATUS_ONLINE) {
+ if (status == ID_STATUS_ONLINE) {
most_online_contact = hContact;
most_online_proto = proto;
return most_online_contact;
- } else if(status <= ID_STATUS_OFFLINE) // status below ID_STATUS_OFFLINE is a connecting status
+ } else if (status <= ID_STATUS_OFFLINE) // status below ID_STATUS_OFFLINE is a connecting status
continue;
else {
- if(GetRealPriority(proto, status) < GetRealPriority(most_online_proto, most_online_status)) {
+ if (GetRealPriority(proto, status) < GetRealPriority(most_online_proto, most_online_status)) {
most_online_status = status;
most_online_contact = hContact;
most_online_proto = proto;
@@ -549,9 +549,9 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca }
// no online contacts? if we're trying to message, use 'send offline' contact
- if(most_online_status == ID_STATUS_OFFLINE && capability == PF1_IM) {
+ if (most_online_status == ID_STATUS_OFFLINE && capability == PF1_IM) {
HANDLE hOffline = Meta_GetContactHandle(hMeta, DBGetContactSettingDword(hMeta, META_PROTO, "OfflineSend", (DWORD)-1));
- if(hOffline)
+ if (hOffline)
most_online_contact = hOffline;
}
@@ -563,7 +563,7 @@ int Meta_GetContactNumber(HANDLE hContact) { }
BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) {
- if(dbv1->type != dbv2->type) return FALSE;
+ if (dbv1->type != dbv2->type) return FALSE;
switch(dbv1->type) {
case DBVT_BYTE:
@@ -597,36 +597,36 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { BOOL use_default = FALSE;
int source_contact = (use_default ? default_contact : most_online);
- if(source_contact < 0 || source_contact >= num_contacts) return;
+ if (source_contact < 0 || source_contact >= num_contacts) return;
- for(i = 0; i < num_settings; i++) {
+ for (i = 0; i < num_settings; i++) {
bDataWritten = FALSE;
- for(j = 0; j < num_contacts && !bDataWritten; j++) {
+ for (j = 0; j < num_contacts && !bDataWritten; j++) {
// do source (most online) first
- if(j == 0)
+ if (j == 0)
hContact = Meta_GetContactHandle(hMeta, source_contact);
- else if(j <= source_contact)
+ else if (j <= source_contact)
hContact = Meta_GetContactHandle(hMeta, j - 1);
else
hContact = Meta_GetContactHandle(hMeta, j);
- if(hContact) {
+ if (hContact) {
if (!module) {
used_mod = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (!used_mod) continue; // next contact
} else
used_mod = module;
- if(j == 0 && strcmp(settings[i], "MirVer") == 0) { //Always reset MirVer
+ if (j == 0 && strcmp(settings[i], "MirVer") == 0) { //Always reset MirVer
DBDeleteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i]);
}
got_val = !MyDBGetContactSetting(hContact, used_mod, settings[i], &dbv2);
- if(got_val) {
+ if (got_val) {
free = !MyDBGetContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv1);
- if(strcmp(settings[i], "MirVer") == 0) {
- if(DBGetContactSettingWord(hContact, used_mod, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ if (strcmp(settings[i], "MirVer") == 0) {
+ if (DBGetContactSettingWord(hContact, used_mod, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
if (!free || (dbv1.pszVal == NULL || strcmp(dbv1.pszVal, "") == 0 || strlen(dbv1.pszVal) < 2)) {
MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
bDataWritten = TRUE; //only break if found something to copy
@@ -636,11 +636,11 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { } else {
if (!free || !dbv_same(&dbv1, &dbv2)) {
MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
- if(dbv2.type == DBVT_ASCIIZ || dbv2.type == DBVT_UTF8) {
- if(dbv2.pszVal != NULL && strcmp(dbv2.pszVal, "") != 0)
+ if (dbv2.type == DBVT_ASCIIZ || dbv2.type == DBVT_UTF8) {
+ if (dbv2.pszVal != NULL && strcmp(dbv2.pszVal, "") != 0)
bDataWritten = TRUE; //only break if found something to copy
- } else if(dbv2.type == DBVT_WCHAR) {
- if(dbv2.pwszVal != 0 && wcscmp(dbv2.pwszVal, L"") != 0)
+ } else if (dbv2.type == DBVT_WCHAR) {
+ if (dbv2.pwszVal != 0 && wcscmp(dbv2.pwszVal, L"") != 0)
bDataWritten = TRUE; //only break if found something to copy
} else
bDataWritten = TRUE; //only break if found something to copy
@@ -650,7 +650,7 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { }
DBFreeVariant(&dbv2);
- if(free)DBFreeVariant(&dbv1);
+ if (free)DBFreeVariant(&dbv1);
}
}
}
@@ -695,17 +695,17 @@ void CopyStatusData(HANDLE hMeta) { BOOL bDoneStatus = FALSE, bDoneXStatus = FALSE;
int i;
- for(i = 0; i < num_contacts; i++) {
- if(i == 0)
+ for (i = 0; i < num_contacts; i++) {
+ if (i == 0)
hContact = Meta_GetContactHandle(hMeta, most_online);
- else if(i <= most_online)
+ else if (i <= most_online)
hContact = Meta_GetContactHandle(hMeta, i - 1);
else
hContact = Meta_GetContactHandle(hMeta, i);
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if(proto && DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE) == status) {
+ if (proto && DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE) == status) {
if (!bDoneStatus && !MyDBGetContactSetting(hContact, "CList", "StatusMsg", &dbv)) {
MyDBWriteContactSetting(hMeta, "CList", "StatusMsg", &dbv);
DBFreeVariant(&dbv);
@@ -728,7 +728,7 @@ void CopyStatusData(HANDLE hMeta) { }
}
- if(bDoneStatus && bDoneXStatus) break;
+ if (bDoneStatus && bDoneXStatus) break;
}
if (!bDoneStatus) DBDeleteContactSetting(hMeta, "CList", "StatusMsg");
@@ -740,14 +740,14 @@ void CopyStatusData(HANDLE hMeta) { }
void Meta_CopyData(HANDLE hMeta) {
- if(options.copydata) {
+ if (options.copydata) {
CopyStatusData(hMeta);
copy_settings_array(hMeta, 0, ProtoSettings, 25);
copy_settings_array(hMeta, "mBirthday", UserInfoSettings, 3);
copy_settings_array(hMeta, "ContactPhoto", ContactPhotoSettings, 5);
- if(options.copy_userinfo)
+ if (options.copy_userinfo)
copy_settings_array(hMeta, "UserInfo", UserInfoSettings, 71);
}
}
@@ -757,7 +757,7 @@ HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number) { char buffer[512], buffer2[512];
int num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0);
- if(contact_number >= num_contacts || contact_number < 0) return 0;
+ if (contact_number >= num_contacts || contact_number < 0) return 0;
strcpy(buffer, "Handle");
strcat(buffer, _itoa(contact_number, buffer2, 10));
@@ -784,7 +784,7 @@ int Meta_SetHandles(void) { strcat(nick_buffer, ", contact num: ");
strcat(nick_buffer, _itoa(contact_number, buffer2, 10));
- if(contact_number < 0) {
+ if (contact_number < 0) {
// problem!
MessageBox(0, "Subcontact contact number < 0 - deleting MetaContact", nick_buffer, MB_OK | MB_ICONERROR);
//CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0);
@@ -804,7 +804,7 @@ int Meta_SetHandles(void) { hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
while ( hContact2 != NULL ) {
- if(DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
+ if (DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
found = TRUE;
// set handle
@@ -815,7 +815,7 @@ int Meta_SetHandles(void) { (unsigned char)(DBGetContactSettingByte(hContact2, META_PROTO, "ContactCountCheck", 0) + 1));
num_contacts = DBGetContactSettingDword(hContact2, META_PROTO, "NumContacts", (DWORD)-1);
- if(contact_number >= 0 && contact_number < num_contacts) {
+ if (contact_number >= 0 && contact_number < num_contacts) {
// set metacontact's handle to us
strcpy(buffer, "Handle");
strcat(buffer, _itoa((int)contact_number, buffer2, 10));
@@ -851,7 +851,7 @@ int Meta_SetHandles(void) { CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)META_FILTER);
// stop ignoring, if we were
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
} else {
@@ -876,7 +876,7 @@ int Meta_SetHandles(void) { contact_number = DBGetContactSettingDword(hContact, META_PROTO, "Default", -1);
num_contacts = DBGetContactSettingDword(hContact, META_PROTO, "NumContacts", (DWORD)-1);
- if(num_contacts < 0) {
+ if (num_contacts < 0) {
// problem
MessageBox(0, "MetaContact number of contacts < 0 - deleting MetaContact", nick_buffer, MB_OK | MB_ICONERROR);
//CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0);
@@ -887,7 +887,7 @@ int Meta_SetHandles(void) { //return 1;
}
- if(contact_number < 0 || contact_number >= num_contacts) {
+ if (contact_number < 0 || contact_number >= num_contacts) {
// problem
MessageBox(0, "MetaContact default contact number out of range - deleting MetaContact", nick_buffer, MB_OK | MB_ICONERROR);
hNextContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
@@ -911,9 +911,9 @@ int Meta_SetHandles(void) { strcat(nick_buffer, _itoa(meta_id, buffer2, 10));
num_contacts = DBGetContactSettingByte(hContact, META_PROTO, "ContactCountCheck", -2);
- if(num_contacts != (DWORD)DBGetContactSettingDword(hContact, META_PROTO, "NumContacts", (DWORD)-1)) {
+ if (num_contacts != (DWORD)DBGetContactSettingDword(hContact, META_PROTO, "NumContacts", (DWORD)-1)) {
// mismatch
- //if(MessageBox(0, Translate("MetaContact corrupted - the number of subcontacts is incorrect.\nDelete MetaContact?"), nick_buffer, MB_YESNO | MB_ICONERROR) == IDYES) {
+ //if (MessageBox(0, Translate("MetaContact corrupted - the number of subcontacts is incorrect.\nDelete MetaContact?"), nick_buffer, MB_YESNO | MB_ICONERROR) == IDYES) {
// Meta_Delete((WPARAM)hContact, (LPARAM)1); // second param prevents confirm dialog
//} else
// return 1;
@@ -950,7 +950,7 @@ int Meta_HideLinkedContacts(void) { // (sometimes protocol server side groups are to blame - msn and icq)
if (!meta_group_hack_disabled) do {
group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0);
- if(group_name && !strcmp(group_name, META_HIDDEN_GROUP)) {
+ if (group_name && !strcmp(group_name, META_HIDDEN_GROUP)) {
// disabled because it shows a message box
//CallService(MS_CLIST_GROUPDELETE, (WPARAM)hGroup, 0);
MessageBox(0, Translate("The 'MetaContacts Hidden Group' has been added to your contact list.\n"
@@ -988,9 +988,9 @@ int Meta_HideLinkedContacts(void) { hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
while ( hContact2 != NULL ) {
- if(DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
+ if (DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
num_contacts = DBGetContactSettingDword(hContact2, META_PROTO, "NumContacts", (DWORD)-1);
- if(contact_number >= 0 && contact_number < num_contacts) {
+ if (contact_number >= 0 && contact_number < num_contacts) {
if (!proto)
status = ID_STATUS_OFFLINE;
@@ -1003,14 +1003,14 @@ int Meta_HideLinkedContacts(void) { DBWriteContactSettingWord(hContact2, META_PROTO, buffer, status);
// update metacontact's record of nick for this contact
- if(proto && !DBGetContactSetting(hContact, proto, "Nick", &dbv)) {
+ if (proto && !DBGetContactSetting(hContact, proto, "Nick", &dbv)) {
strcpy(buffer, "Nick");
strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- if(DBGetContactSetting(hContact, "CList", "MyHandle", &dbv2)) {
+ if (DBGetContactSetting(hContact, "CList", "MyHandle", &dbv2)) {
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
} else {
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv2);
@@ -1032,7 +1032,7 @@ int Meta_HideLinkedContacts(void) { hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact2, 0 );
}
- if(options.suppress_status)
+ if (options.suppress_status)
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
@@ -1042,7 +1042,7 @@ int Meta_HideLinkedContacts(void) { // do metacontacts after handles set properly above
hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
while ( hContact != NULL ) {
- if(DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
// is a meta contact
HANDLE hMostOnline = Meta_GetMostOnline(hContact); // set nick
Meta_CopyContactNick(hContact, hMostOnline);
@@ -1065,7 +1065,7 @@ int Meta_UnhideLinkedContacts(void) { HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
while ( hContact != NULL ) {
- if(DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// has a link - unhide it
// restore old group
Meta_RestoreGroup(hContact);
@@ -1083,21 +1083,21 @@ int Meta_HideMetaContacts(int hide) { HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
// set status suppression
- if(hide) Meta_SuppressStatus(FALSE);
+ if (hide) Meta_SuppressStatus(FALSE);
else Meta_SuppressStatus(options.suppress_status);
while ( hContact != NULL ) {
- if(DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
// is a meta contact
- if(hide)
+ if (hide)
DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
else
DBDeleteContactSetting(hContact, "CList", "Hidden");
- } else if(DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ } else if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// when metacontacts are hidden, show subcontacts, and vice versa
- if(hide) {
+ if (hide) {
Meta_RestoreGroup(hContact);
} else {
Meta_SetGroup(hContact);
@@ -1114,16 +1114,16 @@ int Meta_HideMetaContacts(int hide) { void Meta_RestoreGroup(HANDLE hContact) {
- if(meta_group_hack_disabled) return; // clist has called api function to disable group hack - yay!
+ if (meta_group_hack_disabled) return; // clist has called api function to disable group hack - yay!
// the existence of this service means that clist_meta_mw is active and will do the hiding for us
- if(ServiceExists(MS_CLUI_METASUPPORT)) return;
+ if (ServiceExists(MS_CLUI_METASUPPORT)) return;
// show it anyway - users are reporting contacts removed from meta remain 'hidden'
// possible suspect - server side groups cause hidden group hack to fail, users hide contacts via clist->delete->hide option
DBDeleteContactSetting(hContact, META_PROTO, "Hidden");
- if(DBGetContactSettingByte(hContact, META_PROTO, "Hidden", 0) == 1)
+ if (DBGetContactSettingByte(hContact, META_PROTO, "Hidden", 0) == 1)
{
// if we hid it, unhide it
DBDeleteContactSetting(hContact, META_PROTO, "Hidden");
@@ -1141,14 +1141,14 @@ void Meta_RestoreGroup(HANDLE hContact) { BOOL found = FALSE;
do {
name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0);
- if(name && !strcmp(name, cws.value.pszVal)) {
+ if (name && !strcmp(name, cws.value.pszVal)) {
found = TRUE;
break;
}
hGroup++;
} while(name);
- if(found) {
+ if (found) {
cws.szModule = "CList";
cws.szSetting = "Group";
CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
@@ -1157,7 +1157,7 @@ void Meta_RestoreGroup(HANDLE hContact) { // put back into metacontact's group
DBVARIANT dbv;
HANDLE hMeta = (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0);
- if(hMeta && !MyDBGetContactSetting(hMeta, "CList", "Group", &dbv)) {
+ if (hMeta && !MyDBGetContactSetting(hMeta, "CList", "Group", &dbv)) {
MyDBWriteContactSetting(hContact, "CList", "Group", &dbv);
DBFreeVariant(&dbv);
} else
@@ -1184,16 +1184,16 @@ void Meta_RestoreGroup(HANDLE hContact) { void Meta_SetGroup(HANDLE hContact) {
char *proto, *uid;
- if(meta_group_hack_disabled) return; // clist has called api function to disable group hack - yay!
+ if (meta_group_hack_disabled) return; // clist has called api function to disable group hack - yay!
// the existence of this service means that clist_meta_mw is active and will do the hiding for us
- if(ServiceExists(MS_CLUI_METASUPPORT)) return;
+ if (ServiceExists(MS_CLUI_METASUPPORT)) return;
proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (proto)
uid = (char *)CallProtoService(proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if(proto && uid && (INT_PTR)uid != CALLSERVICE_NOTFOUND && !strcmp(JABBER_UNIQUE_ID_SETTING, uid)) {
+ if (proto && uid && (INT_PTR)uid != CALLSERVICE_NOTFOUND && !strcmp(JABBER_UNIQUE_ID_SETTING, uid)) {
// if it's a jabber contact, hide it, and record the fact that it was us who did
DBWriteContactSettingByte(hContact, META_PROTO, "Hidden", 1);
DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
@@ -1261,9 +1261,9 @@ int Meta_SuppressStatus(BOOL suppress) { HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
while ( hContact != NULL ) {
- if(DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// is a subcontact
- if(suppress)
+ if (suppress)
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
else
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
@@ -1279,7 +1279,7 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { DBVARIANT dbv, dbv_proto;
char *proto;
- if(options.lockHandle) {
+ if (options.lockHandle) {
hContact = Meta_GetContactHandle(hMeta, 0);
}
@@ -1290,7 +1290,7 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv_proto)) {
proto = dbv_proto.pszVal;
- if(options.clist_contact_name == CNNT_NICK && proto) {
+ if (options.clist_contact_name == CNNT_NICK && proto) {
if (!MyDBGetContactSetting(hContact, proto, "Nick", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, "Nick", &dbv);
DBFreeVariant(&dbv);
@@ -1299,12 +1299,12 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { DBFreeVariant(&dbv_proto);
return 0;
}
- } else if(options.clist_contact_name == CNNT_DISPLAYNAME) {
+ } else if (options.clist_contact_name == CNNT_DISPLAYNAME) {
char *name = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
wchar_t *wname = (wchar_t *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_UNICODE);
- if(name && strcmp(name, Translate("(Unknown Contact)")) != 0) {
- if(wname && strncmp(name, (char *)wname, strlen(name)) != 0) {
+ if (name && strcmp(name, Translate("(Unknown Contact)")) != 0) {
+ if (wname && strncmp(name, (char *)wname, strlen(name)) != 0) {
DBVARIANT dbv;
dbv.pwszVal = wname;
dbv.type = DBVT_WCHAR;
@@ -1327,7 +1327,7 @@ int Meta_SetAllNicks() { HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ), most_online;
while ( hContact != NULL ) {
- if(DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
most_online = Meta_GetMostOnline(hContact);
Meta_CopyContactNick(hContact, most_online);
Meta_FixStatus(hContact);
@@ -1340,7 +1340,7 @@ int Meta_SetAllNicks() { }
int Meta_IsHiddenGroup(const char *group_name) {
- if(group_name && !strcmp(group_name, META_HIDDEN_GROUP)) return 1;
+ if (group_name && !strcmp(group_name, META_HIDDEN_GROUP)) return 1;
return 0;
}
@@ -1360,11 +1360,11 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
- if(ok1) {
+ if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
DBFreeVariant(&dbv1);
}
- if(ok2) {
+ if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
DBFreeVariant(&dbv2);
}
@@ -1376,11 +1376,11 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
- if(ok1) {
+ if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
DBFreeVariant(&dbv1);
}
- if(ok2) {
+ if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
DBFreeVariant(&dbv2);
}
@@ -1392,11 +1392,11 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
- if(ok1) {
+ if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
DBFreeVariant(&dbv1);
}
- if(ok2) {
+ if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
DBFreeVariant(&dbv2);
}
@@ -1408,12 +1408,12 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
- if(ok1) {
+ if (ok1) {
DBDeleteContactSetting(hMeta, META_PROTO, buff2);
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
DBFreeVariant(&dbv1);
}
- if(ok2) {
+ if (ok2) {
DBDeleteContactSetting(hMeta, META_PROTO, buff1);
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
DBFreeVariant(&dbv2);
@@ -1426,13 +1426,13 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
- if(ok1) {
+ if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
DBFreeVariant(&dbv1);
} else {
DBDeleteContactSetting(hMeta, META_PROTO, buff2);
}
- if(ok2) {
+ if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
DBFreeVariant(&dbv2);
} else {
@@ -1446,13 +1446,13 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
- if(ok1) {
+ if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
DBFreeVariant(&dbv1);
} else {
DBDeleteContactSetting(hMeta, META_PROTO, buff2);
}
- if(ok2) {
+ if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
DBFreeVariant(&dbv2);
} else {
@@ -1466,13 +1466,13 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
- if(ok1) {
+ if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
DBFreeVariant(&dbv1);
} else {
DBDeleteContactSetting(hMeta, META_PROTO, buff2);
}
- if(ok2) {
+ if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
DBFreeVariant(&dbv2);
} else {
@@ -1544,15 +1544,15 @@ void copyHistory(HANDLE hContactFrom,HANDLE hContactTo) break;
// i.e. optoins.days_history == 0;
- if(time_now == earliest_time) earliest_time = dbei.timestamp;
+ if (time_now == earliest_time) earliest_time = dbei.timestamp;
- if(dbei.timestamp < earliest_time)
+ if (dbei.timestamp < earliest_time)
continue;
- if(dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != EVENTTYPE_FILE && dbei.eventType != EVENTTYPE_URL)
+ if (dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != EVENTTYPE_FILE && dbei.eventType != EVENTTYPE_URL)
continue;
- if(time_now > earliest_time) { // just in case!
+ if (time_now > earliest_time) { // just in case!
SendMessage(prog, PBM_SETPOS, (WPARAM)(int)(100.0 * (dbei.timestamp - earliest_time) / (time_now - earliest_time)), 0);
UpdateWindow(progress_dialog);
}
@@ -1567,7 +1567,7 @@ void copyHistory(HANDLE hContactFrom,HANDLE hContactTo) //CallService(MS_DB_SETSAFETYMODE, (WPARAM)TRUE, 0);
DestroyWindow(progress_dialog);
- if(buffer) mir_free(buffer);
+ if (buffer) mir_free(buffer);
//mir_free(id);
}
@@ -1608,19 +1608,19 @@ void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource) { if (CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei)) break;
- if(dbei.timestamp < earliest_time)
+ if (dbei.timestamp < earliest_time)
earliest_time = dbei.timestamp;
- if(dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != EVENTTYPE_FILE && dbei.eventType != EVENTTYPE_URL) {
+ if (dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != EVENTTYPE_FILE && dbei.eventType != EVENTTYPE_URL) {
hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0);
continue;
}
- if(dbei.cbBlob >= id_length && strncmp((char *)(dbei.pBlob + dbei.cbBlob - id_length), id, id_length - 1) == 0) {
+ if (dbei.cbBlob >= id_length && strncmp((char *)(dbei.pBlob + dbei.cbBlob - id_length), id, id_length - 1) == 0) {
// event is tagged with source contact id - remove
HANDLE hDbEventNext;
- if(time_now > earliest_time) { // just in case
+ if (time_now > earliest_time) { // just in case
SendMessage(prog, PBM_SETPOS, (WPARAM)(int)(100.0 * (dbei.timestamp - earliest_time) / (time_now - earliest_time)), 0);
UpdateWindow(progress_dialog);
}
@@ -1636,7 +1636,7 @@ void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource) { //CallService(MS_DB_SETSAFETYMODE, (WPARAM)TRUE, 0);
DestroyWindow(progress_dialog);
- if(buffer) mir_free(buffer);
+ if (buffer) mir_free(buffer);
mir_free(id);
}
@@ -1681,7 +1681,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { DBFreeVariant(&dbv);
strncpy(id + used, buff, 256 - used);
- if(used) {
+ if (used) {
*pused = (DWORD)(used + strlen(buff) + 1);
if (*pused > 256) *pused = 256;
}
@@ -1691,9 +1691,9 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { */
void Meta_FixStatus(HANDLE hMeta) {
HANDLE most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_1, 0);
- if(most_online) {
+ if (most_online) {
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
- if(proto) {
+ if (proto) {
WORD status = (WORD)DBGetContactSettingWord(most_online, proto, "Status", (WORD)ID_STATUS_OFFLINE);
DBWriteContactSettingWord(hMeta, META_PROTO, "Status", status);
} else
@@ -1702,7 +1702,7 @@ void Meta_FixStatus(HANDLE hMeta) { DBWriteContactSettingWord(hMeta, META_PROTO, "Status", (WORD)ID_STATUS_OFFLINE);
// trigger setting changed in mw_clist to reset extra icons
- if(ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
+ if (ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
DBWriteContactSettingString(hMeta, "DummyModule", "e-mail", "blah");
//DBDeleteContactSetting(hMeta, "DummyModule", "e-mail"); // causes 'empty settings group' error in dbtool
}
diff --git a/plugins/MetaContacts/metacontacts.h b/plugins/MetaContacts/metacontacts.h index 790fb9a6a4..873b0e2e12 100644 --- a/plugins/MetaContacts/metacontacts.h +++ b/plugins/MetaContacts/metacontacts.h @@ -103,15 +103,7 @@ extern HINSTANCE hInstance; extern PLUGININFOEX pluginInfo;
// contact menu items
-extern HANDLE hMenuConvert,
- hMenuAdd,
- hMenuEdit,
- hMenuDelete,
- hMenuDefault,
- hMenuForceDefault;
-
-// main menu item
-extern HANDLE hMenuOnOff;
+extern HGENMENU hMenuConvert, hMenuAdd, hMenuEdit, hMenuDelete, hMenuDefault, hMenuForceDefault, hMenuOnOff;
extern DWORD nextMetaID;
extern int mcStatus;
diff --git a/plugins/Modernb/hdr/modern_clc.h b/plugins/Modernb/hdr/modern_clc.h index 773d34fb32..56c7a8b4c0 100644 --- a/plugins/Modernb/hdr/modern_clc.h +++ b/plugins/Modernb/hdr/modern_clc.h @@ -31,9 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "modern_defsettings.h"
#include "modern_clist.h"
-
-
-
#define SETTING_TRAYICON_SINGLE 0
#define SETTING_TRAYICON_CYCLE 1
#define SETTING_TRAYICON_MULTI 2
@@ -173,11 +170,6 @@ struct ClcGroup; #define TEXT_TEXT_MAX_LENGTH 1024
-
-#define IsHContactGroup(h) (((UINT_PTR)(h)^HCONTACT_ISGROUP)<(HCONTACT_ISGROUP^HCONTACT_ISINFO))
-#define IsHContactInfo(h) (((UINT_PTR)(h)&HCONTACT_ISINFO)==HCONTACT_ISINFO)
-#define IsHContactContact(h) (((UINT_PTR)(h)&HCONTACT_ISGROUP)==0)
-
typedef struct tagClcContactTextPiece
{
int type;
diff --git a/plugins/Modernb/modern_clistmenus.cpp b/plugins/Modernb/modern_clistmenus.cpp index e69e08fe15..95e41c4d81 100644 --- a/plugins/Modernb/modern_clistmenus.cpp +++ b/plugins/Modernb/modern_clistmenus.cpp @@ -128,7 +128,7 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) //mi.pszService="ContactRate MenuItem NoService Fake";
mi.flags=CMIF_ROOTPOPUP|CMIF_TCHAR;
if (!hFavoriteContactMenu)
- hFavoriteContactMenu=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hFavoriteContactMenu = Menu_AddContactMenuItem(&mi);
else
{
mi.flags|=CMIM_FLAGS|CMIM_ICON|CMIM_NAME;
@@ -164,26 +164,22 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) mi.flags|=CMIM_FLAGS|CMIM_ICON;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hFavoriteContactMenuItems[i], (LPARAM)&mi);
}
- else
- hFavoriteContactMenuItems[i]=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ else hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi);
CallService(MS_SKIN2_RELEASEICON,(WPARAM)mi.hIcon,0);
if (mi.hIcon && NeedFree) DestroyIcon(mi.hIcon);
}
- {
- mi.hIcon=NULL;
- mi.ptszName=_T("Show even if offline");
- mi.flags=CMIF_CHILDPOPUP|CMIF_TCHAR|(ModernGetSettingByte((HANDLE)wParam,"CList","noOffline",0)?CMIF_CHECKED:0);
- mi.pszService=CLUI_FAVTOGGLESHOWOFFLINE;
- mi.popupPosition=i+100000000;
- mi.position=-100000000;
- if (bModifyMenu && hShowIfOflineItem)
- {
- mi.flags|=CMIM_FLAGS|CMIM_ICON;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hShowIfOflineItem, (LPARAM)&mi);
- }
- else
- hShowIfOflineItem=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+
+ mi.hIcon=NULL;
+ mi.ptszName=_T("Show even if offline");
+ mi.flags=CMIF_CHILDPOPUP|CMIF_TCHAR|(ModernGetSettingByte((HANDLE)wParam,"CList","noOffline",0)?CMIF_CHECKED:0);
+ mi.pszService=CLUI_FAVTOGGLESHOWOFFLINE;
+ mi.popupPosition=i+100000000;
+ mi.position=-100000000;
+ if (bModifyMenu && hShowIfOflineItem) {
+ mi.flags|=CMIM_FLAGS|CMIM_ICON;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hShowIfOflineItem, (LPARAM)&mi);
}
+ else hShowIfOflineItem = Menu_AddContactMenuItem(&mi);
}
return 0;
}
diff --git a/plugins/Modernb/modern_clisttray.cpp b/plugins/Modernb/modern_clisttray.cpp index f94e25a668..521785066d 100644 --- a/plugins/Modernb/modern_clisttray.cpp +++ b/plugins/Modernb/modern_clisttray.cpp @@ -166,7 +166,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) if (!pcli->pfnGetProtocolVisibility(szChangedProto)) return;
- pcli->pfnLockTray();
+ pcli->pfnLockTray();
if ( pcli->cycleTimerId ) {
KillTimer( NULL, pcli->cycleTimerId);
pcli->cycleTimerId=0;
@@ -258,7 +258,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) pcli->cycleTimerId=0;
{
HICON hIcon;
- // 1 check if multi connecting icon
+ // 1 check if multi connecting icon
if (g_bMultiConnectionMode)
if (_strcmpi(szChangedProto,g_szConnectingProto))
{ pcli->pfnUnlockTray(); return; }
@@ -323,26 +323,26 @@ void cliTrayIconUpdateBase(const char *szChangedProto) break;
} }
}
- else if ( pcli->pfnGetProtocolVisibility( szChangedProto ))
+ else if ( pcli->pfnGetProtocolVisibility( szChangedProto ))
{
DBVARIANT dbv={DBVT_DELETED};
char *szProto;
int status=CallProtoService(szChangedProto,PS_GETSTATUS,0,0);
-
- if ((g_StatusBarData.connectingIcon==1)&&status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)
+
+ if ((g_StatusBarData.connectingIcon==1)&&status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)
{
HICON hIcon = ( HICON )CLUI_GetConnectingIconService((WPARAM)szChangedProto,0);;
- if (hIcon)
+ if (hIcon)
changed=pcli->pfnTrayIconSetBaseInfo(hIcon,NULL);
}
- else if (status>=ID_STATUS_OFFLINE && status<=ID_STATUS_IDLE)
+ else if (status>=ID_STATUS_OFFLINE && status<=ID_STATUS_IDLE)
{
if(ModernGetSettingString(NULL,"CList","PrimaryStatus",&dbv))
szProto=NULL;
- else
+ else
szProto=dbv.pszVal;
changed=pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szProto,status),NULL);
- if (szProto)
+ if (szProto)
mir_free_and_nill(szProto);
}
}
@@ -370,7 +370,7 @@ static VOID CALLBACK TrayIconAutoHideTimer(HWND hwnd,UINT message,UINT_PTR idEve INT_PTR TrayIconPauseAutoHide(WPARAM wParam,LPARAM lParam)
{
- if (ModernGetSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT))
+ if (ModernGetSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT))
{
if (GetActiveWindow() != pcli->hwndContactList
&& GetWindow(GetParent(GetActiveWindow()),GW_OWNER) != pcli->hwndContactList)
@@ -420,7 +420,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) if(ModernGetSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT)) {
if (LOWORD(msg->wParam)==WA_INACTIVE && h2!=h4)
autoHideTimerId=CLUI_SafeSetTimer(NULL,0,1000*ModernGetSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),TrayIconAutoHideTimer);
- else {
+ else {
KillTimer(NULL,autoHideTimerId);
autoHideTimerId = 0;
}
@@ -628,10 +628,10 @@ void InitTrayMenus(void) CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu",FreeOwnerDataTrayMenu);
CreateServiceFunction("CLISTMENUSTRAY/TrayMenuonAddService",TrayMenuonAddService);
- CreateServiceFunction(MS_CLIST_ADDTRAYMENUITEM,AddTrayMenuItem);
+ CreateServiceFunction("CList/AddTrayMenuItem",AddTrayMenuItem);
CreateServiceFunction(MS_CLIST_REMOVETRAYMENUITEM,RemoveTrayMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDTRAY,BuildTrayMenu);
-
+
//Tray menu
memset(&tmp,0,sizeof(tmp));
diff --git a/plugins/Modernb/modern_clui.cpp b/plugins/Modernb/modern_clui.cpp index cf70313d70..8830f119d6 100644 --- a/plugins/Modernb/modern_clui.cpp +++ b/plugins/Modernb/modern_clui.cpp @@ -334,7 +334,7 @@ HRESULT CLUI::RegisterAvatarMenu() mi.hIcon=LoadSmallIcon(g_hInst,MAKEINTRESOURCE(IDI_SHOW_AVATAR));
mi.pszName=LPGEN("Show Contact &Avatar");
mi.pszService="CList/ShowContactAvatar";
- hShowAvatarMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hShowAvatarMenuItem = Menu_AddContactMenuItem(&mi);
DestroyIcon_protect(mi.hIcon);
CreateServiceFunction("CList/HideContactAvatar",CLUI::Service_Menu_HideContactAvatar);
@@ -342,7 +342,7 @@ HRESULT CLUI::RegisterAvatarMenu() mi.hIcon=LoadSmallIcon(g_hInst,MAKEINTRESOURCE(IDI_HIDE_AVATAR));
mi.pszName=LPGEN("Hide Contact &Avatar");
mi.pszService="CList/HideContactAvatar";
- hHideAvatarMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hHideAvatarMenuItem = Menu_AddContactMenuItem(&mi);
DestroyIcon_protect(mi.hIcon);
ModernHookEvent(ME_CLIST_PREBUILDCONTACTMENU, CLUI::OnEvent_ContactMenuPreBuild);
diff --git a/plugins/Modernb/modern_cluiframes.cpp b/plugins/Modernb/modern_cluiframes.cpp index 32f8635d4f..ee88e5a4de 100644 --- a/plugins/Modernb/modern_cluiframes.cpp +++ b/plugins/Modernb/modern_cluiframes.cpp @@ -832,7 +832,7 @@ static int CLUIFramesGetalClientFrame(void) return -1;
}
-static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addservice)
+static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,HGENMENU (*pfnAdd)(CLISTMENUITEM*))
{
//TMO_MenuItem tmi;
HGENMENU menuid;
@@ -851,7 +851,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszContactOwner=(char *)0;
mi.pszService=MS_CLIST_FRAMES_SHFRAME;
- menuid = (HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if(frameid==-1) _hmiVisible=menuid;
else g_pfwFrames[framepos].MenuHandles.MIVisible=menuid;
@@ -864,7 +864,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService=MS_CLIST_FRAMES_SHFRAMETITLEBAR;
mi.pszContactOwner=(char *)0;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiTBVisible=menuid;
else g_pfwFrames[framepos].MenuHandles.MITBVisible=menuid;
@@ -875,7 +875,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService=MS_CLIST_FRAMES_ULFRAME;
mi.pszContactOwner=(char *)0;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiLock=menuid;
else g_pfwFrames[framepos].MenuHandles.MILock=menuid;
@@ -886,7 +886,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService=MS_CLIST_FRAMES_UCOLLFRAME;
mi.pszContactOwner=(char *)0;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiColl=menuid;
else g_pfwFrames[framepos].MenuHandles.MIColl=menuid;
@@ -898,7 +898,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP;
mi.pszService="Set_Floating";
mi.pszContactOwner=(char *)0;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiFloating=menuid;
else g_pfwFrames[framepos].MenuHandles.MIFloating=menuid;
@@ -909,7 +909,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService=MS_CLIST_FRAMES_SETUNBORDER;
mi.pszContactOwner=(char *)0;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiBorder=menuid;
else g_pfwFrames[framepos].MenuHandles.MIBorder=menuid;
@@ -924,7 +924,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP|CMIF_ROOTPOPUP;
mi.pszService="";
mi.pszContactOwner=(char *)0;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiAlignRoot=menuid;
else g_pfwFrames[framepos].MenuHandles.MIAlignRoot=menuid;
@@ -936,7 +936,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.pszName=LPGEN("&Top");
mi.pszService=CLUIFRAMESSETALIGNALTOP;
mi.pszContactOwner=(char *)alTop;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiAlignTop=menuid;
else g_pfwFrames[framepos].MenuHandles.MIAlignTop=menuid;
@@ -946,7 +946,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.pszName=LPGEN("&Client");
mi.pszService=CLUIFRAMESSETALIGNALCLIENT;
mi.pszContactOwner=(char *)alClient;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiAlignClient=menuid;
else g_pfwFrames[framepos].MenuHandles.MIAlignClient=menuid;
@@ -955,7 +955,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.pszName=LPGEN("&Bottom");
mi.pszService=CLUIFRAMESSETALIGNALBOTTOM;
mi.pszContactOwner=(char *)alBottom;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiAlignBottom=menuid;
else g_pfwFrames[framepos].MenuHandles.MIAlignBottom=menuid;
@@ -970,7 +970,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP|CMIF_ROOTPOPUP;
mi.pszService="";
mi.pszContactOwner=(char *)0;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiPosRoot=menuid;
else g_pfwFrames[framepos].MenuHandles.MIPosRoot=menuid;
//??????
@@ -981,7 +981,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP;
mi.pszService=CLUIFRAMESMOVEUP;
mi.pszContactOwner=(char *)1;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiPosUp=menuid;
else g_pfwFrames[framepos].MenuHandles.MIPosUp=menuid;
@@ -991,7 +991,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char mi.flags=CMIF_CHILDPOPUP;
mi.pszService=CLUIFRAMESMOVEDOWN;
mi.pszContactOwner=(char *)-1;
- menuid=(HGENMENU)CallService(addservice,0,(LPARAM)&mi);
+ menuid=pfnAdd(&mi);
if(frameid==-1) _hmiPosDown=menuid;
else g_pfwFrames[framepos].MenuHandles.MIPosDown=menuid;
@@ -1824,7 +1824,7 @@ static int CLUIFramesLoadMainMenu() mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA);
mi.position = 3000090000;
mi.pszName = LPGEN("Frames");
- _hmiRoot = (HGENMENU)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ _hmiRoot = Menu_AddMainMenuItem(&mi);
DestroyIcon_protect(mi.hIcon);
// create frames menu
int separator=3000200000;
@@ -1835,8 +1835,8 @@ static int CLUIFramesLoadMainMenu() mi.hParentMenu = _hmiRoot;
mi.ptszName = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].Name;
mi.pszService = 0;
- g_pfwFrames[i].MenuHandles.MainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
- CLUIFramesCreateMenuForFrame(g_pfwFrames[i].id,(int)g_pfwFrames[i].MenuHandles.MainMenuItem,separator,MS_CLIST_ADDMAINMENUITEM);
+ g_pfwFrames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi);
+ CLUIFramesCreateMenuForFrame(g_pfwFrames[i].id,(int)g_pfwFrames[i].MenuHandles.MainMenuItem,separator,Menu_AddMainMenuItem);
CLUIFramesModifyMainMenuItems(g_pfwFrames[i].id,0);
CallService(MS_CLIST_FRAMEMENUNOTIFY,(WPARAM)g_pfwFrames[i].id,(LPARAM)g_pfwFrames[i].MenuHandles.MainMenuItem);
separator++;
@@ -1851,20 +1851,19 @@ static int CLUIFramesLoadMainMenu() mi.hParentMenu = _hmiRoot;
mi.pszName = LPGEN("Show All Frames");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// create "show all titlebars" menu
mi.position = separator++;
mi.pszName = LPGEN("Show All Titlebars");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// create "hide all titlebars" menu
mi.position = separator++;
mi.pszName = LPGEN("Hide All Titlebars");
mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
-
+ Menu_AddMainMenuItem(&mi);
return 0;
}
@@ -4014,7 +4013,7 @@ int CLUIFrameOnModulesLoad(WPARAM wParam,LPARAM lParam) {
/* HOOK */
CLUIFramesLoadMainMenu();
- CLUIFramesCreateMenuForFrame(-1,-1,000010000,MS_CLIST_ADDCONTEXTFRAMEMENUITEM);
+ CLUIFramesCreateMenuForFrame(-1,-1,000010000,Menu_AddContextFrameMenuItem);
return 0;
}
int CLUIFrameOnModulesUnload(WPARAM wParam,LPARAM lParam)
diff --git a/plugins/Modernb/modern_framesmenu.cpp b/plugins/Modernb/modern_framesmenu.cpp index 9e2aed8418..5a8552f0cb 100644 --- a/plugins/Modernb/modern_framesmenu.cpp +++ b/plugins/Modernb/modern_framesmenu.cpp @@ -197,7 +197,7 @@ int InitFramesMenus(void) CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
- CreateServiceFunction(MS_CLIST_ADDCONTEXTFRAMEMENUITEM,AddContextFrameMenuItem);
+ CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
diff --git a/plugins/Modernb/modern_groupmenu.cpp b/plugins/Modernb/modern_groupmenu.cpp index e6ba5aba31..dcfa6db2a8 100644 --- a/plugins/Modernb/modern_groupmenu.cpp +++ b/plugins/Modernb/modern_groupmenu.cpp @@ -297,7 +297,7 @@ void GroupMenus_Init(void) CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper",HideOfflineRootHelper);
CreateServiceFunction("CLISTMENUSGroup/CreateGroupHelper",CreateGroupHelper);
- CreateServiceFunction(MS_CLIST_ADDGROUPMENUITEM,AddGroupMenuItem);
+ CreateServiceFunction("CList/AddGroupMenuItem",AddGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu);
@@ -689,24 +689,23 @@ void InitSubGroupMenus(void) {
TMenuParam tmp;
OptParam op;
-
+
CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService);
CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu);
CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService);
- CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuCheckService",SubGroupMenuCheckService);
+ CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuCheckService",SubGroupMenuCheckService);
CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy);
//CreateServiceFunction("CLISTMENUSSubGroup/HideSubGroupsHelper",HideSubGroupsHelper);
//CreateServiceFunction("CLISTMENUSSubGroup/UseSubGroupsHelper",UseSubGroupsHelper);
//CreateServiceFunction("CLISTMENUSSubGroup/HideOfflineRootHelper",HideOfflineRootHelper);
- CreateServiceFunction(MS_CLIST_ADDSUBGROUPMENUITEM,AddSubGroupMenuItem);
+ CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu);
ModernHookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu);
-
//SubGroup menu
memset(&tmp,0,sizeof(tmp));
tmp.cbSize=sizeof(tmp);
@@ -714,13 +713,12 @@ void InitSubGroupMenus(void) tmp.ExecService="CLISTMENUSSubGroup/ExecService";
tmp.name=LPGEN("SubGroupMenu");
hSubGroupMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp);
-
-
+
op.Handle=hSubGroupMenuObject;
op.Setting=OPT_USERDEFINEDITEMS;
op.Value=TRUE;
CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op);
-
+
op.Handle=hSubGroupMenuObject;
op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE;
op.Value=(INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu";
@@ -731,17 +729,15 @@ void InitSubGroupMenus(void) op.Value=(INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService";
CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op);
- op.Handle=hSubGroupMenuObject;
+ op.Handle=hSubGroupMenuObject;
op.Setting=OPT_MENUOBJECT_SET_CHECK_SERVICE;
op.Value=(INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuCheckService";
CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op);
-
- {
//add exit command to menu
CLISTMENUITEM mi;
GroupMenuParam gmp;
-
+
memset(&mi,0,sizeof(mi));
mi.cbSize=sizeof(mi);
mi.position=1000;
@@ -782,7 +778,7 @@ void InitSubGroupMenus(void) gmp.lParam=0;gmp.wParam=POPUP_RENAMEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
DestroyIcon_protect(mi.hIcon);
-
+
memset(&mi,0,sizeof(mi));
mi.cbSize=sizeof(mi);
mi.position=900002;
@@ -793,9 +789,6 @@ void InitSubGroupMenus(void) gmp.lParam=0;gmp.wParam=POPUP_DELETEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
DestroyIcon_protect(mi.hIcon);
- //MS_CLIST_SubGroupCREATE
-
- };
}
//////////////////////////////END SubGroup MENU/////////////////////////
diff --git a/plugins/Mwclist/CLUIFrames/cluiframes.cpp b/plugins/Mwclist/CLUIFrames/cluiframes.cpp index 12d4f71ac4..ab56da832d 100644 --- a/plugins/Mwclist/CLUIFrames/cluiframes.cpp +++ b/plugins/Mwclist/CLUIFrames/cluiframes.cpp @@ -630,7 +630,7 @@ int CLUIFramesGetalClientFrame(void) return -1;
}
-HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addservice)
+HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,HGENMENU (*pfnAdd )( CLISTMENUITEM* ))
{
CLISTMENUITEM mi;
//TMO_MenuItem tmi;
@@ -647,7 +647,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.pszName = LPGEN("&FrameTitle");
mi.flags = CMIF_CHILDPOPUP|CMIF_GRAYED;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMITitle = menuid;
else Frames[framepos].MenuHandles.MITitle = menuid;
@@ -661,7 +661,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszContactOwner = (char *)0;
mi.pszService = MS_CLIST_FRAMES_SHFRAME;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIVisible = menuid;
else Frames[framepos].MenuHandles.MIVisible = menuid;
@@ -672,7 +672,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMITBVisible = menuid;
else Frames[framepos].MenuHandles.MITBVisible = menuid;
@@ -686,7 +686,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_ULFRAME;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMILock = menuid;
else Frames[framepos].MenuHandles.MILock = menuid;
@@ -697,7 +697,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIColl = menuid;
else Frames[framepos].MenuHandles.MIColl = menuid;
@@ -709,7 +709,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP;
mi.pszService = "Set_Floating";
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIFloating = menuid;
else Frames[framepos].MenuHandles.MIFloating = menuid;
@@ -723,7 +723,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP|CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETUNBORDER;
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIBorder = menuid;
else Frames[framepos].MenuHandles.MIBorder = menuid;
@@ -737,7 +737,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP|CMIF_ROOTPOPUP;
mi.pszService = "";
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignRoot = menuid;
else Frames[framepos].MenuHandles.MIAlignRoot = menuid;
@@ -749,7 +749,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.pszName = LPGEN("&Top");
mi.pszService = CLUIFRAMESSETALIGNALTOP;
mi.pszContactOwner = (char *)alTop;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignTop = menuid;
else Frames[framepos].MenuHandles.MIAlignTop = menuid;
@@ -759,7 +759,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.pszName = LPGEN("&Client");
mi.pszService = CLUIFRAMESSETALIGNALCLIENT;
mi.pszContactOwner = (char *)alClient;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignClient = menuid;
else Frames[framepos].MenuHandles.MIAlignClient = menuid;
@@ -768,7 +768,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.pszName = LPGEN("&Bottom");
mi.pszService = CLUIFRAMESSETALIGNALBOTTOM;
mi.pszContactOwner = (char *)alBottom;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
if (frameid == -1) contMIAlignBottom = menuid;
else Frames[framepos].MenuHandles.MIAlignBottom = menuid;
@@ -781,7 +781,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP|CMIF_ROOTPOPUP;
mi.pszService = "";
mi.pszContactOwner = (char *)0;
- menuid = (HANDLE)CallService(addservice,0,(LPARAM)&mi);
+ menuid = pfnAdd(&mi);
mi.pszPopupName = (char *)menuid;
mi.popupPosition = frameid;
@@ -790,7 +790,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP;
mi.pszService = CLUIFRAMESMOVEUPDOWN;
mi.pszContactOwner = (char *)1;
- CallService(addservice,0,(LPARAM)&mi);
+ pfnAdd(&mi);
mi.pszPopupName = (char *)menuid;
mi.popupPosition = frameid;
@@ -799,7 +799,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,char *addse mi.flags = CMIF_CHILDPOPUP;
mi.pszService = CLUIFRAMESMOVEUPDOWN;
mi.pszContactOwner = (char *)-1;
- CallService(addservice,0,(LPARAM)&mi);
+ pfnAdd(&mi);
return 0;
}
@@ -1433,7 +1433,7 @@ static int CLUIFramesLoadMainMenu() mi.pszPopupName = LPGEN("Frames");
mi.pszName = LPGEN("New Menu System not Found...");
mi.pszService = "";
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// create "show all frames" menu
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA));
@@ -1442,7 +1442,7 @@ static int CLUIFramesLoadMainMenu() mi.pszPopupName = LPGEN("Frames");
mi.pszName = LPGEN("Show All Frames");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP));
mi.position = 10100001;
@@ -1450,7 +1450,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_CHILDPOPUP;
mi.pszName = LPGEN("Show All Titlebars");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
return 0;
}
@@ -1469,7 +1469,7 @@ static int CLUIFramesLoadMainMenu() mi.pszPopupName = (char*)-1;
mi.pszName = LPGEN("Frames");
mi.pszService = 0;
- MainMIRoot = (HGENMENU)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ MainMIRoot = Menu_AddMainMenuItem(&mi);
// create frames menu
separator = 3000200000;
@@ -1480,8 +1480,8 @@ static int CLUIFramesLoadMainMenu() mi.hParentMenu = MainMIRoot;
mi.ptszName = Frames[i].TitleBar.tbname ? Frames[i].TitleBar.tbname : Frames[i].name;
mi.pszService = 0;
- Frames[i].MenuHandles.MainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
- CLUIFramesCreateMenuForFrame(Frames[i].id,(int)Frames[i].MenuHandles.MainMenuItem,separator,MS_CLIST_ADDMAINMENUITEM);
+ Frames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi);
+ CLUIFramesCreateMenuForFrame(Frames[i].id,(int)Frames[i].MenuHandles.MainMenuItem,separator,Menu_AddMainMenuItem);
CLUIFramesModifyMainMenuItems(Frames[i].id,0);
//NotifyEventHooks(hPreBuildFrameMenuEvent,i,(LPARAM)Frames[i].MenuHandles.MainMenuItem);
CallService(MS_CLIST_FRAMEMENUNOTIFY,(WPARAM)Frames[i].id,(LPARAM)Frames[i].MenuHandles.MainMenuItem);
@@ -1497,7 +1497,7 @@ static int CLUIFramesLoadMainMenu() mi.hParentMenu = MainMIRoot;
mi.pszName = LPGEN("Show All Frames");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// create "show all titlebars" menu
mi.hIcon = NULL;
@@ -1506,7 +1506,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_CHILDPOPUP;
mi.pszName = LPGEN("Show All Titlebars");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// create "hide all titlebars" menu
mi.hIcon = NULL;
@@ -1515,7 +1515,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_CHILDPOPUP;
mi.pszName = LPGEN("Hide All Titlebars");
mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
return 0;
}
@@ -2869,7 +2869,7 @@ static void CLUIRegisterFonts() static int CLUIFrameOnModulesLoad(WPARAM wParam,LPARAM lParam)
{
CLUIFramesLoadMainMenu();
- CLUIFramesCreateMenuForFrame(-1,-1,000010000,MS_CLIST_ADDCONTEXTFRAMEMENUITEM);
+ CLUIFramesCreateMenuForFrame(-1,-1,000010000,Menu_AddContextFrameMenuItem);
CLUIRegisterFonts();
return 0;
}
diff --git a/plugins/Mwclist/CLUIFrames/framesmenu.cpp b/plugins/Mwclist/CLUIFrames/framesmenu.cpp index fc47474b2a..7a34206512 100644 --- a/plugins/Mwclist/CLUIFrames/framesmenu.cpp +++ b/plugins/Mwclist/CLUIFrames/framesmenu.cpp @@ -205,7 +205,7 @@ int InitFramesMenus(void) CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
- CreateServiceFunction(MS_CLIST_ADDCONTEXTFRAMEMENUITEM,AddContextFrameMenuItem);
+ CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
diff --git a/plugins/Mwclist/clcfonts.cpp b/plugins/Mwclist/clcfonts.cpp index d6039ecb27..346c53c9f3 100644 --- a/plugins/Mwclist/clcfonts.cpp +++ b/plugins/Mwclist/clcfonts.cpp @@ -56,8 +56,6 @@ static int fontListOrder[FONTID_MAX + 1] = #define CLCDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE)
#define CLCDEFAULT_SELTEXTCOLOUR GetSysColor(COLOR_HIGHLIGHTTEXT)
-#define CLCDEFAULT_HOTTEXTCOLOUR (IsWinVer98Plus()?RGB(0,0,255):GetSysColor(COLOR_HOTLIGHT))
-#define CLCDEFAULT_QUICKSEARCHCOLOUR RGB(255,255,0)
static int FS_FontsChanged(WPARAM wParam, LPARAM lParam)
{
diff --git a/plugins/Mwclist/clisttray.cpp b/plugins/Mwclist/clisttray.cpp index 04e71c6a0c..82ce1a2f16 100644 --- a/plugins/Mwclist/clisttray.cpp +++ b/plugins/Mwclist/clisttray.cpp @@ -2,8 +2,8 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2003 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
+Copyright 2000-2003 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
@@ -42,7 +42,7 @@ INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) case TIM_CALLBACK:
if (msg->lParam == WM_RBUTTONUP)
{
- POINT pt;
+ POINT pt;
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDTRAY,(WPARAM)0,(LPARAM)0);
SetForegroundWindow(msg->hwnd);
@@ -56,7 +56,7 @@ INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) *((LRESULT*)lParam) = 0;
return TRUE;
}
-
+
return saveTrayIconProcessMessage( wParam, lParam );
}
@@ -95,7 +95,7 @@ static INT_PTR BuildTrayMenu(WPARAM wParam,LPARAM lParam) hMenu = CreatePopupMenu();
//hMenu = wParam;
tick = GetTickCount();
-
+
NotifyEventHooks(hPreBuildTrayMenuEvent,0,0);
CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m);
@@ -125,17 +125,17 @@ static INT_PTR AddTrayMenuItem(WPARAM wParam,LPARAM lParam) tmi.root = (HGENMENU)mi->pszPopupName;
tmi.ownerdata = NULL;
-
+
{
lpTrayMenuExecParam mmep;
mmep = (lpTrayMenuExecParam)mir_alloc(sizeof(TrayMenuExecParam));
if (mmep == NULL)
return 0;
-
+
//we need just one parametr.
mmep->szServiceName = mir_strdup(mi->pszService);
mmep->Param1 = mi->popupPosition;
-
+
tmi.ownerdata = mmep;
}
op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hTrayMenuObject,(LPARAM)&tmi);
@@ -145,12 +145,12 @@ static INT_PTR AddTrayMenuItem(WPARAM wParam,LPARAM lParam) return (INT_PTR)op.Handle;
}
-INT_PTR TrayMenuCheckService(WPARAM wParam,LPARAM lParam)
+INT_PTR TrayMenuCheckService(WPARAM wParam,LPARAM lParam)
{
return 0;
}
-INT_PTR TrayMenuonAddService(WPARAM wParam,LPARAM lParam)
+INT_PTR TrayMenuonAddService(WPARAM wParam,LPARAM lParam)
{
MENUITEMINFO *mii = (MENUITEMINFO* )wParam;
if (mii == NULL) return 0;
@@ -162,12 +162,12 @@ INT_PTR TrayMenuonAddService(WPARAM wParam,LPARAM lParam) if (hTrayMainMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
+ mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
}
if (hTrayStatusMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
}
return(TRUE);
@@ -180,13 +180,13 @@ INT_PTR TrayMenuonAddService(WPARAM wParam,LPARAM lParam) INT_PTR TrayMenuExecService(WPARAM wParam,LPARAM lParam) {
if (wParam != 0)
{
- lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)wParam;
+ lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)wParam;
if (!strcmp(mmep->szServiceName,"Help/AboutCommand"))
{
//bug in help.c,it used wparam as parent window handle without reason.
mmep->Param1 = 0;
}
- CallService(mmep->szServiceName,mmep->Param1,lParam);
+ CallService(mmep->szServiceName,mmep->Param1,lParam);
}
return(1);
}
@@ -216,21 +216,21 @@ void InitTrayMenus(void) tmp.ExecService = "CLISTMENUSTRAY/ExecService";
tmp.name = "TrayMenu";
hTrayMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp);
-
+
CreateServiceFunction("CLISTMENUSTRAY/ExecService",TrayMenuExecService);
CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu",FreeOwnerDataTrayMenu);
CreateServiceFunction("CLISTMENUSTRAY/TrayMenuonAddService",TrayMenuonAddService);
- CreateServiceFunction(MS_CLIST_ADDTRAYMENUITEM,AddTrayMenuItem);
+ CreateServiceFunction("CList/AddTrayMenuItem",AddTrayMenuItem);
CreateServiceFunction(MS_CLIST_REMOVETRAYMENUITEM,RemoveTrayMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDTRAY,BuildTrayMenu);
hPreBuildTrayMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
-
+
op.Handle = hTrayMenuObject;
op.Setting = OPT_USERDEFINEDITEMS;
op.Value = TRUE;
CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op);
-
+
op.Handle = hTrayMenuObject;
op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
op.Value = (INT_PTR)"CLISTMENUSTRAY/FreeOwnerDataTrayMenu";
@@ -241,7 +241,7 @@ void InitTrayMenus(void) op.Value = (INT_PTR)"CLISTMENUSTRAY/TrayMenuonAddService";
CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op);
- {
+ {
//add exit command to menu
CLISTMENUITEM mi;
@@ -266,7 +266,7 @@ void InitTrayMenus(void) mi.pszService = "FindAdd/FindAddCommand";
mi.pszName = LPGEN("&Find/Add Contacts...");
AddTrayMenuItem((WPARAM)0,(LPARAM)&mi);
-
+
memset(&mi,0,sizeof(mi));
mi.cbSize = sizeof(mi);
mi.position = 300000;
diff --git a/plugins/Mwclist/groupmenu.cpp b/plugins/Mwclist/groupmenu.cpp index 815b55274a..fab616f6fb 100644 --- a/plugins/Mwclist/groupmenu.cpp +++ b/plugins/Mwclist/groupmenu.cpp @@ -281,7 +281,7 @@ void InitGroupMenus(void) CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper",UseGroupsHelper);
CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper",HideOfflineRootHelper);
- CreateServiceFunction(MS_CLIST_ADDGROUPMENUITEM,AddGroupMenuItem);
+ CreateServiceFunction("CList/AddGroupMenuItem",AddGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu);
hPreBuildGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
@@ -598,7 +598,7 @@ void InitSubGroupMenus(void) CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService);
CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy);
- CreateServiceFunction(MS_CLIST_ADDSUBGROUPMENUITEM,AddSubGroupMenuItem);
+ CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu);
hPreBuildSubGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
diff --git a/plugins/NewAwaySysMod/AwaySys.cpp b/plugins/NewAwaySysMod/AwaySys.cpp index 26bb4bdd5b..0e10dd9eeb 100644 --- a/plugins/NewAwaySysMod/AwaySys.cpp +++ b/plugins/NewAwaySysMod/AwaySys.cpp @@ -877,6 +877,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) hHooks.AddElem(HookEvent(ME_CONTACTSETTINGS_INITIALISE, ContactSettingsInit));
g_hReadWndList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
+
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(mi);
mi.position = 1000020000;
@@ -884,18 +885,16 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) mi.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(SendOnEvent ? IDI_SOE_ENABLED : IDI_SOE_DISABLED));
mi.ptszName = SendOnEvent ? DISABLE_SOE_COMMAND : ENABLE_SOE_COMMAND;
mi.pszService = MS_AWAYSYS_AUTOREPLY_TOGGLE;
- g_hToggleSOEMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ g_hToggleSOEMenuItem = Menu_AddMainMenuItem(&mi);
+
ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.position = -2000005000;
mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE | CMIF_HIDDEN;
- mi.hIcon = NULL;
- mi.pszContactOwner = NULL;
mi.ptszName = LPGENT("Read status message"); // never seen...
mi.pszService = MS_AWAYMSG_SHOWAWAYMSG;
- g_hReadStatMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
- if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USEMENUITEM))
- {
+ g_hReadStatMenuItem = Menu_AddContactMenuItem(&mi);
+ if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USEMENUITEM)) {
ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.flags = CMIF_TCHAR | CMIF_HIDDEN;
@@ -903,7 +902,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) mi.position = 1000020000;
mi.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MSGICON));
mi.pszService = MS_AWAYSYS_SETCONTACTSTATMSG;
- g_hContactMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ g_hContactMenuItem = Menu_AddContactMenuItem(&mi);
ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);
@@ -912,25 +911,27 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) mi.pszPopupName = (char*)-1;
mi.position = 1000020000;
mi.ptszName = LPGENT("Autoreply");
- g_hToggleSOEContactMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ g_hToggleSOEContactMenuItem = Menu_AddContactMenuItem(&mi);
mi.flags = CMIF_TCHAR | CMIF_CHILDPOPUP;
mi.pszPopupName = (char*)g_hToggleSOEContactMenuItem;
- mi.popupPosition = 1000020000;
+ mi.popupPosition = 1000020000;
mi.position = 1000020000;
mi.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_ENABLED));
mi.ptszName = LPGENT("On");
mi.pszService = MS_AWAYSYS_AUTOREPLY_ON;
- g_hAutoreplyOnContactMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ g_hAutoreplyOnContactMenuItem = Menu_AddContactMenuItem(&mi);
+
mi.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_DISABLED));
mi.ptszName = LPGENT("Off");
mi.pszService = MS_AWAYSYS_AUTOREPLY_OFF;
- g_hAutoreplyOffContactMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ g_hAutoreplyOffContactMenuItem = Menu_AddContactMenuItem(&mi);
+
mi.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT));
mi.ptszName = LPGENT("Use the default setting");
mi.pszService = MS_AWAYSYS_AUTOREPLY_USEDEFAULT;
- g_hAutoreplyUseDefaultContactMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ g_hAutoreplyUseDefaultContactMenuItem = Menu_AddContactMenuItem(&mi);
}
// add that funky thingy (just tweaked a bit, was spotted in Miranda's src code)
// we have to read the status message from contacts too... err
diff --git a/plugins/NewXstatusNotify/main.cpp b/plugins/NewXstatusNotify/main.cpp index ad2c628692..ab6677e0cb 100644 --- a/plugins/NewXstatusNotify/main.cpp +++ b/plugins/NewXstatusNotify/main.cpp @@ -1293,7 +1293,7 @@ void InitMainMenuItem() mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB;
mi.ptszPopupName = ServiceExists(MS_POPUP_ADDPOPUP) ? _T("PopUps") : NULL;
mi.pszService = MS_STATUSCHANGE_MENUCOMMAND;
- hEnableDisableMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hEnableDisableMenu = Menu_AddMainMenuItem(&mi);
opt.TempDisabled = !opt.TempDisabled;
EnableDisableMenuCommand(0, 0);
diff --git a/plugins/Nudge/headers.h b/plugins/Nudge/headers.h index 810edc6242..062bc8ee77 100644 --- a/plugins/Nudge/headers.h +++ b/plugins/Nudge/headers.h @@ -48,6 +48,7 @@ #include <m_metacontacts.h>
#include <m_updater.h>
#include <m_icolib.h>
+#include <win2k.h>
#include "resource.h"
#include "m_nudge.h"
diff --git a/plugins/Nudge/main.cpp b/plugins/Nudge/main.cpp index fb4575b50e..5500451eff 100644 --- a/plugins/Nudge/main.cpp +++ b/plugins/Nudge/main.cpp @@ -795,44 +795,36 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) newNudge->next = NudgeList;
NudgeList = newNudge;
- if(ServiceExists(MS_SKIN2_ADDICON))
- {
- SKINICONDESC sid = {0};
- TCHAR szFilename[MAX_PATH];
- char iconName[MAXMODULELABELLENGTH + 10];
- TCHAR iconDesc[MAXMODULELABELLENGTH + 10];
- GetModuleFileName(hInst,szFilename,MAX_PATH);
-
- sid.cbSize = SKINICONDESC_SIZE;
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = LPGENT("Nudge");
- sid.ptszDefaultFile = szFilename;
- mir_snprintf(iconName,sizeof(iconName),"Nudge_%s",proto->szModuleName);
- sid.pszName = iconName;
- mir_sntprintf(iconDesc,sizeof(iconDesc),TranslateT("Nudge for %s"),proto->tszAccountName);
- sid.ptszDescription = iconDesc;
- sid.iDefaultIndex = -IDI_NUDGE;
- sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE));
- newNudge->item.hIcoLibItem = (HANDLE) CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
- }
+ char iconName[MAXMODULELABELLENGTH + 10];
+ mir_snprintf(iconName,sizeof(iconName),"Nudge_%s",proto->szModuleName);
+
+ TCHAR szFilename[MAX_PATH], iconDesc[MAXMODULELABELLENGTH + 10];
+ GetModuleFileName(hInst,szFilename,MAX_PATH);
+ mir_sntprintf(iconDesc, SIZEOF(iconDesc), TranslateT("Nudge for %s"), proto->tszAccountName);
+
+ SKINICONDESC sid = {0};
+ sid.cbSize = SKINICONDESC_SIZE;
+ sid.flags = SIDF_ALL_TCHAR;
+ sid.ptszSection = LPGENT("Nudge");
+ sid.ptszDefaultFile = szFilename;
+ sid.pszName = iconName;
+ sid.ptszDescription = iconDesc;
+ sid.iDefaultIndex = -IDI_NUDGE;
+ sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE));
+ newNudge->item.hIcoLibItem = (HANDLE) CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
//Add contact menu entry
- if(ServiceExists(MS_CLIST_ADDCONTACTMENUITEM))
- {
- //Add contact menu entry
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(mi);
-
- mi.popupPosition = 500085000;
- mi.pszContactOwner = proto->szModuleName;
- mi.pszPopupName = proto->szModuleName;
- mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
- mi.position = -500050004;
- mi.icolibItem = newNudge->item.hIcoLibItem;
- mi.ptszName = LPGENT( "Send &Nudge" );
- mi.pszService = MS_NUDGE_SEND;
- newNudge->item.hContactMenu = (HANDLE) CallService( MS_CLIST_ADDCONTACTMENUITEM, 0, ( LPARAM )&mi );
- }
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(mi);
+ mi.popupPosition = 500085000;
+ mi.pszContactOwner = proto->szModuleName;
+ mi.pszPopupName = proto->szModuleName;
+ mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
+ mi.position = -500050004;
+ mi.icolibItem = newNudge->item.hIcoLibItem;
+ mi.ptszName = LPGENT( "Send &Nudge" );
+ mi.pszService = MS_NUDGE_SEND;
+ newNudge->item.hContactMenu = Menu_AddContactMenuItem(&mi);
}
void AutoResendNudge(void *wParam)
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index fb432941a8..49cf9dab11 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -87,7 +87,8 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) mi.hIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"check_update");
mi.ptszName = _T("Check for pack updates");
mi.pszService = MODNAME"/CheckUpdates";
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
+
// Add empty updates folder menu item
hEmptyFolder = CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder);
ZeroMemory(&mi, sizeof(mi));
@@ -97,7 +98,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) mi.hIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"empty_folder");
mi.ptszName = _T("Clear pack updates folder");
mi.pszService = MODNAME"/EmptyFolder";
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
// Add options hook
hOptHook = HookEvent(ME_OPT_INITIALISE, OptInit);
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index afebbe75e3..debafada7a 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -321,7 +321,7 @@ void InitMenuItems(void) { mi.position = -1000000000 /*1000001*/;
mi.ptszName = LPGENT(MODULNAME_PLU);
mi.hIcon = IcoLib_GetIcon(PopUpOptions.ModuleIsEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF ,0);
- hMenuRoot = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuRoot = Menu_AddMainMenuItem(&mi);
// Add item to main menu
mi.hParentMenu = (HGENMENU)hMenuRoot;
@@ -329,7 +329,7 @@ void InitMenuItems(void) { hTogglePopup = CreateServiceFunction(MENUCOMMAND_SVC, svcEnableDisableMenuCommand);
mi.ptszName = PopUpOptions.ModuleIsEnabled ? LPGENT("Disable &popup module") : LPGENT("Enable &popup module");
mi.pszService = MENUCOMMAND_SVC;
- hMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
+ hMenuItem = Menu_AddMainMenuItem(&mi);
// Popup History
hShowHistory = CreateServiceFunction(MENUCOMMAND_HISTORY, svcShowHistory);
@@ -338,7 +338,7 @@ void InitMenuItems(void) { mi.ptszName = LPGENT("Popup History");
mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0);
mi.pszService = MENUCOMMAND_HISTORY;
- hMenuItemHistory = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
+ hMenuItemHistory = Menu_AddMainMenuItem(&mi);
}
diff --git a/plugins/ProfileManager/pmanagerEx.c b/plugins/ProfileManager/pmanagerEx.c index 8bc9fec652..6556478e25 100644 --- a/plugins/ProfileManager/pmanagerEx.c +++ b/plugins/ProfileManager/pmanagerEx.c @@ -97,7 +97,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) mi.pszPopupName = "Database";
mi.pszName=LPGEN("Load profile");
mi.pszService="Database/LoadPM";
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
CreateServiceFunction("Database/ChangePM",ChangePM);
ZeroMemory(&mi,sizeof(mi));
@@ -108,7 +108,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) mi.pszPopupName = "Database";
mi.pszName=LPGEN("Change profile");
mi.pszService="Database/ChangePM";
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
return 0;
}
diff --git a/plugins/RecentContacts/RecentContacts.cpp b/plugins/RecentContacts/RecentContacts.cpp index cbb77d8491..8e0d13cd5d 100644 --- a/plugins/RecentContacts/RecentContacts.cpp +++ b/plugins/RecentContacts/RecentContacts.cpp @@ -481,7 +481,7 @@ int Create_MenuitemShowList(void) mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, ( LPARAM )"recent_main" );
mi.pszName = msLastUC_ShowListName;
mi.pszService = msLastUC_ShowList;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
ZeroMemory( &mi, sizeof( mi ));
mi.cbSize = sizeof( mi );
@@ -489,8 +489,7 @@ int Create_MenuitemShowList(void) mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, ( LPARAM )"recent_main" );
mi.ptszName = _T("Toggle Ignore");
mi.pszService = V_RECENTCONTACTS_TOGGLE_IGNORE;
- hMenuItemRemove = (HANDLE)CallService( MS_CLIST_ADDCONTACTMENUITEM,0, ( LPARAM )&mi );
-
+ hMenuItemRemove = Menu_AddContactMenuItem(&mi);
return 0;
}
diff --git a/plugins/SRMM/msgs.c b/plugins/SRMM/msgs.c index bfba1b6299..8b822c2b42 100644 --- a/plugins/SRMM/msgs.c +++ b/plugins/SRMM/msgs.c @@ -326,7 +326,7 @@ static int SplitmsgModulesLoaded(WPARAM wParam, LPARAM lParam) mi.icolibItem = LoadSkinnedIconHandle( SKINICON_EVENT_MESSAGE );
mi.pszName = LPGEN("&Message");
mi.pszService = MS_MSG_SENDMESSAGE;
- hMsgMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hMsgMenuItem = Menu_AddContactMenuItem(&mi);
}
HookEvent(ME_FONT_RELOAD, FontsChanged);
diff --git a/plugins/Scriver/chat/main.c b/plugins/Scriver/chat/main.c index 115eca156d..aa14d7f8df 100644 --- a/plugins/Scriver/chat/main.c +++ b/plugins/Scriver/chat/main.c @@ -84,14 +84,14 @@ int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam) mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN );
mi.pszName = LPGEN("&Join");
mi.pszService = "GChat/JoinChat";
- hJoinMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hJoinMenuItem = Menu_AddContactMenuItem(&mi);
mi.position = -2000090000;
mi.flags = CMIF_NOTOFFLINE | CMIF_ICONFROMICOLIB;
mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_LEAVE );
mi.pszName = LPGEN("&Leave");
mi.pszService = "GChat/LeaveChat";
- hLeaveMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
}
CList_SetAllOffline(TRUE, NULL);
return 0;
diff --git a/plugins/Scriver/msgs.c b/plugins/Scriver/msgs.c index c0f63b6538..0ce59281ea 100644 --- a/plugins/Scriver/msgs.c +++ b/plugins/Scriver/msgs.c @@ -537,7 +537,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) }
mi.pszName = LPGEN("&Message");
mi.pszService = MS_MSG_SENDMESSAGE;
- hMsgMenuItem = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hMsgMenuItem = Menu_AddContactMenuItem(&mi);
CallService(MS_SKIN2_RELEASEICON,(WPARAM)mi.hIcon, 0);
HookEvent_Ex(ME_SMILEYADD_OPTIONSCHANGED, SmileySettingsChanged);
diff --git a/plugins/SecureIM/main.cpp b/plugins/SecureIM/main.cpp index 926f68512a..24950bbacf 100644 --- a/plugins/SecureIM/main.cpp +++ b/plugins/SecureIM/main.cpp @@ -50,10 +50,9 @@ void AddHookFunction(LPCSTR eventName, MIRANDAHOOK hookFunction) { }
-HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0) {
-
- CLISTMENUITEM mi;
- memset(&mi,0,sizeof(mi));
+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;
@@ -61,23 +60,23 @@ HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WP mi.pszName= (char*)name;
mi.pszPopupName=(char*)-1;
mi.pszService=(char*)service;
- return((HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,wParam,(LPARAM)&mi));
+ return Menu_AddContactMenuItem(&mi);
}
-HANDLE AddSubItem(HANDLE rootid,LPCSTR name,int pos,int poppos,LPCSTR service,WPARAM wParam=0) {
-
- CLISTMENUITEM mi;
- 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;
- return((HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,wParam,(LPARAM)&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;
+ return Menu_AddContactMenuItem(&mi);
}
@@ -416,7 +415,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { g_hMenu[0] = AddMenuItem(sim301,110000,g_hICO[ICO_CM_EST],MODULENAME"/SIM_EST",CMIF_NOTOFFLINE);
g_hMenu[1] = AddMenuItem(sim302,110001,g_hICO[ICO_CM_DIS],MODULENAME"/SIM_DIS",CMIF_NOTOFFLINE);
- if(ServiceExists(MS_CLIST_ADDSUBGROUPMENUITEM)) {
+ if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
@@ -450,7 +449,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Mode menu");
#endif
- if(ServiceExists(MS_CLIST_ADDSUBGROUPMENUITEM)) {
+ if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
diff --git a/plugins/SecureIM/options.cpp b/plugins/SecureIM/options.cpp index fa61e021b4..3f84c98b10 100644 --- a/plugins/SecureIM/options.cpp +++ b/plugins/SecureIM/options.cpp @@ -1131,13 +1131,6 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) { SendMessage(GetDlgItem(hDlg,IDC_AAK),BM_SETCHECK,(bAAK)?BST_CHECKED:BST_UNCHECKED,0L);
SendMessage(GetDlgItem(hDlg,IDC_MCM),BM_SETCHECK,(bMCM)?BST_CHECKED:BST_UNCHECKED,0L);
-/* // CList_classic
- if (!ServiceExists(MS_CLIST_ADDSUBGROUPMENUITEM)) {
- EnableWindow(GetDlgItem(hDlg,IDC_ASI),FALSE);
- for(i=2;i<ADV_CNT;i++)
- EnableWindow(GetDlgItem(hDlg,IDC_ADV1+i),FALSE);
- }
-*/
// Advanced
SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_SETCURSEL, bADV, 0);
if ( g_hCLIcon ) {
diff --git a/plugins/SeenPlugin/menu.c b/plugins/SeenPlugin/menu.c index c6a5ca8884..02f241b793 100644 --- a/plugins/SeenPlugin/menu.c +++ b/plugins/SeenPlugin/menu.c @@ -99,8 +99,7 @@ void InitMenuitem() cmi.pszContactOwner=NULL;
cmi.pszName="<none>";
cmi.pszService="LastSeenUserDetails";
-
- hmenuitem=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&cmi);
+ hmenuitem = Menu_AddContactMenuItem(&cmi);
hBuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildContactMenu);
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 7ca99f5601..496b279efd 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -968,23 +968,23 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) cl.ptszPopupName = _T("Sessions Manager");
cl.hIcon = hiSessions;
cl.pszService = MS_SESSIONS_SAVEUSERSESSION;
- hmSaveCurrentSession = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmSaveCurrentSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load session...");
cl.pszService = MS_SESSIONS_OPENMANAGER;
cl.hIcon = hiSessionsLoad;
- hmLoadLastSession = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmLoadLastSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Close session");
cl.pszService = MS_SESSIONS_CLOSESESSION;
cl.hIcon = 0;
- hmLoadSession = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmLoadSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load last session");
cl.pszService = MS_SESSIONS_RESTORELASTSESSION;
cl.hIcon = hiSessionsLoadLast;
cl.position = 10100000;
- hmLoadSession = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmLoadSession = Menu_AddMainMenuItem(&cl);
ZeroMemory(&cl, sizeof(cl));
cl.cbSize = sizeof(cl);
diff --git a/plugins/SimpleAR/Src/Main.cpp b/plugins/SimpleAR/Src/Main.cpp index 1705ce2e00..ac9a2d002f 100644 --- a/plugins/SimpleAR/Src/Main.cpp +++ b/plugins/SimpleAR/Src/Main.cpp @@ -335,7 +335,7 @@ extern "C" int __declspec(dllexport)Load(PLUGINLINK *link) mi.position = 500090000;
mi.ptszName = _T("");
mi.pszService = protocolname"/ToggleEnable";
- hEnableMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hEnableMenu = Menu_AddMainMenuItem(&mi);
hToggleAutoanswer = CreateServiceFunction(protocolname"/ToggleAutoanswer",Toggle);
ZeroMemory(&mi, sizeof(mi));
@@ -343,7 +343,7 @@ extern "C" int __declspec(dllexport)Load(PLUGINLINK *link) mi.position=-0x7FFFFFFF;
mi.ptszName=_T("");
mi.pszService=protocolname"/ToggleAutoanswer";
- hToggle = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hToggle = Menu_AddContactMenuItem(&mi);
//add hook
hOptHook = HookEvent(ME_OPT_INITIALISE, OptInit);
diff --git a/plugins/SimpleStatusMsg/awaymsg.cpp b/plugins/SimpleStatusMsg/awaymsg.cpp index 062b702254..4932f475a1 100644 --- a/plugins/SimpleStatusMsg/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/awaymsg.cpp @@ -508,7 +508,7 @@ int LoadAwayMsgModule(void) mi.position = -2000005000;
mi.ptszName = LPGENT("Re&ad Away Message");
mi.pszService = MS_AWAYMSG_SHOWAWAYMSG;
- hAwayMsgMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hAwayMsgMenuItem = Menu_AddContactMenuItem(&mi);
mi.flags |= CMIF_ICONFROMICOLIB;
CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_COPYMSG, CopyAwayMsgCommand);
@@ -516,14 +516,14 @@ int LoadAwayMsgModule(void) mi.icolibItem = GetIconHandle(IDI_COPY);
mi.ptszName = LPGENT("Copy Away Message");
mi.pszService = MS_SIMPLESTATUSMSG_COPYMSG;
- hCopyMsgMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hCopyMsgMenuItem = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_GOTOURLMSG, GoToURLMsgCommand);
mi.position = -2000007000;
mi.icolibItem = GetIconHandle(IDI_GOTOURL);
mi.ptszName = LPGENT("&Go to URL in Away Message");
mi.pszService = MS_SIMPLESTATUSMSG_GOTOURLMSG;
- hGoToURLMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hGoToURLMenuItem = Menu_AddContactMenuItem(&mi);
HookEventEx(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu);
diff --git a/plugins/SimpleStatusMsg/main.cpp b/plugins/SimpleStatusMsg/main.cpp index def96c25c3..4cdaee3023 100644 --- a/plugins/SimpleStatusMsg/main.cpp +++ b/plugins/SimpleStatusMsg/main.cpp @@ -1711,7 +1711,7 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) mi.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
mi.ptszName = LPGENT("Status Message...");
mi.position = 2000200000;
- CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddStatusMenuItem(&mi);
mi.popupPosition = 500084000;
mi.position = 2000040000;
@@ -1746,7 +1746,7 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) mi.ptszPopupName = szBuffer;
}
else mi.ptszPopupName = pa[i]->tszAccountName;
- hProtoStatusMenuItem[i] = (HANDLE)CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ hProtoStatusMenuItem[i] = Menu_AddStatusMenuItem(&mi);
}
return 0;
diff --git a/plugins/SmileyAdd/main.cpp b/plugins/SmileyAdd/main.cpp index 2515c6c076..e0965d8655 100644 --- a/plugins/SmileyAdd/main.cpp +++ b/plugins/SmileyAdd/main.cpp @@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //globals
HINSTANCE g_hInst;
HANDLE hEvent1, hContactMenuItem;
-extern LIST<HANDLE> menuHandleArray;
+extern LIST<void> menuHandleArray;
char* metaProtoName;
@@ -105,7 +105,7 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.icolibItem = hSkinIcon;
mi.pszPopupName = (char*)-1;
mi.pszName = "Assign Smiley Category";
- hContactMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hContactMenuItem = Menu_AddContactMenuItem(&mi);
DownloadInit();
@@ -124,7 +124,6 @@ static int MirandaShutdown(WPARAM, LPARAM) return 0;
}
-
extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
{
pluginLink = link;
diff --git a/plugins/SmileyAdd/services.cpp b/plugins/SmileyAdd/services.cpp index 71b43145dc..1993e7e733 100644 --- a/plugins/SmileyAdd/services.cpp +++ b/plugins/SmileyAdd/services.cpp @@ -27,8 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //globals, defined int main.cpp
extern HANDLE hEvent1, hContactMenuItem;
-LIST<HANDLE> menuHandleArray(5);
-
+LIST<void> menuHandleArray(5);
//implementation of service functions
@@ -444,7 +443,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) mi.pszService = MS_SMILEYADD_CUSTOMCATMENU;
bool nonecheck = true;
- HANDLE* hMenu;
+ HGENMENU hMenu;
for (i = 0; i < smc.getCount(); i++)
{
@@ -462,7 +461,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) nonecheck = false;
}
- hMenu = (HANDLE*)CallService(MS_CLIST_ADDCONTACTMENUITEM, ind, (LPARAM)&mi);
+ hMenu = Menu_AddContactMenuItem(&mi);
menuHandleArray.insert(hMenu);
mi.flags &= ~CMIF_CHECKED;
}
@@ -470,13 +469,12 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) mi.position = 1;
mi.popupPosition = 1;
mi.ptszName = _T("<None>");
- if (cat == _T("<None>"))
- {
+ if (cat == _T("<None>")) {
mi.flags |= CMIF_CHECKED;
nonecheck = false;
}
- hMenu = (HANDLE*)CallService(MS_CLIST_ADDCONTACTMENUITEM, 1, (LPARAM)&mi);
+ hMenu = Menu_AddContactMenuItem(&mi);
menuHandleArray.insert(hMenu);
mi.position = 2;
@@ -484,7 +482,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) mi.ptszName = _T("Protocol specific");
if (nonecheck) mi.flags |= CMIF_CHECKED; else mi.flags &= ~CMIF_CHECKED;
- hMenu = (HANDLE*)CallService(MS_CLIST_ADDCONTACTMENUITEM, 2, (LPARAM)&mi);
+ hMenu = Menu_AddContactMenuItem(&mi);
menuHandleArray.insert(hMenu);
}
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 4e18efd5b7..008aa3b8f7 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -356,8 +356,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.position = -0x7FFFFFFF;
mi.ptszName = _T("Call Splash Service");
mi.pszService = "Splash/Test";
-
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
#endif
if (ServiceExists(MS_UPDATE_REGISTER))
diff --git a/plugins/StatusPlugins/KeepStatus/version.h b/plugins/StatusPlugins/KeepStatus/version.h index 26a301582a..bd3f501a94 100644 --- a/plugins/StatusPlugins/KeepStatus/version.h +++ b/plugins/StatusPlugins/KeepStatus/version.h @@ -1,9 +1,3 @@ -// Set the version number here - it will affect the version resource and the version field of the pluginInfo structure
-// (Be careful that you don't have the resource file open when you change this and rebuild, otherwise the changes may not
-// take effect within the version resource)
-// Do not forget to define symbol "_DEBUG" for resource compiler if you use debug configuration (in VisualStudio you can
-// find it under Project properties - Configuration properties - Resource - General - Preprocessor definitions)
-
// plugin version part
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 8
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 91b437f7ed..3aef57390c 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -537,8 +537,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP bInitDone = false;
TranslateDialogDefault(hwndDlg);
- if (ServiceExists(MS_CLIST_ADDSTATUSMENUITEM))
- SetDlgItemText(hwndDlg, IDC_CREATEMMI, TranslateT("Create a status menu item"));
+ SetDlgItemText(hwndDlg, IDC_CREATEMMI, TranslateT("Create a status menu item"));
profileCount = GetProfileCount((WPARAM)&defProfile, 0);
if (profileCount == 0) {
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 339733b31a..cc98753df6 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -132,17 +132,10 @@ static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam) return 0;
}
mi.pszService = servicename;
- if (ServiceExists(MS_CLIST_ADDSTATUSMENUITEM)) {
- if (CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi)) {
- menuprofiles[mcount] = i;
- mcount += 1;
- }
- }
- else {
- if (CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi)) {
- menuprofiles[mcount] = i;
- mcount += 1;
- } } }
+ if (Menu_AddStatusMenuItem(&mi)) {
+ menuprofiles[mcount] = i;
+ mcount += 1;
+ } }
return 0;
}
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index c1e8e69bb8..0d9a325839 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -127,9 +127,6 @@ typedef struct { #define DOCKED_LEFT 1
#define DOCKED_RIGHT 2
-#ifndef MS_CLIST_ADDSTATUSMENUITEM
-#define MS_CLIST_ADDSTATUSMENUITEM "CList/AddStatusMenuItem"
-#endif
#define MS_SS_MENUSETPROFILEPREFIX "StartupStatus/SetProfile_"
// options
diff --git a/plugins/StopSpamPlus/src/stopspam.cpp b/plugins/StopSpamPlus/src/stopspam.cpp index beac3f3481..1ff5a0ef28 100644 --- a/plugins/StopSpamPlus/src/stopspam.cpp +++ b/plugins/StopSpamPlus/src/stopspam.cpp @@ -78,7 +78,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
mi.ptszName = _T("Remove Temporary Contacts");
mi.pszService = pluginName"/RemoveTempContacts";
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
miranda::EventHooker::HookAll();
return 0;
diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index 6a800d837f..4869ed7182 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -321,7 +321,7 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.icolibItem = GetIconHandle("versionInfo");
mi.ptszName = LPGENT("Version Information");
mi.pszPopupName = (char *)-1;
- HANDLE hMenuRoot = (HANDLE)CallService( MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
+ HANDLE hMenuRoot = Menu_AddMainMenuItem(&mi);
mi.flags = CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.pszPopupName = (char *)hMenuRoot;
@@ -331,46 +331,46 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.ptszName = LPGENT("Copy to clipboard");
mi.icolibItem = GetIconHandle("storeToClip");
mi.pszService = MS_CRASHDUMPER_STORETOCLIP;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.position = 2000089996;
mi.ptszName = LPGENT("Store to file");
mi.icolibItem = GetIconHandle("storeToFile");
mi.pszService = MS_CRASHDUMPER_STORETOFILE;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.position = 2000089997;
mi.ptszName = LPGENT("Show");
mi.icolibItem = GetIconHandle("showInfo");
mi.pszService = MS_CRASHDUMPER_VIEWINFO;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.popupPosition = 1;
mi.position = 2000089998;
mi.ptszName = LPGENT("Show with DLLs");
mi.icolibItem = GetIconHandle("showInfo");
mi.pszService = MS_CRASHDUMPER_VIEWINFO;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.popupPosition = 0;
mi.position = 2000089999;
mi.ptszName = LPGENT("Upload");
mi.icolibItem = GetIconHandle("uploadInfo");
mi.pszService = MS_CRASHDUMPER_UPLOAD;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.position = 2000099990;
mi.ptszName = LPGENT("Open crash report directory");
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE);
mi.pszService = MS_CRASHDUMPER_URL;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
mi.popupPosition = 1;
mi.position = 2000099991;
mi.ptszName = LPGENT("Open miranda-vi.org");
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_URL);
mi.pszService = MS_CRASHDUMPER_URL;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
HOTKEYDESC hk = {0};
hk.cbSize = sizeof(hk);
diff --git a/plugins/Svc_dbepp/main.cpp b/plugins/Svc_dbepp/main.cpp index 4860f13e09..a7145fe23f 100644 --- a/plugins/Svc_dbepp/main.cpp +++ b/plugins/Svc_dbepp/main.cpp @@ -302,14 +302,6 @@ INT_PTR ImportFromFile(WPARAM wParam,LPARAM lParam) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
{
- CLISTMENUITEM mi;
-/*
- #ifndef NDEBUG //mem leak detector :-) Thanks Tornado!
- int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flag
- flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit
- _CrtSetDbgFlag(flag); // Set flag to the new value
- #endif
-*/
pluginLink = link;
mir_getMMI(&mmi);
mir_getUTFI( &utfi );
@@ -327,7 +319,8 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) sRegisterModule = CreateServiceFunction("DBEditorpp/RegisterModule", RegisterModule);
sRegisterSingleModule = CreateServiceFunction("DBEditorpp/RegisterSingleModule", RegisterSingleModule);
sImport = CreateServiceFunction("DBEditorpp/Import", ImportFromFile);
- ZeroMemory(&mi, sizeof(mi));
+
+ CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.position = 1900000001;
mi.flags = CMIF_TCHAR;
@@ -335,7 +328,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) mi.ptszName = _T(modFullname);
mi.pszService = "DBEditorpp/MenuCommand";
mi.pszContactOwner = NULL;
- CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);
@@ -345,7 +338,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) mi.ptszName = LPGENT("Open user tree in DBE++");
mi.pszService = "DBEditorpp/MenuCommand";
mi.pszContactOwner = NULL;
- hUserMenu = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hUserMenu = Menu_AddContactMenuItem(&mi);
sServicemodeLaunch = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
diff --git a/plugins/Svc_vi/main.cpp b/plugins/Svc_vi/main.cpp index f6a9c7bd99..207e4fc433 100644 --- a/plugins/Svc_vi/main.cpp +++ b/plugins/Svc_vi/main.cpp @@ -121,21 +121,15 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) }
//Menu item
- //if (DBGetContactSettingByte(NULL, ModuleName, "MenuItem", TRUE)) {
- {
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
- mi.position = mi.popupPosition = 2000089999;
- mi.flags = 0;
- mi.hIcon = hiVIIcon;
- mi.pszName = Translate("Version Information");
- mi.pszService = MS_VERSIONINFO_MENU_COMMAND;
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
-// mi.pszPopupName = "Version Information";
-// mi.popupPosition = 2;
-// mi.pszName = "Test 1";
-// CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
- }
+ CLISTMENUITEM mi = { 0 };
+ mi.cbSize = sizeof(mi);
+ mi.position = mi.popupPosition = 2000089999;
+ mi.flags = 0;
+ mi.hIcon = hiVIIcon;
+ mi.pszName = Translate("Version Information");
+ mi.pszService = MS_VERSIONINFO_MENU_COMMAND;
+ Menu_AddMainMenuItem(&mi);
+
if (LoadLibraryA("RichEd32.dll") == NULL)
MessageBoxA(NULL, "d'oh", "d'oh", MB_OK);
diff --git a/plugins/TabSRMM/chat/services.cpp b/plugins/TabSRMM/chat/services.cpp index c24af3af6b..a7033f8a62 100644 --- a/plugins/TabSRMM/chat/services.cpp +++ b/plugins/TabSRMM/chat/services.cpp @@ -91,14 +91,14 @@ int Chat_ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_JOIN );
mi.pszName = LPGEN("&Join");
mi.pszService = "GChat/JoinChat";
- hJoinMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hJoinMenuItem = Menu_AddContactMenuItem(&mi);
mi.position = -2000090000;
mi.flags = CMIF_NOTOFFLINE | CMIF_ICONFROMICOLIB;
mi.icolibItem = LoadSkinnedIconHandle( SKINICON_CHAT_LEAVE );
mi.pszName = LPGEN("&Leave");
mi.pszService = "GChat/LeaveChat";
- hLeaveMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
CList_SetAllOffline(TRUE, NULL);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index a92d20c92c..c924b06675 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -258,7 +258,7 @@ void CGlobals::reloadSystemModulesChanged() }
mi.pszName = LPGEN("&Message");
mi.pszService = MS_MSG_SENDMESSAGE;
- PluginConfig.m_hMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ PluginConfig.m_hMenuItem = Menu_AddContactMenuItem(&mi);
m_useAeroPeek = M->GetByte("useAeroPeek", 1);
}
@@ -444,7 +444,7 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.pszContactOwner = NULL;
mi.pszName = LPGEN("&Messaging settings...");
mi.pszService = MS_TABMSG_SETUSERPREFS;
- PluginConfig.m_UserMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ PluginConfig.m_UserMenuItem = Menu_AddContactMenuItem(&mi);
if(sendLater->isAvail()) {
mi.cbSize = sizeof(mi);
@@ -453,7 +453,7 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.pszContactOwner = NULL;
mi.pszName = LPGEN("&Send later job list...");
mi.pszService = MS_TABMSG_SLQMGR;
- PluginConfig.m_UserMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) & mi);
+ PluginConfig.m_UserMenuItem = Menu_AddMainMenuItem(&mi);
}
RestoreUnreadMessageAlerts();
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 7878715850..4a892a9390 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -558,7 +558,7 @@ int TN_ModuleInit() }
mi.pszService = "TypingNotify/EnableDisableMenuCommand";
mi.pszPopupName = LPGEN("PopUps");
- hDisableMenu = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ hDisableMenu = Menu_AddMainMenuItem(&mi);
}
SkinAddNewSoundEx("TNStart", "Instant messages", "Contact started typing");
SkinAddNewSoundEx("TNStop", "Instant messages", "Contact stopped typing");
diff --git a/plugins/Updater/common.h b/plugins/Updater/common.h index b1a070f78e..d51a1db85b 100644 --- a/plugins/Updater/common.h +++ b/plugins/Updater/common.h @@ -27,6 +27,7 @@ #include <m_netlib.h>
#include <m_utils.h>
#include <m_clist.h>
+#include <m_genmenu.h>
#include <m_icoLib.h>
#include <win2k.h>
diff --git a/plugins/Updater/options.cpp b/plugins/Updater/options.cpp index 22ace012a6..7539ce2047 100644 --- a/plugins/Updater/options.cpp +++ b/plugins/Updater/options.cpp @@ -9,30 +9,28 @@ HWND hwndOptions; HANDLE hMainMenuItemRestart, hMainMenuItemUpdateAndExit;
HANDLE hBackupPath, hDataPath, hArchivePath;
-void add_restart_menu_item() {
- CLISTMENUITEM menu = {0};
-
- menu.cbSize=sizeof(menu);
- menu.flags = CMIM_ALL | CMIF_ICONFROMICOLIB;
- menu.icolibItem = GetIconHandle(I_RSTRT);
-
- menu.pszName = "Restart";
- menu.pszService= MS_UPDATE_MENURESTART;
- menu.position = 2000099900;
- hMainMenuItemRestart = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+void add_restart_menu_item()
+{
+ CLISTMENUITEM mi = {0};
+ mi.cbSize=sizeof(mi);
+ mi.flags = CMIM_ALL | CMIF_ICONFROMICOLIB;
+ mi.icolibItem = GetIconHandle(I_RSTRT);
+ mi.pszName = "Restart";
+ mi.pszService= MS_UPDATE_MENURESTART;
+ mi.position = 2000099900;
+ hMainMenuItemRestart = Menu_AddMainMenuItem(&mi);
}
-void add_update_and_exit_menu_item() {
- CLISTMENUITEM menu = {0};
-
- menu.cbSize=sizeof(menu);
- menu.flags = CMIM_ALL | CMIF_ICONFROMICOLIB;
- menu.icolibItem = GetIconHandle(I_CHKUPDEXT);
-
- menu.pszName = "Update and Exit";
- menu.pszService= MS_UPDATE_MENUUPDATEANDEXIT;
- menu.position = 2000099901;
- hMainMenuItemUpdateAndExit = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+void add_update_and_exit_menu_item()
+{
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(mi);
+ mi.flags = CMIM_ALL | CMIF_ICONFROMICOLIB;
+ mi.icolibItem = GetIconHandle(I_CHKUPDEXT);
+ mi.pszName = "Update and Exit";
+ mi.pszService = MS_UPDATE_MENUUPDATEANDEXIT;
+ mi.position = 2000099901;
+ hMainMenuItemUpdateAndExit = Menu_AddMainMenuItem(&mi);
}
void remove_restart_menu_item() {
diff --git a/plugins/Updater/services.cpp b/plugins/Updater/services.cpp index 8d3883b895..3b11ddf850 100644 --- a/plugins/Updater/services.cpp +++ b/plugins/Updater/services.cpp @@ -788,26 +788,26 @@ VOID CALLBACK StartupTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwT HANDLE hEventServicesModulesLoaded2;
-int ServicesModulesLoaded(WPARAM wParam, LPARAM lParam) {
+int ServicesModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
// add main menu item
- CLISTMENUITEM menu = {0};
+ CLISTMENUITEM mi = {0};
- menu.cbSize=sizeof(menu);
- menu.flags = CMIM_ALL | CMIF_ICONFROMICOLIB;
- menu.icolibItem = GetIconHandle(I_CHKUPD);
+ mi.cbSize=sizeof(mi);
+ mi.flags = CMIM_ALL | CMIF_ICONFROMICOLIB;
+ mi.icolibItem = GetIconHandle(I_CHKUPD);
- menu.pszName = "Check for updates";
- menu.pszService= MS_UPDATE_CHECKFORUPDATES;
- menu.position = 500010000;
+ mi.pszName = "Check for updates";
+ mi.pszService= MS_UPDATE_CHECKFORUPDATES;
+ mi.position = 500010000;
-#ifdef MS_CLIST_ADDGROUPMENUITEM
- if (ServiceExists(MS_CLIST_ADDGROUPMENUITEM)) {
+ if (ServiceExists(MS_CLIST_REMOVEGROUPMENUITEM)) {
GroupMenuParam gmp = {0};
- hGroupMenuItem = (HANDLE)CallService(MS_CLIST_ADDGROUPMENUITEM,(WPARAM)&gmp,(LPARAM)&menu);
+ hGroupMenuItem = Menu_AddGroupMenuItem(&gmp, &mi);
}
-#endif
- hMainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+
+ hMainMenuItem = Menu_AddMainMenuItem(&mi);
hEventServicesModulesLoaded2 = HookEvent(ME_SYSTEM_MODULESLOADED, ServicesModulesLoaded2);
startup_timer_id = SetTimer(0, 0, 5000, StartupTimerProc);
diff --git a/plugins/UserGuide/main.c b/plugins/UserGuide/main.c index 95b7c6b731..8e63d94d08 100644 --- a/plugins/UserGuide/main.c +++ b/plugins/UserGuide/main.c @@ -93,7 +93,7 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_HELP);
mi.pszName=LPGEN("User Guide");
mi.pszService="UserGuide/ShowGuide";
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ Menu_AddMainMenuItem(&mi);
return 0;
}
diff --git a/plugins/UserInfoEx/mir_menuitems.cpp b/plugins/UserInfoEx/mir_menuitems.cpp index 9fd7f031a6..05707ba7c0 100644 --- a/plugins/UserInfoEx/mir_menuitems.cpp +++ b/plugins/UserInfoEx/mir_menuitems.cpp @@ -118,7 +118,7 @@ VOID RebuildContact() mi.popupPosition = 1000050000;
mi.hIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0);
mi.pszName = LPGEN(MODULELONGNAME);
- mhRoot = (HGENMENU) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ mhRoot = Menu_AddContactMenuItem(&mi);
hMenuItem[item++] = mhRoot;
mhExIm = mhRoot;
break;
@@ -128,7 +128,7 @@ VOID RebuildContact() mi.popupPosition = 1000050100;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import contact");
- mhExIm = (HGENMENU) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ mhExIm = Menu_AddContactMenuItem(&mi);
hMenuItem[item++] = mhExIm;
mhRoot = HGENMENU_ROOT;
break;
@@ -146,7 +146,7 @@ VOID RebuildContact() mi.position = 1000050000;
mi.hIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0);
mi.hotKey = MAKELPARAM(VK_F3, MOD_ALT);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddContactMenuItem(&mi);
mi.hotKey = NULL;
}
@@ -158,14 +158,14 @@ VOID RebuildContact() mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export User Details");
mi.position = 1000050200;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddContactMenuItem(&mi);
// Import
mi.pszService = MS_USERINFO_VCARD_IMPORT;
mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import User Details");
mi.position = 1000050300;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddContactMenuItem(&mi);
}
}
@@ -217,7 +217,7 @@ VOID RebuildMain() mi.popupPosition = 500050000;
mi.hIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0);
mi.pszName = LPGEN(MODULELONGNAME);
- mhRoot = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ mhRoot = Menu_AddMainMenuItem(&mi);
hMenuItem[item++] = mhRoot;
mhExIm = mhRoot;
break;
@@ -227,7 +227,7 @@ VOID RebuildMain() mi.popupPosition = 500050000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import contact");
- mhExIm = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ mhExIm = Menu_AddMainMenuItem(&mi);
hMenuItem[item++] = mhExIm;
mhRoot = HGENMENU_ROOT;
break;
@@ -244,7 +244,7 @@ VOID RebuildMain() mi.pszName = LPGEN("View/Change My &Details...");
mi.position = 500050000;
mi.hIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
// VCard's Ex/Import menuitems
@@ -255,14 +255,14 @@ VOID RebuildMain() mi.pszName = LPGEN("Export all contacts");
mi.position = 500150000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
// Import
mi.pszService = MS_USERINFO_VCARD_IMPORTALL;
mi.pszName = LPGEN("Import all contacts");
mi.position = 500151000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
mi.hParentMenu = mhRoot;
@@ -278,13 +278,13 @@ VOID RebuildMain() mi.pszName = LPGEN("Backup birthdays");
mi.position = 500253000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_BDAY_BACKUP);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
// Check anniversaries
mi.pszService = MS_USERINFO_REMINDER_CHECK;
mi.pszName = LPGEN("Check anniversaries");
mi.position = 500251000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_SEARCH);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
else {
hMenuItem[item++] = NULL;
@@ -295,7 +295,7 @@ VOID RebuildMain() mi.pszName = LPGEN("Refresh Contact Details");
mi.position = 500254000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
// anniversary list
@@ -304,7 +304,7 @@ VOID RebuildMain() mi.pszName = LPGEN("Anniversary list");
mi.position = 500252000;
mi.hIcon = IcoLib_GetIcon(ICO_COMMON_ANNIVERSARY);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
}
}
@@ -363,7 +363,7 @@ VOID RebuildGroup() mi.popupPosition = 250000;
mi.hIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0);
mi.pszName = LPGEN(MODULELONGNAME);
- mhRoot = (HGENMENU) CallService(MS_CLIST_ADDGROUPMENUITEM, 0, (LPARAM)&mi);
+ mhRoot = Menu_AddGroupMenuItem(0, &mi);
hMenuItem[item++] = mhRoot;
mhExIm = mhRoot;
break;
@@ -373,7 +373,7 @@ VOID RebuildGroup() mi.popupPosition = 250100;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import contact");
- mhExIm = (HGENMENU) CallService(MS_CLIST_ADDGROUPMENUITEM, 0, (LPARAM)&mi);
+ mhExIm = Menu_AddGroupMenuItem(0, &mi);
hMenuItem[item++] = mhExIm;
mhRoot = HGENMENU_ROOT;
break;
@@ -391,14 +391,14 @@ VOID RebuildGroup() mi.pszName = LPGEN("Export all contacts");
mi.position = 250200;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDGROUPMENUITEM, (WPARAM)&gmp, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddGroupMenuItem(0, &mi);
// Import
mi.pszService = MS_USERINFO_VCARD_IMPORTALL;
mi.pszName = LPGEN("Import all contacts");
mi.position = 250300;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDGROUPMENUITEM, (WPARAM)&gmp, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddGroupMenuItem(0, &mi);
}
}
@@ -461,7 +461,7 @@ VOID RebuildSubGroup() mi.popupPosition = 1050000;
mi.hIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0);
mi.pszName = LPGEN(MODULELONGNAME);
- mhRoot = (HGENMENU) CallService(MS_CLIST_ADDSUBGROUPMENUITEM, 0, (LPARAM)&mi);
+ mhRoot = Menu_AddSubGroupMenuItem(0, &mi);
hMenuItem[item++] = mhRoot;
mhExIm = mhRoot;
break;
@@ -471,7 +471,7 @@ VOID RebuildSubGroup() mi.popupPosition = 1050100;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
mi.pszName = LPGEN("Ex-/Import Group");
- mhExIm = (HGENMENU) CallService(MS_CLIST_ADDSUBGROUPMENUITEM, 0, (LPARAM)&mi);
+ mhExIm = Menu_AddSubGroupMenuItem(0, &mi);
hMenuItem[item++] = mhExIm;
mhRoot = HGENMENU_ROOT;
break;
@@ -492,7 +492,7 @@ VOID RebuildSubGroup() mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
gmp.lParam=0;
gmp.wParam=TRUE;
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDSUBGROUPMENUITEM, (WPARAM)&gmp, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddSubGroupMenuItem(&gmp, &mi);
// Import
strcpy( tDest, "/ImportGroup"); //mi.pszService
@@ -502,7 +502,7 @@ VOID RebuildSubGroup() mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
gmp.lParam=0;
gmp.wParam=FALSE;
- hMenuItem[item++] = (HGENMENU) CallService(MS_CLIST_ADDSUBGROUPMENUITEM, (WPARAM)&gmp, (LPARAM)&mi);
+ hMenuItem[item++] = Menu_AddSubGroupMenuItem(&gmp, &mi);
}
}
@@ -588,14 +588,14 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mhExIm = mhRoot;
// seperator
mi.position = 50100;
- hMenuItemAccount[mItems*i + item++] = (HGENMENU) CallService( MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi);
break;
case 5:
//cascade all
mi.position = 50100;
mi.hIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON), 0);
mi.ptszName = TranslateT(MODULELONGNAME);
- hMenuItemAccount[mItems*i + item] = (HGENMENU) CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi);
mhRoot = hMenuItemAccount[mItems*i + item++];
mhExIm = mhRoot;
break;
@@ -605,7 +605,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT);
mir_sntprintf(sztName, SIZEOF(sztName),_T("%s %s"), pAccountName->tszAccountName, TranslateT("Ex-/Import"));
mi.ptszName = sztName;
- hMenuItemAccount[mItems*i + item] = (HGENMENU) CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi);
mhExIm = hMenuItemAccount[mItems*i + item++];
break;
default:
@@ -624,7 +624,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mi.ptszName = sztName;
mi.position = 50200;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT);
- hMenuItemAccount[mItems*i + item++] = (HGENMENU) CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi);
// Import
strcpy( tDest, "/ImportAccount"); //mi.pszService
@@ -633,7 +633,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mi.ptszName = sztName;
mi.position = 50300;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT);
- hMenuItemAccount[mItems*i + item++] = (HGENMENU) CallService(MS_CLIST_ADDSTATUSMENUITEM, 0, (LPARAM)&mi);
+ hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi);
}
}
return 0;
diff --git a/plugins/UserInfoEx/svc_email.cpp b/plugins/UserInfoEx/svc_email.cpp index 2d74c96e75..d1a8ba02d6 100644 --- a/plugins/UserInfoEx/svc_email.cpp +++ b/plugins/UserInfoEx/svc_email.cpp @@ -265,7 +265,7 @@ VOID SvcEMailRebuildMenu() mi.hIcon = IcoLib_GetIcon(ICO_BTN_EMAIL);
mi.pszName = "&E-mail";
mi.pszService = MS_EMAIL_SENDEMAIL;
- ghMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ ghMenuItem = Menu_AddContactMenuItem(&mi);
}
}
else
diff --git a/plugins/UserInfoEx/svc_homepage.cpp b/plugins/UserInfoEx/svc_homepage.cpp index 4d0ac22554..4c0a619168 100644 --- a/plugins/UserInfoEx/svc_homepage.cpp +++ b/plugins/UserInfoEx/svc_homepage.cpp @@ -224,7 +224,7 @@ VOID SvcHomepageRebuildMenu() mi.hIcon = IcoLib_GetIcon(ICO_BTN_GOTO);
mi.pszName = "&Homepage";
mi.pszService = MS_USERINFO_HOMEPAGE_OPENURL;
- ghMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ ghMenuItem = Menu_AddContactMenuItem(&mi);
}
}
else
diff --git a/plugins/WhenWasIt/hooked_events.cpp b/plugins/WhenWasIt/hooked_events.cpp index e24e642612..41a956f1b1 100644 --- a/plugins/WhenWasIt/hooked_events.cpp +++ b/plugins/WhenWasIt/hooked_events.cpp @@ -127,35 +127,35 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) cl.pszService = MS_WWI_CHECK_BIRTHDAYS;
cl.pszName = "Check for birthdays";
cl.pszPopupName = "Birthdays (When Was It)";
- hmCheckBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmCheckBirthdays = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_LIST_SHOW;
cl.pszName = "Birthday list";
cl.hIcon = hiListMenu;
- hmBirthdayList = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmBirthdayList = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_REFRESH_USERDETAILS;
cl.position = 10100000;
cl.pszName = "Refresh user details";
cl.hIcon = hiRefreshUserDetails;
- hmRefreshDetails = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmRefreshDetails = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_IMPORT_BIRTHDAYS;
cl.position = 10200000;
cl.pszName = "Import birthdays";
cl.hIcon = hiImportBirthdays;
- hmImportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmImportBirthdays = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_EXPORT_BIRTHDAYS;
cl.pszName = "Export birthdays";
cl.hIcon = hiExportBirthdays;
- hmExportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
+ hmExportBirthdays = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_ADD_BIRTHDAY;
cl.position = 10000000;
cl.hIcon = hiAddBirthdayContact;
cl.pszName = "Add/change user &birthday";
- hmAddChangeBirthday = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &cl);
+ hmAddChangeBirthday = Menu_AddMainMenuItem(&cl);
if(ServiceExists(MS_HOTKEY_REGISTER)) {
HOTKEYDESC hotkey = {0};
diff --git a/plugins/YAPP/services.cpp b/plugins/YAPP/services.cpp index 751b82387e..12b7110264 100644 --- a/plugins/YAPP/services.cpp +++ b/plugins/YAPP/services.cpp @@ -242,11 +242,11 @@ INT_PTR IsSecondLineShown(WPARAM wParam, LPARAM lParam) { }
void UpdateMenu() {
- CLISTMENUITEM menu = {0};
- menu.cbSize = sizeof(CLISTMENUITEM);
- menu.pszName = (char*)(DBGetContactSettingByte(0, MODULE, "Enabled", 1) == 1 ? LPGEN("Disable Popups") : LPGEN("Enable Popups"));
- menu.flags = CMIM_NAME;// | CMIM_ICON;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuToggleOnOff, (LPARAM)&menu);
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(CLISTMENUITEM);
+ mi.pszName = (char*)(DBGetContactSettingByte(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);
}
INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam) {
@@ -485,25 +485,25 @@ void InitServices() hService[i++] = CreateServiceFunction("YAPP/RegisterClass", RegisterPopupClass);
hService[i++] = CreateServiceFunction("YAPP/ClassInstance", CreateClassPopup);
- CLISTMENUITEM menu = {0};
+ CLISTMENUITEM mi = {0};
- menu.cbSize = sizeof(menu);
- menu.flags = CMIM_ALL;
+ mi.cbSize = sizeof(mi);
+ mi.flags = CMIM_ALL;
- menu.position = 500010000;
- menu.pszPopupName = LPGEN("PopUps");
+ mi.position = 500010000;
+ mi.pszPopupName = LPGEN("PopUps");
hiPopupHistory = LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP_HISTORY));
- menu.hIcon = hiPopupHistory;
- menu.pszService= MS_POPUP_SHOWHISTORY;
- menu.pszName = LPGEN("Popup History");
- hMenuShowHistory = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&menu);
+ mi.hIcon = hiPopupHistory;
+ mi.pszService= MS_POPUP_SHOWHISTORY;
+ mi.pszName = LPGEN("Popup History");
+ hMenuShowHistory = Menu_AddMainMenuItem(&mi);
- menu.hIcon = NULL;
- menu.pszService = "PopUp/ToggleEnabled";
- menu.pszName = (char*)(DBGetContactSettingByte(0, MODULE, "Enabled", 1) ?
+ mi.hIcon = NULL;
+ mi.pszService = "PopUp/ToggleEnabled";
+ mi.pszName = (char*)(DBGetContactSettingByte(0, MODULE, "Enabled", 1) ?
LPGEN("Disable Popups") : LPGEN("Enable Popups"));
- hMenuToggleOnOff = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&menu);
+ hMenuToggleOnOff = Menu_AddMainMenuItem(&mi);
hEventBuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildMenu);
}
diff --git a/plugins/ZeroNotification/main.c b/plugins/ZeroNotification/main.c index 914df953ee..077b9748a8 100644 --- a/plugins/ZeroNotification/main.c +++ b/plugins/ZeroNotification/main.c @@ -17,7 +17,7 @@ HINSTANCE hInst; PLUGINLINK *pluginLink;
static HANDLE hEventSoundSettingChange, hEventStatusModeChange, hEventOptionsInitialize, hAckEvent;
CLISTMENUITEM mi;
-int noSoundMenu;
+HGENMENU noSoundMenu;
int hLangpack;
struct CheckBoxValues_t {
@@ -281,8 +281,8 @@ int __declspec(dllexport) Load(PLUGINLINK *link) mi.flags=0;
UpdateMenuItem();
- mi.pszService=PLUGINNAME_SHORT "/MenuCommand";
- noSoundMenu = CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ mi.pszService = PLUGINNAME_SHORT "/MenuCommand";
+ noSoundMenu = Menu_AddMainMenuItem(&mi);
}
//The menu item - end
|