From 81337e86426dd4a79836554342bdc2e7e6195769 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Tue, 18 Jun 2013 14:12:13 +0000
Subject: massive extinction of stupid service name's buffers

git-svn-id: http://svn.miranda-ng.org/main/trunk@5010 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 src/modules/clist/clistevents.cpp   |  1 -
 src/modules/protocols/protoaccs.cpp | 22 ++++++----------------
 src/modules/protocols/protoopts.cpp |  2 +-
 3 files changed, 7 insertions(+), 18 deletions(-)

(limited to 'src')

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)) {
-- 
cgit v1.2.3