summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/AVS/src/acc.cpp6
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp19
-rw-r--r--plugins/CSList/src/cslist.cpp13
-rw-r--r--plugins/Clist_modern/src/modern_clistmod.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_statusbar.cpp10
-rw-r--r--plugins/Clist_mw/src/clcitems.cpp8
-rw-r--r--plugins/Clist_mw/src/clistmod.cpp6
-rw-r--r--plugins/Clist_mw/src/commonheaders.h1
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp10
-rw-r--r--plugins/Clist_nicer/src/clui.cpp16
-rw-r--r--plugins/KeyboardNotify/src/main.cpp13
-rwxr-xr-xplugins/MetaContacts/src/meta_services.cpp115
-rw-r--r--plugins/MetaContacts/src/meta_utils.cpp6
-rw-r--r--plugins/ModernOpt/src/mopt_selector.cpp80
-rw-r--r--plugins/New_GPG/src/main.cpp18
-rw-r--r--plugins/New_GPG/src/messages.cpp105
-rw-r--r--plugins/New_GPG/src/utilities.cpp8
-rw-r--r--plugins/Nudge/src/main.cpp5
-rw-r--r--plugins/Ping/src/pingthread.cpp9
-rw-r--r--plugins/SMS/src/functions.cpp22
-rw-r--r--plugins/SMS/src/send.cpp12
-rw-r--r--plugins/Scriver/src/chat/window.cpp6
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp17
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp5
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp4
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp9
-rw-r--r--protocols/Yahoo/src/services.cpp18
-rw-r--r--src/modules/clist/clistevents.cpp1
-rw-r--r--src/modules/protocols/protoaccs.cpp22
-rw-r--r--src/modules/protocols/protoopts.cpp2
30 files changed, 164 insertions, 408 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp
index d080f74d30..5e2512c82c 100644
--- a/plugins/AVS/src/acc.cpp
+++ b/plugins/AVS/src/acc.cpp
@@ -84,8 +84,7 @@ typedef struct
void ResizeFlash(HWND hwnd, ACCData* data)
{
- if ((data->hContact != NULL || data->proto[0] != '\0')
- && ServiceExists(MS_FAVATAR_RESIZE))
+ if ((data->hContact != NULL || data->proto[0] != '\0') && ServiceExists(MS_FAVATAR_RESIZE))
{
RECT rc;
GetClientRect(hwnd, &rc);
@@ -131,8 +130,7 @@ void DestroyFlash(HWND hwnd, ACCData* data)
if (!data->showingFlash)
return;
- if ((data->hContact != NULL || data->proto[0] != '\0')
- && ServiceExists(MS_FAVATAR_DESTROY))
+ if ((data->hContact != NULL || data->proto[0] != '\0') && ServiceExists(MS_FAVATAR_DESTROY))
{
FLASHAVATAR fa = {0};
fa.hContact = data->hContact;
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index ed662b5057..622a20cda9 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -261,25 +261,12 @@ static int ChangeAllProtoStatuses(unsigned statusMode, TCHAR *msg)
(g_wMask & OPT_ONLINEONLY) ? // check "Change only if current status is Online" option
((status == ID_STATUS_ONLINE) || (status == ID_STATUS_FREECHAT)) // process only "online" and "free for chat"
:
- ((status > ID_STATUS_OFFLINE) && (status < ID_STATUS_IDLE) && (status != ID_STATUS_INVISIBLE)) // process all existing statuses except for "invisible" & "offline"
- )
+ ((status > ID_STATUS_OFFLINE) && (status < ID_STATUS_IDLE) && (status != ID_STATUS_INVISIBLE))) // process all existing statuses except for "invisible" & "offline"
{
if (g_wMask & OPT_SETONLINEBACK){ // need to save old statuses & status messages
oldStatus[i] = status;
-
- char svc[256];
- mir_snprintf(svc, 256, "%s%s", proto[i]->szModuleName, PS_GETMYAWAYMSG);
- if (ServiceExists (svc))
- {
- if (ServiceExists (MS_AWAYMSG_GETSTATUSMSGT)) // if core can support unicode status message
- oldStatusMsg[i] = (TCHAR *)CallService (svc, 0, SGMA_TCHAR);
- else
- {
- char *tmp = (char *)CallService (svc, 0, 0);
- oldStatusMsg[i] = mir_a2t(tmp);
- mir_free(tmp);
- }
- }
+ if (ProtoServiceExists(proto[i]->szModuleName, PS_GETMYAWAYMSG))
+ oldStatusMsg[i] = (TCHAR*)CallProtoService(proto[i]->szModuleName, PS_GETMYAWAYMSG, 0, SGMA_TCHAR);
else
oldStatusMsg[i] = GetDefStatusMsg(status, proto[i]->szModuleName);
}
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp
index 34b32f470c..0ce1c3f5cd 100644
--- a/plugins/CSList/src/cslist.cpp
+++ b/plugins/CSList/src/cslist.cpp
@@ -100,12 +100,9 @@ static int OnCreateMenuItems(WPARAM, LPARAM)
PROTOACCOUNT** pdesc;
ProtoEnumAccounts(&protoCount, &pdesc);
- for (int i = 0; i < protoCount; i++) {
- char szService[100];
- mir_snprintf(szService, SIZEOF(szService), "%s%s", pdesc[i]->szModuleName, PS_SETCUSTOMSTATUSEX);
- if ( ServiceExists(szService))
+ for (int i = 0; i < protoCount; i++)
+ if ( ProtoServiceExists(pdesc[i]->szModuleName, PS_SETCUSTOMSTATUSEX))
addProtoStatusMenuItem(pdesc[i]->szModuleName);
- }
return 0;
}
@@ -189,9 +186,7 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName)
if (pdescr == NULL)
return;
- char szService[100];
- mir_snprintf(szService, SIZEOF(szService), "%s%s", szAccName, PS_SETCUSTOMSTATUSEX);
- if ( !ServiceExists(szService))
+ if ( !ProtoServiceExists(szAccName, PS_SETCUSTOMSTATUSEX))
return;
int statusToSet;
@@ -212,7 +207,7 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName)
else return;
ics.status = &statusToSet;
- CallService(szService, 0, (LPARAM)&ics);
+ CallProtoService(szAccName, PS_SETCUSTOMSTATUSEX, 0, (LPARAM)&ics);
}
INT_PTR showList(WPARAM wparam, LPARAM lparam, LPARAM param)
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp
index db2b694093..87fa738081 100644
--- a/plugins/Clist_modern/src/modern_clistmod.cpp
+++ b/plugins/Clist_modern/src/modern_clistmod.cpp
@@ -93,7 +93,6 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)
{
if (hContact && szProto) {
char *szActProto = (char*)szProto;
- char AdvancedService[255] = {0};
int nActStatus = nStatus;
HANDLE hActContact = hContact;
if ( !db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && g_szMetaModuleName && !mir_strcmp(szActProto,g_szMetaModuleName)) {
@@ -108,11 +107,10 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)
}
}
}
- mir_snprintf(AdvancedService,SIZEOF(AdvancedService),"%s%s",szActProto,"/GetAdvancedStatusIcon");
int result = -1;
- if ( ServiceExists(AdvancedService))
- result = CallService(AdvancedService,(WPARAM)hActContact, 0);
+ if ( ProtoServiceExists(szActProto, PS_GETADVANCEDSTATUSICON))
+ result = CallProtoService(szActProto, PS_GETADVANCEDSTATUSICON, (WPARAM)hActContact, 0);
if (result == -1 || !(LOWORD(result))) {
//Get normal Icon
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp
index a8eef4b790..b18c3c5008 100644
--- a/plugins/Clist_modern/src/modern_statusbar.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar.cpp
@@ -381,10 +381,8 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
if ((p.xStatusMode & 3)) {
if (p.ProtoStatus > ID_STATUS_OFFLINE) {
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, SIZEOF(str), "%s%s", p.AccountName, PS_GETCUSTOMSTATUSICON);
- if ( ServiceExists(str))
- p.extraIcon = (HICON)CallService(str, 0, 0);
+ if ( ProtoServiceExists(p.AccountName, PS_GETCUSTOMSTATUSICON))
+ p.extraIcon = (HICON)CallProtoService(p.AccountName, PS_GETCUSTOMSTATUSICON, 0, 0);
if (p.extraIcon && (p.xStatusMode & 3) == 3)
w += GetSystemMetrics(SM_CXSMICON)+1;
}
@@ -467,9 +465,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
if (p.showProtoIcon) {
if (p.ProtoStatus > ID_STATUS_OFFLINE && (p.xStatusMode & 3) > 0) {
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, SIZEOF(str), "%s%s", p.AccountName, PS_GETCUSTOMSTATUSICON);
- if ( ServiceExists(str)) {
+ if ( ProtoServiceExists(p.AccountName, PS_GETCUSTOMSTATUSICON)) {
hxIcon = p.extraIcon;
if (hxIcon) {
if ((p.xStatusMode & 3) == 2) {
diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp
index 53656dcf4b..19c9c139aa 100644
--- a/plugins/Clist_mw/src/clcitems.cpp
+++ b/plugins/Clist_mw/src/clcitems.cpp
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "commonheaders.h"
#include "clc.h"
#include "clist.h"
@@ -116,7 +117,6 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group
HANDLE hContact;
DBVARIANT dbv;
int i;
- char AdvancedService[255] = {0};
int img = -1;
int basicIcon = 0;
@@ -134,10 +134,8 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group
group->cl.items[i]->isSubcontact = 0;
group->cl.items[i]->subcontacts = NULL;
- _snprintf(AdvancedService,sizeof(AdvancedService),"%s%s",cacheEntry->szProto,"/GetAdvancedStatusIcon");
-
- if (ServiceExists(AdvancedService))
- img = CallService(AdvancedService,(WPARAM)hContact, 0);
+ if ( ProtoServiceExists(cacheEntry->szProto, PS_GETADVANCEDSTATUSICON))
+ img = CallProtoService(cacheEntry->szProto, PS_GETADVANCEDSTATUSICON, (WPARAM)hContact, 0);
if (img == -1 || !(LOWORD(img)))
img = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hContact,0);
diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp
index b6879662c7..1b3181d095 100644
--- a/plugins/Clist_mw/src/clistmod.cpp
+++ b/plugins/Clist_mw/src/clistmod.cpp
@@ -45,7 +45,6 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)
int result = -1;
if (hContact && szProto) {
char * szActProto = (char*)szProto;
- char AdvancedService[255] = {0};
int nActStatus = nStatus;
HANDLE hActContact = hContact;
if ( !db_get_b(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) {
@@ -61,10 +60,9 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)
}
}
}
- _snprintf(AdvancedService,sizeof(AdvancedService),"%s%s",szActProto,"/GetAdvancedStatusIcon");
- if (ServiceExists(AdvancedService))
- result = CallService(AdvancedService,(WPARAM)hActContact, 0);
+ if ( ProtoServiceExists(szActProto, PS_GETADVANCEDSTATUSICON))
+ result = CallProtoService(szActProto, PS_GETADVANCEDSTATUSICON, (WPARAM)hActContact, 0);
if (result == -1 || !(LOWORD(result)))
// result == -1 means no Advanced icon. LOWORD(result) == 0 happens when Advanced icon returned by ICQ (i.e. no transpot)
diff --git a/plugins/Clist_mw/src/commonheaders.h b/plugins/Clist_mw/src/commonheaders.h
index f20960a1cf..b26ebe94a9 100644
--- a/plugins/Clist_mw/src/commonheaders.h
+++ b/plugins/Clist_mw/src/commonheaders.h
@@ -47,6 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_icolib.h>
#include <m_cluiframes.h>
#include <m_fontservice.h>
+#include <m_xstatus.h>
#include <m_metacontacts.h>
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index ebb3a8c3d8..6bc3a2a65f 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -270,19 +270,15 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto)
int xStatus;
WPARAM xStatus2;
TCHAR xStatusName[128];
- char szServiceName[128];
- mir_snprintf(szServiceName, 128, "%s%s", szProto, PS_GETCUSTOMSTATUSEX);
-
- CUSTOM_STATUS cst = {0};
- cst.cbSize = sizeof(CUSTOM_STATUS);
+ CUSTOM_STATUS cst = { sizeof(cst) };
cst.flags = CSSF_MASK_STATUS;
cst.status = &xStatus;
- if (ServiceExists(szServiceName) && !CallService(szServiceName, (WPARAM)hContact, (LPARAM)&cst) && xStatus > 0) {
+ if (ProtoServiceExists(szProto, PS_GETCUSTOMSTATUSEX) && !CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, (WPARAM)hContact, (LPARAM)&cst) && xStatus > 0) {
cst.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_TCHAR;
cst.wParam = &xStatus2;
cst.ptszName = xStatusName;
- if ( !CallService(szServiceName, (WPARAM)hContact, (LPARAM)&cst)) {
+ if ( !CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, (WPARAM)hContact, (LPARAM)&cst)) {
TCHAR *szwXstatusName = TranslateTS(xStatusName);
p->statusMsg = (TCHAR *)realloc(p->statusMsg, (lstrlen(szwXstatusName) + 2) * sizeof(TCHAR));
_tcsncpy(p->statusMsg, szwXstatusName, lstrlen(szwXstatusName) + 1);
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index fe000c8e9d..2b346b8ccc 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -1384,11 +1384,9 @@ skipbg:
}
else if (item->dwFlags & BUTTON_ISPROTOSERVICE && cfg::clcdat) {
if (contactOK) {
- char szFinalService[512];
-
- mir_snprintf(szFinalService, 512, "%s/%s", GetContactProto(hContact), item->szService);
- if (ServiceExists(szFinalService))
- CallService(szFinalService, wwParam, llParam);
+ char *szProto = GetContactProto(hContact);
+ if (ProtoServiceExists(szProto, item->szService))
+ CallProtoService(szProto, item->szService, wwParam, llParam);
else
serviceFailure = TRUE;
}
@@ -1708,15 +1706,11 @@ buttons_done:
hIcon = Skin_GetIcon(szBuffer);
}
else if (cfg::dat.bShowXStatusOnSbar && status > ID_STATUS_OFFLINE) {
- CUSTOM_STATUS cst = {0};
- char szServiceName[128];
int xStatus;
-
- mir_snprintf(szServiceName, 128, "%s%s", pd->RealName, PS_GETCUSTOMSTATUSEX);
- cst.cbSize = sizeof(CUSTOM_STATUS);
+ CUSTOM_STATUS cst = { sizeof(cst) };
cst.flags = CSSF_MASK_STATUS;
cst.status = &xStatus;
- if (ServiceExists(szServiceName) && !CallService(szServiceName, 0, (LPARAM)&cst) && xStatus > 0)
+ if (ProtoServiceExists(pd->RealName, PS_GETCUSTOMSTATUSEX) && !CallProtoService(pd->RealName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cst) && xStatus > 0)
hIcon = (HICON)CallProtoService(pd->RealName, PS_GETCUSTOMSTATUSICON, 0, LR_SHARED); // get OWN xStatus icon (if set)
else
hIcon = LoadSkinnedProtoIcon(szProto, status);
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index b44e1de20d..6de02d77ee 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -783,15 +783,11 @@ void GetWindowsVersion(void)
void updateXstatusProto(PROTOCOL_INFO *protoInfo)
{
- unsigned int i;
- char szServiceName[MAXMODULELABELLENGTH];
- CUSTOM_STATUS xstatus={0};
-
- mir_snprintf(szServiceName, sizeof(szServiceName), "%s%s", protoInfo->szProto, PS_GETCUSTOMSTATUSEX);
- if (!ServiceExists(szServiceName)) return;
+ if (!ProtoServiceExists(protoInfo->szProto, PS_GETCUSTOMSTATUSEX))
+ return;
// Retrieve xstatus.count
- xstatus.cbSize = sizeof(CUSTOM_STATUS);
+ CUSTOM_STATUS xstatus = { sizeof(xstatus) };
xstatus.flags = CSSF_STATUSES_COUNT;
xstatus.wParam = &(protoInfo->xstatus.count);
CallProtoService(protoInfo->szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus);
@@ -802,9 +798,8 @@ void updateXstatusProto(PROTOCOL_INFO *protoInfo)
if (!protoInfo->xstatus.enabled)
protoInfo->xstatus.count = 0;
else
- for(i=0; i < protoInfo->xstatus.count; i++)
+ for(unsigned i=0; i < protoInfo->xstatus.count; i++)
protoInfo->xstatus.enabled[i] = FALSE;
-
}
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp
index 74bfbfbc7c..bcbb6dcd19 100755
--- a/plugins/MetaContacts/src/meta_services.cpp
+++ b/plugins/MetaContacts/src/meta_services.cpp
@@ -409,13 +409,11 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
// use the subcontact's protocol 'recv' service to add the meta's history (AIMOSCAR removes HTML here!) if possible
char *proto = GetContactProto(ccs->hContact);
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 |= (db_get_b(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
- if (ServiceExists(service) && !CallService(service, 0, (LPARAM)ccs))
+ if (ProtoServiceExists(proto, PSR_MESSAGE) && !CallProtoService(proto, PSR_MESSAGE, 0, (LPARAM)ccs))
added = TRUE;
ccs->hContact = hSub;
pre->flags = flags;
@@ -477,12 +475,9 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
// use the subcontact's protocol to add the db if possible (AIMOSCAR removes HTML here!)
HANDLE most_online = Meta_GetMostOnline(ccs->hContact);
char *proto = GetContactProto(most_online);
- if (proto) {
- char service[256];
- mir_snprintf(service, 256, "%s%s", proto, PSR_MESSAGE);
- if (CallService(service, wParam, lParam) != CALLSERVICE_NOTFOUND)
+ if (proto)
+ if (CallProtoService(proto, PSR_MESSAGE, wParam, lParam) != CALLSERVICE_NOTFOUND)
return 0;
- }
}
// otherwise, add event to db directly
@@ -842,13 +837,9 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam)
return 0;
char *proto = GetContactProto(most_online);
- if (proto) {
- char buff[512];
- strncpy(buff, proto, 512);
- strncpy(buff + strlen(proto), PSS_USERISTYPING, 512 - strlen(proto));
- if (ServiceExists(buff))
- CallService(buff, (WPARAM)most_online, (LPARAM)lParam);
- }
+ if (proto)
+ if ( ProtoServiceExists(proto, PSS_USERISTYPING))
+ CallProtoService(proto, PSS_USERISTYPING, (WPARAM)most_online, (LPARAM)lParam);
return 0;
}
@@ -1196,21 +1187,8 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam)
}
proto = GetContactProto(most_online);
- //Meta_CopyContactNick(ccs->hContact, most_online, proto);
-
- if (proto) {
- //ccs->hContact = most_online;
- //Meta_SetNick(proto);
-
- // don't check for existence of service - 'accounts' based protos don't have them!
- //_snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILE);
- //if (ServiceExists(szServiceName)) {
- // PUShowMessage("sending to subcontact", SM_NOTIFY);
+ if (proto)
return (int)(CallContactService(most_online, PSS_FILE, ccs->wParam, ccs->lParam));
- //} else
- // PUShowMessage("no service", SM_NOTIFY);
- } //else
- //PUShowMessage("no proto for subcontact", SM_NOTIFY);
}
return 0; // fail
}
@@ -1251,7 +1229,6 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam)
INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
PROTO_AVATAR_INFORMATIONT *AI = (PROTO_AVATAR_INFORMATIONT *) lParam;
- char *proto = 0;
DWORD default_contact_number;
if ((default_contact_number = db_get_dw(AI->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1)
@@ -1262,79 +1239,59 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
}
else
{
- HANDLE hSub, hMeta;
- char szServiceName[100];
- int result;
-
- hMeta = AI->hContact;
- hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS);
-
+ HANDLE hMeta = AI->hContact;
+ HANDLE hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS);
if ( !hSub)
return GAIR_NOAVATAR;
- proto = GetContactProto(hSub);
+ char *proto = GetContactProto(hSub);
if ( !proto) return GAIR_NOAVATAR;
AI->hContact = hSub;
- mir_snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PS_GETAVATARINFOT);
- result = CallService(szServiceName, wParam, lParam);
+ int result = CallProtoService(proto, PS_GETAVATARINFOT, wParam, lParam);
AI->hContact = hMeta;
if (result != CALLSERVICE_NOTFOUND) return result;
}
return GAIR_NOAVATAR; // fail
}
-INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) {
+INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam)
+{
CCSDATA *ccs = (CCSDATA*)lParam;
- char *proto = 0;
DWORD default_contact_number;
+ // This is a simple contact
+ // (this should normally not happen, since linked contacts do not appear on the list.)
if ((default_contact_number = db_get_dw(ccs->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1)
- {
- // This is a simple contact
- // (this should normally not happen, since linked contacts do not appear on the list.)
return 0;
- }
- else
- {
- HANDLE most_online;
- PROTO_AVATAR_INFORMATIONT AI;
- char szServiceName[100];
-
- most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS);
- if ( !most_online)
- return 0;
-
- proto = GetContactProto(most_online);
- if ( !proto) return 0;
-
- AI.cbSize = sizeof(AI);
- AI.hContact = ccs->hContact;
- AI.format = PA_FORMAT_UNKNOWN;
- _tcscpy(AI.filename, _T("X"));
- if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- db_set_ts(ccs->hContact, "ContactPhoto", "File",AI.filename);
+ HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS);
+ if ( !most_online)
+ return 0;
- most_online = Meta_GetMostOnline(ccs->hContact);
- Meta_CopyContactNick(ccs->hContact, most_online);
+ char *proto = GetContactProto(most_online);
+ if ( !proto) return 0;
- if ( !most_online)
- return 0;
+ PROTO_AVATAR_INFORMATIONT AI;
+ AI.cbSize = sizeof(AI);
+ AI.hContact = ccs->hContact;
+ AI.format = PA_FORMAT_UNKNOWN;
+ _tcscpy(AI.filename, _T("X"));
+ if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
+ db_set_ts(ccs->hContact, "ContactPhoto", "File",AI.filename);
- //Meta_CopyContactNick(ccs->hContact, most_online, proto);
+ most_online = Meta_GetMostOnline(ccs->hContact);
+ Meta_CopyContactNick(ccs->hContact, most_online);
- ccs->hContact = most_online;
- //Meta_SetNick(proto);
+ if ( !most_online)
+ return 0;
- _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_GETINFO);
- if (ServiceExists(szServiceName)) {
- strncpy(szServiceName, PSS_GETINFO, sizeof(szServiceName));
- return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam));
- }
- }
- return 0; // fail
+ ccs->hContact = most_online;
+ if ( !ProtoServiceExists(proto, PSS_GETINFO))
+ return 0; // fail
+
+ return CallContactService(ccs->hContact, PSS_GETINFO, ccs->wParam, ccs->lParam);
}
int Meta_OptInit(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp
index db5f9e9682..56d15dad88 100644
--- a/plugins/MetaContacts/src/meta_utils.cpp
+++ b/plugins/MetaContacts/src/meta_utils.cpp
@@ -105,11 +105,9 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id)
char *field;
DBVARIANT dbv;
DWORD i,res = 1;
+
// Get the field identifying the contact in the database.
- char str[MAXMODULELABELLENGTH];
- strcpy(str,protocol);
- strcat(str,PS_GETCAPS);
- if ( !ServiceExists(str))
+ if ( !ProtoServiceExists(protocol, PS_GETCAPS))
return NULL;
field = (char *)CallProtoService(protocol,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
diff --git a/plugins/ModernOpt/src/mopt_selector.cpp b/plugins/ModernOpt/src/mopt_selector.cpp
index 126622113a..73316f82a0 100644
--- a/plugins/ModernOpt/src/mopt_selector.cpp
+++ b/plugins/ModernOpt/src/mopt_selector.cpp
@@ -27,59 +27,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void sttApplySkin(MODERNOPTOBJECT *obj, TCHAR *fn)
{
- char svc[128];
- mir_snprintf(svc, SIZEOF(svc), "%s%s", obj->lpzThemeModuleName, TS_SKIN_APPLY);
- CallService(svc, NULL, (LPARAM)fn);
+ CallProtoService(obj->lpzThemeModuleName, TS_SKIN_APPLY, NULL, (LPARAM)fn);
}
static TCHAR *sttGetActiveSkin(MODERNOPTOBJECT *obj)
{
- char svc[128];
- mir_snprintf(svc, SIZEOF(svc), "%s%s", obj->lpzThemeModuleName, TS_SKIN_ACTIVE);
- return ServiceExists(svc) ? (TCHAR *)CallService(svc, 0, 0) : 0;
+ return ProtoServiceExists(obj->lpzThemeModuleName, TS_SKIN_ACTIVE) ?
+ (TCHAR*)CallProtoService(obj->lpzThemeModuleName, TS_SKIN_ACTIVE, 0, 0) : 0;
}
static void sttPreviewSkin(MODERNOPTOBJECT *obj, TCHAR *fn, LPDRAWITEMSTRUCT lps)
{
if (!fn) return;
- char svc[128];
- mir_snprintf(svc, SIZEOF(svc), "%s%s", obj->lpzThemeModuleName, TS_SKIN_PREVIEW);
- if (ServiceExists(svc))
- CallService(svc, (WPARAM)lps, (LPARAM)fn);
- else {
- char *afn = mir_t2a(fn);
- char *fnpreview = (char *)mir_alloc(lstrlenA(afn) + 10);
- lstrcpyA(fnpreview, afn);
- lstrcatA(fnpreview, ".png");
- HBITMAP hbmPreview = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)fnpreview);
- mir_free(afn);
- mir_free(fnpreview);
-
- if (!hbmPreview) return;
-
- BITMAP bmp;
- GetObject(hbmPreview, sizeof(bmp), &bmp);
-
- SIZE szDst = { abs(bmp.bmWidth), abs(bmp.bmHeight) };
- if ((szDst.cx > lps->rcItem.right-lps->rcItem.left) || (szDst.cy > lps->rcItem.bottom-lps->rcItem.top)) {
- float q = min(
- float(lps->rcItem.right-lps->rcItem.left) / szDst.cx,
- float(lps->rcItem.bottom-lps->rcItem.top) / szDst.cy);
- szDst.cx *= q;
- szDst.cy *= q;
- }
- POINT ptDst = {
- (lps->rcItem.left+lps->rcItem.right-szDst.cx) / 2,
- (lps->rcItem.top+lps->rcItem.bottom-szDst.cy) / 2 };
-
- HDC hdc = CreateCompatibleDC(lps->hDC);
- SelectObject(hdc, hbmPreview);
- SetStretchBltMode(hdc, HALFTONE);
- StretchBlt(lps->hDC, ptDst.x, ptDst.y, szDst.cx, szDst.cy, hdc, 0, 0, abs(bmp.bmWidth), abs(bmp.bmHeight), SRCCOPY);
- DeleteDC(hdc);
- DeleteObject(hbmPreview);
+ if ( ProtoServiceExists(obj->lpzThemeModuleName, TS_SKIN_PREVIEW)) {
+ CallProtoService(obj->lpzThemeModuleName, TS_SKIN_PREVIEW, (WPARAM)lps, (LPARAM)fn);
+ return;
+ }
+
+ char *afn = mir_t2a(fn);
+ char *fnpreview = (char *)mir_alloc(lstrlenA(afn) + 10);
+ lstrcpyA(fnpreview, afn);
+ lstrcatA(fnpreview, ".png");
+ HBITMAP hbmPreview = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)fnpreview);
+ mir_free(afn);
+ mir_free(fnpreview);
+
+ if (!hbmPreview) return;
+
+ BITMAP bmp;
+ GetObject(hbmPreview, sizeof(bmp), &bmp);
+
+ SIZE szDst = { abs(bmp.bmWidth), abs(bmp.bmHeight) };
+ if ((szDst.cx > lps->rcItem.right-lps->rcItem.left) || (szDst.cy > lps->rcItem.bottom-lps->rcItem.top)) {
+ float q = min(
+ float(lps->rcItem.right-lps->rcItem.left) / szDst.cx,
+ float(lps->rcItem.bottom-lps->rcItem.top) / szDst.cy);
+ szDst.cx *= q;
+ szDst.cy *= q;
}
+ POINT ptDst = {
+ (lps->rcItem.left+lps->rcItem.right-szDst.cx) / 2,
+ (lps->rcItem.top+lps->rcItem.bottom-szDst.cy) / 2 };
+
+ HDC hdc = CreateCompatibleDC(lps->hDC);
+ SelectObject(hdc, hbmPreview);
+ SetStretchBltMode(hdc, HALFTONE);
+ StretchBlt(lps->hDC, ptDst.x, ptDst.y, szDst.cx, szDst.cy, hdc, 0, 0, abs(bmp.bmWidth), abs(bmp.bmHeight), SRCCOPY);
+ DeleteDC(hdc);
+ DeleteObject(hbmPreview);
}
struct TSkinListItem
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 072b64a26e..9ea00ce899 100644
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -2286,13 +2286,8 @@ void InitCheck()
strcpy(cap.caps, "GPG AutoExchange");
for(int i = 0; i < count; i++)
- {
- char svc[64];
- strcpy(svc, accounts[i]->szProtoName);
- strcat(svc, PS_ICQ_ADDCAPABILITY);
- if(ServiceExists(svc))
- CallService(svc, 0, (LPARAM)&cap);
- }
+ if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY))
+ CallProtoService(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY, 0, (LPARAM)&cap);
}
if(bFileTransfers)
{
@@ -2306,13 +2301,8 @@ void InitCheck()
strcpy(cap.caps, "GPG FileTransfer");
for(int i = 0; i < count; i++)
- {
- char svc[64];
- strcpy(svc, accounts[i]->szProtoName);
- strcat(svc, PS_ICQ_ADDCAPABILITY);
- if(ServiceExists(svc))
- CallService(svc, 0, (LPARAM)&cap);
- }
+ if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY))
+ CallProtoService(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY, 0, (LPARAM)&cap);
}
}
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index 645d6a5435..0ec4cd1fea 100644
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -558,15 +558,10 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
char *proto = GetContactProto(ccs->hContact);
DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0);
if(uin) {
- char svc[64];
- strcpy(svc, proto);
- strcat(svc, PS_ICQ_CHECKCAPABILITY);
- if(ServiceExists(svc))
- {
+ if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) {
ICQ_CUSTOMCAP cap = {0};
strcpy(cap.caps, "GPG AutoExchange");
- if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap))
- {
+ if(CallProtoService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) {
CallContactService(ccs->hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)"-----PGP KEY REQUEST-----");
return 0;
}
@@ -823,89 +818,7 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l)
debuglog<<std::string(time_str()+": info: encrypted messge, let it go, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
return CallService(MS_PROTO_CHAINSEND, w, l);
}
- /*if(!isContactHaveKey(ccs->hContact))
- {
- if(bDebugLog)
- debuglog<<std::string(time_str()+": info: contact have not key, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
- if(bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && gpg_valid)
- {
- if(bDebugLog)
- debuglog<<std::string(time_str()+": info: checking for autoexchange possibility, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
- void send_encrypted_msgs_thread(HANDLE hContact);
- LPSTR proto = GetContactProto(ccs->hContact);
- DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0);
- if(uin)
- {
- if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange): protocol looks like icq, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
- char *proto = GetContactProto(ccs->hContact);
- char svc[64];
- strcpy(svc, proto);
- strcat(svc, PS_ICQ_CHECKCAPABILITY);
-
- if(ServiceExists(svc))
- {
- if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange, icq): checking for autoexchange icq capability, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
- ICQ_CUSTOMCAP cap = {0};
- strcpy(cap.caps, "GPG AutoExchange");
- if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap))
- {
- if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange, icq): sending key requiest, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
- CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)ccs->wParam, (LPARAM)"-----PGP KEY REQUEST-----");
- hcontact_data[ccs->hContact].msgs_to_send.push_back(msg);
- boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, ccs->hContact));
- mir_free(msg);
- return returnNoError(ccs->hContact);
- }
- }
- }
- else
- {
- TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", _T(""));
- if(jid[0])
- {
- if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange): protocol looks like jabber, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
- extern list <JabberAccount*> Accounts;
- list<JabberAccount*>::iterator end = Accounts.end();
- for(list<JabberAccount*>::iterator p = Accounts.begin(); p != end; p++)
- {
- TCHAR *caps = (*p)->getJabberInterface()->Net()->GetResourceFeatures(jid);
- if(caps)
- {
- wstring str;
- for(int i=0;;i++)
- {
- str.push_back(caps[i]);
- if(caps[i] == '\0')
- if(caps[i+1] == '\0')
- break;
- }
- mir_free(caps);
- if(str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos)
- {
- if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange, jabber): autoexchange capability found, sending key request, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
- CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)ccs->wParam, (LPARAM)"-----PGP KEY REQUEST-----");
- hcontact_data[ccs->hContact].msgs_to_send.push_back(msg);
- boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, ccs->hContact));
- mir_free(msg);
- return returnNoError(ccs->hContact);
- }
- }
- }
- }
- }
- }
- else
- {
- mir_free(msg);
- return CallService(MS_PROTO_CHAINSEND, w, l);
- }
- } */
- else if(bDebugLog)
+ if(bDebugLog)
debuglog<<std::string(time_str()+": info: contact have key, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
if(bDebugLog && metaIsProtoMetaContacts(ccs->hContact))
debuglog<<std::string(time_str()+": info: protocol is metacontacts, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
@@ -917,7 +830,6 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l)
return CallService(MS_PROTO_CHAINSEND, w, l);
}
mir_free(msg);
- //boost::thread *thr = new boost::thread(boost::bind(SendMsgSvc_func, ccs->hContact, msg, (DWORD)ccs->wParam));
return returnNoError(ccs->hContact);
}
@@ -964,19 +876,14 @@ int HookSendMsg(WPARAM w, LPARAM l)
{
if(bDebugLog)
debuglog<<std::string(time_str()+": info(autoexchange): protocol looks like icq, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)));
- char *proto = GetContactProto(hContact);
- char svc[64];
- strcpy(svc, proto);
- strcat(svc, PS_ICQ_CHECKCAPABILITY);
- if(ServiceExists(svc))
- {
+ char *proto = GetContactProto(hContact);
+ if(ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) {
if(bDebugLog)
debuglog<<std::string(time_str()+": info(autoexchange, icq): checking for autoexchange icq capability, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)));
ICQ_CUSTOMCAP cap = {0};
strcpy(cap.caps, "GPG AutoExchange");
- if(CallService(svc, (WPARAM)hContact, (LPARAM)&cap))
- {
+ if(CallProtoService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)hContact, (LPARAM)&cap)) {
if(bDebugLog)
debuglog<<std::string(time_str()+": info(autoexchange, icq): sending key requiest, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)));
CallContactService(hContact, PSS_MESSAGE, (dbei->flags & DBEF_UTF) ? PREF_UTF : 0, (LPARAM)"-----PGP KEY REQUEST-----");
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index b8274da3ec..ef34f756bc 100644
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -546,15 +546,11 @@ INT_PTR onSendFile(WPARAM w, LPARAM l)
bool cap_found = false, supported_proto = false;
if(uin)
{
- char svc[64];
- strcpy(svc, proto);
- strcat(svc, PS_ICQ_CHECKCAPABILITY);
- if(ServiceExists(svc))
- {
+ if(ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) {
supported_proto = true;
ICQ_CUSTOMCAP cap = {0};
strcpy(cap.caps, "GPG FileTransfer");
- if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap))
+ if(CallProtoService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap))
cap_found = true;
}
}
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index c2e7f034d4..70e4bf301e 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -271,11 +271,8 @@ static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam)
void HideNudgeButton(HANDLE hContact)
{
- char str[MAXMODULELABELLENGTH + 12] = {0};
char *szProto = GetContactProto(hContact);
- mir_snprintf(str,MAXMODULELABELLENGTH + 12,"%s/SendNudge", szProto);
-
- if (!ServiceExists(str)) {
+ if ( !ProtoServiceExists(szProto, "/SendNudge")) {
BBButton bbd = { sizeof(bbd) };
bbd.bbbFlags = BBSF_HIDDEN | BBSF_DISABLED;
bbd.pszModuleName="Nudge";
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp
index 41ed11239a..5e13f0b9b0 100644
--- a/plugins/Ping/src/pingthread.cpp
+++ b/plugins/Ping/src/pingthread.cpp
@@ -71,17 +71,14 @@ void SetProtoStatus(char *pszLabel, char *pszProto, int if_status, int new_statu
SetProtoStatus(pszLabel, pppDesc[i]->szModuleName, if_status, new_status);
}
} else {
- char get_status[512], set_status[512];
- mir_snprintf(get_status, 512, "%s%s", pszProto, PS_GETSTATUS);
- if(ServiceExists(get_status)) {
- mir_snprintf(set_status, 512, "%s%s", pszProto, PS_SETSTATUS);
- if(CallService(get_status, 0, 0) == if_status) {
+ if(ProtoServiceExists(pszProto, PS_GETSTATUS)) {
+ if(CallProtoService(pszProto, PS_GETSTATUS, 0, 0) == if_status) {
if(options.logging) {
char buf[1024];
mir_snprintf(buf, 1024, Translate("%s - setting status of protocol '%s' (%d)"), pszLabel, pszProto, new_status);
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
- CallService(set_status, new_status, 0);
+ CallProtoService(pszProto, PS_SETSTATUS, new_status, 0);
}
}
}
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp
index c7ec530e67..5597ec2a9b 100644
--- a/plugins/SMS/src/functions.cpp
+++ b/plugins/SMS/src/functions.cpp
@@ -535,7 +535,7 @@ LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM
//It called when SMS plugin loaded and upon change in the account list.
int RefreshAccountList(WPARAM eventCode,LPARAM lParam)
{
- SIZE_T dwAccCount=0,i,dwSMSAccountsCount=0;
+ int dwAccCount=0,dwSMSAccountsCount=0;
PROTOACCOUNT **ppaAccounts;
ProtoEnumAccounts((int*)&dwAccCount,&ppaAccounts);
@@ -543,22 +543,12 @@ int RefreshAccountList(WPARAM eventCode,LPARAM lParam)
FreeAccountList();
ssSMSSettings.ppaSMSAccounts=(PROTOACCOUNT**)MEMALLOC((dwAccCount*sizeof(LPVOID)));
if (ssSMSSettings.ppaSMSAccounts)
- {
- char szServiceName[MAX_PATH];
+ for (int i=0; i < dwAccCount; i++)
+ if ( IsAccountEnabled(ppaAccounts[i]))
+ if ( ProtoServiceExists(ppaAccounts[i]->szModuleName,MS_ICQ_SENDSMS))
+ ssSMSSettings.ppaSMSAccounts[dwSMSAccountsCount++] = ppaAccounts[i];
- for (i=0;i<dwAccCount;i++)
- {
- if (IsAccountEnabled(ppaAccounts[i]))
- {
- mir_snprintf(szServiceName,sizeof(szServiceName),"%s%s",ppaAccounts[i]->szModuleName,MS_ICQ_SENDSMS);
- if (ServiceExists(szServiceName))
- {
- ssSMSSettings.ppaSMSAccounts[dwSMSAccountsCount++]=ppaAccounts[i];
- }
- }
- }
- }
- ssSMSSettings.dwSMSAccountsCount=dwSMSAccountsCount;
+ ssSMSSettings.dwSMSAccountsCount = dwSMSAccountsCount;
SendSMSWindowsUpdateAllAccountLists();
return 0;
diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp
index 2b8baa84d2..ed40d645c6 100644
--- a/plugins/SMS/src/send.cpp
+++ b/plugins/SMS/src/send.cpp
@@ -51,7 +51,7 @@ void StartSmsSend(HWND hWndDlg,SIZE_T dwModuleIndex,LPWSTR lpwszPhone,SIZE_T dwP
pdbei=(DBEVENTINFO*)MEMALLOC((sizeof(DBEVENTINFO)+dwBuffSize));
if (pdbei)
{
- char szServiceName[MAX_PATH],szPhone[MAX_PHONE_LEN];
+ char szPhone[MAX_PHONE_LEN];
LPSTR lpszBuff=(LPSTR)(pdbei+1);
HANDLE hProcess;
@@ -65,15 +65,13 @@ void StartSmsSend(HWND hWndDlg,SIZE_T dwModuleIndex,LPWSTR lpwszPhone,SIZE_T dwP
pdbei->pBlob=(PBYTE)lpszBuff;
SendSMSWindowDbeiSet(hWndDlg,pdbei);
- mir_snprintf(szServiceName,sizeof(szServiceName),"%s%s",ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName,MS_ICQ_SENDSMS);
- if (ServiceExists(szServiceName))
- {
+ char *szProto = ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName;
+ if (ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) {
WideCharToMultiByte(CP_UTF8,0,lpwszMessageXMLEncoded,dwMessageXMLEncodedSize,lpszMessageUTF,dwMessageUTFBuffSize,NULL,NULL);
- hProcess=(HANDLE)CallService(szServiceName,(WPARAM)szPhone,(LPARAM)lpszMessageUTF);
+ hProcess = (HANDLE)CallProtoService(szProto, MS_ICQ_SENDSMS, (WPARAM)szPhone,(LPARAM)lpszMessageUTF);
SendSMSWindowHProcessSet(hWndDlg,hProcess);
- }else{
- MEMFREE(pdbei);
}
+ else MEMFREE(pdbei);
}
MEMFREE(lpszMessageUTF);
}
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 46dd792806..9baf53f490 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -814,10 +814,8 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
// /GetChatToolTipText
// wParam = roomID parentdat->ptszID
// lParam = userID ui1->pszUID
- char serviceName[256];
- _snprintf(serviceName,SIZEOF(serviceName), "%s"MS_GC_PROTO_GETTOOLTIPTEXT, parentdat->pszModule);
- if (ServiceExists(serviceName))
- ti.lpszText=(TCHAR*)CallService(serviceName, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
+ if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT))
+ ti.lpszText=(TCHAR*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
else {
TCHAR ptszBuf[ 1024 ];
mir_sntprintf( ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 7148f0cf84..95e0359ef7 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1450,10 +1450,8 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui1) {
- char serviceName[256];
- _snprintf(serviceName, SIZEOF(serviceName), "%s"MS_GC_PROTO_GETTOOLTIPTEXT, parentdat->pszModule);
- if (ServiceExists(serviceName))
- ti.lpszText = (TCHAR*)CallService(serviceName, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
+ if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT))
+ ti.lpszText = (TCHAR*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
else {
TCHAR ptszBuf[ 1024 ];
mir_sntprintf( ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
@@ -1844,15 +1842,14 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui1) {
ti.cbSize = sizeof(ti);
- mir_snprintf(serviceName, SIZEOF(serviceName), "%s"MS_GC_PROTO_GETTOOLTIPTEXT, parentdat->pszModule);
- if (ServiceExists(serviceName))
- mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s"), (TCHAR*)CallService(serviceName, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID));
+ if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT))
+ _tcsncpy(ptszBuf, (TCHAR*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID), SIZEOF(ptszBuf));
else
mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
- TranslateT("Nick"), ui1->pszNick,
- TranslateT("Unique id"), ui1->pszUID,
- TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui1->Status));
+ TranslateT("Nick"), ui1->pszNick,
+ TranslateT("Unique id"), ui1->pszUID,
+ TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui1->Status));
if (ptszBuf != NULL)
if (CallService("mToolTip/ShowTipW", (WPARAM)mir_tstrdup(ptszBuf), (LPARAM)&ti))
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 14bab6df9a..b249b635d8 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -458,10 +458,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer,
CheckMenuItem(submenu, ID_SENDMENU_SENDWITHOUTTIMEOUTS, MF_BYCOMMAND | (dat->sendMode & SMODE_NOACK ? MF_CHECKED : MF_UNCHECKED));
{
const char *szFinalProto = dat->cache->getActiveProto();
- char szServiceName[128];
-
- mir_snprintf(szServiceName, 128, "%s/SendNudge", szFinalProto);
- EnableMenuItem(submenu, ID_SENDMENU_SENDNUDGE, MF_BYCOMMAND | ((ServiceExists(szServiceName) && ServiceExists(MS_NUDGE_SEND)) ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(submenu, ID_SENDMENU_SENDNUDGE, MF_BYCOMMAND | ((ProtoServiceExists(szFinalProto, "/SendNudge") && ServiceExists(MS_NUDGE_SEND)) ? MF_ENABLED : MF_GRAYED));
}
if (lParam)
iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 9f5385688b..4ed5023499 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -2145,9 +2145,7 @@ HICON TSAPI GetXStatusIcon(const TWindowData *dat)
if (xStatus == 0)
return NULL;
- char szServiceName[128];
- mir_snprintf(szServiceName, 128, "%s%s", dat->cache->getActiveProto(), PS_GETCUSTOMSTATUSICON);
- if ( !ServiceExists(szServiceName))
+ if ( !ProtoServiceExists(dat->cache->getActiveProto(), PS_GETCUSTOMSTATUSICON))
return NULL;
return (HICON)(CallProtoService(dat->cache->getActiveProto(), PS_GETCUSTOMSTATUSICON, xStatus, 0));
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index e495a1482d..7abac1cf6a 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -1690,14 +1690,12 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{
ResetUpdateInfo(pPs);
- mir_snprintf(pPs->szUpdating, SIZEOF(pPs->szUpdating),
- "%s (%s)", Translate("Updating"), pPs->pszProto);
+ mir_snprintf(pPs->szUpdating, SIZEOF(pPs->szUpdating), "%s (%s)", Translate("Updating"), pPs->pszProto);
// need meta contact's subcontact information
if (DB::Module::IsMetaAndScan(pPs->pszProto))
{
HANDLE hSubContact;
- CHAR szService[MAXSETTING];
int i, numSubs;
numSubs = DB::MetaContact::SubCount(pPs->hContact);
@@ -1708,10 +1706,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
hSubContact = DB::MetaContact::Sub(pPs->hContact, i);
if (hSubContact != NULL)
{
- mir_snprintf(szService, SIZEOF(szService), "%s%s",
- DB::Contact::Proto(hSubContact), PSS_GETINFO);
-
- if (ServiceExists(szService))
+ if ( ProtoServiceExists(DB::Contact::Proto(hSubContact), PSS_GETINFO))
{
pPs->infosUpdated = (TAckInfo*)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo) * (pPs->nSubContacts + 1));
pPs->infosUpdated[pPs->nSubContacts].hContact = hSubContact;
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp
index 8fbe741255..1e5b7648f5 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -518,7 +518,7 @@ void CYahooProto::LoadYahooServices( void )
YHookEvent( ME_OPT_INITIALISE, &CYahooProto::OnOptionsInit );
//----| Create nudge event |----------------------------------------------------------
- mir_snprintf( path, sizeof( path ), "%s/Nudge", m_szModuleName);
+ mir_snprintf( path, SIZEOF(path), "%s/Nudge", m_szModuleName);
hYahooNudge = CreateHookableEvent( path );
//----| Service creation |------------------------------------------------------------
@@ -536,27 +536,27 @@ void CYahooProto::LoadYahooServices( void )
//----| Set resident variables |------------------------------------------------------
- mir_snprintf( path, sizeof( path ), "%s/Status", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/Status", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
- mir_snprintf( path, sizeof( path ), "%s/YStatus", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/YStatus", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
- mir_snprintf( path, sizeof( path ), "%s/YAway", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/YAway", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
- mir_snprintf( path, sizeof( path ), "%s/Mobile", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/Mobile", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
- mir_snprintf( path, sizeof( path ), "%s/YGMsg", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/YGMsg", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
- mir_snprintf( path, sizeof( path ), "%s/IdleTS", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/IdleTS", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
- mir_snprintf( path, sizeof( path ), "%s/PictLastCheck", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/PictLastCheck", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
- mir_snprintf( path, sizeof( path ), "%s/PictLoading", m_szModuleName );
+ mir_snprintf( path, SIZEOF(path), "%s/PictLoading", m_szModuleName );
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path );
}
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp
index c7a58737a1..2176935027 100644
--- a/src/modules/clist/clistevents.cpp
+++ b/src/modules/clist/clistevents.cpp
@@ -347,7 +347,6 @@ int fnEventsProcessTrayDoubleClick(int index)
cli.pfnUnlockTray();
hContact = cli.events.items[eventIndex]->cle.hContact;
hDbEvent = cli.events.items[eventIndex]->cle.hDbEvent;
- //if ( !ServiceExists(cli.events.items[eventIndex]->cle.pszService))
// ; may be better to show send msg?
CallService(cli.events.items[eventIndex]->cle.pszService, (WPARAM) NULL, (LPARAM) & cli.events.items[eventIndex]->cle);
cli.pfnRemoveEvent(hContact, hDbEvent);
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp
index 72f78988c3..5cfd87c053 100644
--- a/src/modules/protocols/protoaccs.cpp
+++ b/src/modules/protocols/protoaccs.cpp
@@ -461,27 +461,17 @@ BOOL ActivateAccount(PROTOACCOUNT* pa)
CreateProtoServiceEx(pa->szModuleName, PS_GETNAME, (MIRANDASERVICEOBJ)stub41, pa->ppro);
CreateProtoServiceEx(pa->szModuleName, PS_GETSTATUS, (MIRANDASERVICEOBJ)stub42, pa->ppro);
- char szServiceName[ 200 ];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFO);
- if ( !ServiceExists(szServiceName)) {
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFOW);
- if (ServiceExists(szServiceName))
+ if ( !ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFO))
+ if ( ProtoServiceExists(pa->szModuleName, PS_GETAVATARINFOW))
CreateProtoServiceEx(pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro);
- }
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATAR);
- if ( !ServiceExists(szServiceName)) {
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATARW);
- if (ServiceExists(szServiceName))
+ if ( !ProtoServiceExists(pa->szModuleName, PS_GETMYAVATAR))
+ if ( ProtoServiceExists(pa->szModuleName, PS_GETMYAVATARW))
CreateProtoServiceEx(pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro);
- }
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATAR);
- if ( !ServiceExists(szServiceName)) {
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATARW);
- if (ServiceExists(szServiceName))
+ if ( !ProtoServiceExists(pa->szModuleName, PS_SETMYAVATAR))
+ if ( ProtoServiceExists(pa->szModuleName, PS_SETMYAVATARW))
CreateProtoServiceEx(pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro);
- }
return TRUE;
}
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp
index b3c9c21065..0f970907b9 100644
--- a/src/modules/protocols/protoopts.cpp
+++ b/src/modules/protocols/protoopts.cpp
@@ -404,7 +404,6 @@ static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat)
int curSel = ListBox_GetCurSel(hwndList);
if (curSel != LB_ERR) {
HWND hwnd;
- char svc[MAXMODULELABELLENGTH];
PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, curSel);
if (pa) {
@@ -428,6 +427,7 @@ static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat)
SetWindowText( GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT("Account is disabled. Please activate it to access options."));
}
else {
+ char svc[MAXMODULELABELLENGTH];
mir_snprintf(svc, SIZEOF(svc), "%s%s", pa->szModuleName, PS_CREATEACCMGRUI);
hwnd = (HWND)CallService(svc, 0, (LPARAM)hwndDlg);
if (hwnd && (hwnd != (HWND)CALLSERVICE_NOTFOUND)) {