From b1db27c61150e1313a537d1de009ec26bae414ab Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 31 May 2015 22:09:02 +0000 Subject: - CreateProtoServiceFunction() moved into mir_core.dll instead of inlining - all old protocols moved on it; - code cleaning; git-svn-id: http://svn.miranda-ng.org/main/trunk@13953 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AddContactPlus/src/addcontact.cpp | 6 ++-- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 16 +++------ plugins/GmailNotifier/src/main.cpp | 6 ++-- plugins/IEView/src/Options.cpp | 9 ++--- plugins/LotusNotify/src/LotusNotify.cpp | 16 +++------ plugins/MenuItemEx/src/main.cpp | 2 +- plugins/Non-IM Contact/src/main.cpp | 8 ++--- plugins/StopSpamPlus/src/events.cpp | 2 +- plugins/WebView/src/main.cpp | 41 +++++------------------ 9 files changed, 33 insertions(+), 73 deletions(-) (limited to 'plugins') diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index b2e0741f56..2c301ebf20 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -296,9 +296,9 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) if (flags & PF4_NOCUSTOMAUTH) CallContactService(hContact, PSS_AUTHREQUEST, 0, 0); else { - TCHAR szReason[512]; - GetDlgItemText(hdlg, IDC_AUTHREQ, szReason, SIZEOF(szReason)); - CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)szReason); + TCHAR tszReason[512]; + GetDlgItemText(hdlg, IDC_AUTHREQ, tszReason, SIZEOF(tszReason)); + CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)tszReason); } } } diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 387df80cda..4f2f4b5afc 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -887,17 +887,11 @@ extern "C" int __declspec(dllexport) Load(void) for (MCONTACT hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact, PLUGINNAME)) db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); - char service[100] = { "" }; - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETCAPS); - CreateServiceFunction(service, GetCaps); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETNAME); - CreateServiceFunction(service, GetName); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_LOADICON); - CreateServiceFunction(service, TMLoadIcon); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_SETSTATUS); - CreateServiceFunction(service, SetStatus); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETSTATUS); - CreateServiceFunction(service, GetStatus); + CreateProtoServiceFunction(PLUGINNAME, PS_GETCAPS, GetCaps); + CreateProtoServiceFunction(PLUGINNAME, PS_GETNAME, GetName); + CreateProtoServiceFunction(PLUGINNAME, PS_LOADICON, TMLoadIcon); + CreateProtoServiceFunction(PLUGINNAME, PS_SETSTATUS, SetStatus); + CreateProtoServiceFunction(PLUGINNAME, PS_GETSTATUS, GetStatus); SkinAddNewSoundEx(PLUGINNAME_NEWSOUND, PLUGINNAME, LPGEN("New Connection Notification")); hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 992b2cc633..dc749998b4 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -95,9 +95,9 @@ extern "C" int __declspec(dllexport) Load() pd.type = PROTOTYPE_VIRTUAL; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); - CreateServiceFunction(pluginName PS_GETCAPS, GetCaps); - CreateServiceFunction(pluginName PS_GETSTATUS, GetStatus); - CreateServiceFunction(pluginName PS_GETNAME, GetName); + CreateProtoServiceFunction(pluginName, PS_GETCAPS, GetCaps); + CreateProtoServiceFunction(pluginName, PS_GETSTATUS, GetStatus); + CreateProtoServiceFunction(pluginName, PS_GETNAME, GetName); CreateServiceFunction("GmailMNotifier/Notifying", Notifying); opt.circleTime = db_get_dw(NULL, pluginName, "circleTime", 30); diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index fb4aa2b3fd..1ae24e9dfd 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -381,14 +381,11 @@ static void RefreshProtoList(HWND hwndDlg, int mode, bool protoTemplates) tvi.hInsertAfter = TVI_LAST; tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE; tvi.item.stateMask = TVIS_SELECTED | TVIS_STATEIMAGEMASK; - if (i == 0) { + if (i == 0) mir_strcpy(protoName, Translate("Default")); - } - else { + else CallProtoService(proto->getProtocolName(), PS_GETNAME, sizeof(protoName), (LPARAM)protoName); - // mir_strcat(protoName, " "); - // mir_strcat(protoName, Translate("protocol")); - } + tvi.item.pszText = mir_a2t(protoName); tvi.item.lParam = (LPARAM)proto; tvi.item.iImage = i; diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 4faf246e76..a83b42f0a5 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -1638,17 +1638,11 @@ extern "C" int __declspec(dllexport) Load(void) db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); } - char service[100] = {""}; - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETCAPS); - CreateServiceFunction(service, GetCaps); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETNAME); - CreateServiceFunction(service, GetName); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_LOADICON); - CreateServiceFunction(service, TMLoadIcon); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_SETSTATUS); - CreateServiceFunction(service, SetStatus); - mir_snprintf(service, SIZEOF(service), "%s%s", PLUGINNAME, PS_GETSTATUS); - CreateServiceFunction(service, GetStatus); + CreateProtoServiceFunction(PLUGINNAME, PS_GETCAPS, GetCaps); + CreateProtoServiceFunction(PLUGINNAME, PS_GETNAME, GetName); + CreateProtoServiceFunction(PLUGINNAME, PS_LOADICON, TMLoadIcon); + CreateProtoServiceFunction(PLUGINNAME, PS_SETSTATUS, SetStatus); + CreateProtoServiceFunction(PLUGINNAME, PS_GETSTATUS, GetStatus); LoadSettings(); //read from db to variables diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 202a4589c5..b75ad82428 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -427,7 +427,7 @@ INT_PTR onSendAuthRequest(WPARAM wparam, LPARAM) DWORD flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0); if (flags&PF4_NOCUSTOMAUTH) - CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)""); + CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)_T("")); else CreateDialogParam(hinstance, MAKEINTRESOURCE(IDD_AUTHREQ), (HWND)CallService(MS_CLUI_GETHWND, 0, 0), AuthReqWndProc, (LPARAM)hContact); diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 08143c5f62..76bdd444de 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -128,10 +128,10 @@ extern "C" __declspec(dllexport) int Load() CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); //load services (the first 5 are the basic ones needed to make a new protocol) - CreateServiceFunction(MODNAME PS_GETCAPS, GetLCCaps); - CreateServiceFunction(MODNAME PS_GETNAME, GetLCName); - CreateServiceFunction(MODNAME PS_LOADICON, LoadLCIcon); - CreateServiceFunction(MODNAME PS_GETSTATUS, GetLCStatus); + CreateProtoServiceFunction(MODNAME, PS_GETCAPS, GetLCCaps); + CreateProtoServiceFunction(MODNAME, PS_GETNAME, GetLCName); + CreateProtoServiceFunction(MODNAME, PS_LOADICON, LoadLCIcon); + CreateProtoServiceFunction(MODNAME, PS_GETSTATUS, GetLCStatus); CreateServiceFunction("AddLCcontact", addContact); CreateServiceFunction("EditLCcontact", editContact); diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index a70e70d0aa..ce63fdc878 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -33,7 +33,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) // ...send message char *AuthRepl = mir_u2a(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str()); - ProtoCallService(dbei.szModule, PS_AUTHDENY, (WPARAM)hDbEvent, (LPARAM)AuthRepl); + ProtoCallService(dbei.szModule, PS_AUTHDENY, hDbEvent, (LPARAM)AuthRepl); mir_free(AuthRepl); db_set_b(hcntct, "CList", "NotOnList", 1); diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 1495f107ff..1e3ff4bd07 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -48,39 +48,14 @@ PLUGININFOEX pluginInfoEx = { /*****************************************************************************/ void InitServices() { - char SvcFunc[100]; - - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PS_GETCAPS); - CreateServiceFunction(SvcFunc, GetCaps); - - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PS_GETNAME); - CreateServiceFunction(SvcFunc, GetName); - - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PS_LOADICON); - CreateServiceFunction(SvcFunc, BPLoadIcon); - - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PS_SETSTATUS); - CreateServiceFunction(SvcFunc, SetStatus); - - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PS_GETSTATUS); - CreateServiceFunction(SvcFunc, GetStatus); - // - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PS_BASICSEARCH); - CreateServiceFunction(SvcFunc, BasicSearch); - - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PS_ADDTOLIST); - CreateServiceFunction(SvcFunc, AddToList); - - mir_strcpy(SvcFunc, MODULENAME); - mir_strcat(SvcFunc, PSS_GETINFO); - CreateServiceFunction(SvcFunc, GetInfo); + CreateProtoServiceFunction(MODULENAME, PS_GETCAPS, GetCaps); + CreateProtoServiceFunction(MODULENAME, PS_GETNAME, GetName); + CreateProtoServiceFunction(MODULENAME, PS_LOADICON, BPLoadIcon); + CreateProtoServiceFunction(MODULENAME, PS_SETSTATUS, SetStatus); + CreateProtoServiceFunction(MODULENAME, PS_GETSTATUS, GetStatus); + CreateProtoServiceFunction(MODULENAME, PS_BASICSEARCH, BasicSearch); + CreateProtoServiceFunction(MODULENAME, PS_ADDTOLIST, AddToList); + CreateProtoServiceFunction(MODULENAME, PSS_GETINFO, GetInfo); } /*****************************************************************************/ -- cgit v1.2.3