diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-18 14:12:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-18 14:12:13 +0000 |
commit | 81337e86426dd4a79836554342bdc2e7e6195769 (patch) | |
tree | 4854edef6130b994f3611eb1a035b5de8b37f5cc /plugins/SMS | |
parent | 4f14e4f86d5855d75c0941f9b8495e5a2e522087 (diff) |
massive extinction of stupid service name's buffers
git-svn-id: http://svn.miranda-ng.org/main/trunk@5010 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SMS')
-rw-r--r-- | plugins/SMS/src/functions.cpp | 22 | ||||
-rw-r--r-- | plugins/SMS/src/send.cpp | 12 |
2 files changed, 11 insertions, 23 deletions
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);
}
|