summaryrefslogtreecommitdiff
path: root/plugins/SMS/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SMS/src')
-rw-r--r--plugins/SMS/src/SMS_svc.cpp116
-rw-r--r--plugins/SMS/src/common.h1
-rw-r--r--plugins/SMS/src/functions.cpp21
-rw-r--r--plugins/SMS/src/receive.cpp116
-rw-r--r--plugins/SMS/src/senddlg.cpp42
5 files changed, 117 insertions, 179 deletions
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp
index cf86f77220..4a60c271fd 100644
--- a/plugins/SMS/src/SMS_svc.cpp
+++ b/plugins/SMS/src/SMS_svc.cpp
@@ -112,24 +112,20 @@ int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam)
{// user clicked on the "SMS Message" on one of the users
hwndSendSms=SendSMSWindowIsOtherInstanceHContact((HANDLE)wParam);
if (hwndSendSms)
- {
SetFocus(hwndSendSms);
- }else{
+ else
hwndSendSms=SendSMSWindowAdd((HANDLE)wParam);
- }
- }else{// user clicked on the "SMS Send" in the Main Menu
+ }
+ else{// user clicked on the "SMS Send" in the Main Menu
hwndSendSms=SendSMSWindowAdd(NULL);
EnableWindow(GetDlgItem(hwndSendSms,IDC_NAME),TRUE);
EnableWindow(GetDlgItem(hwndSendSms,IDC_SAVENUMBER),FALSE);
- for(HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
- {
- if (GetContactPhonesCount(hContact))
- {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
+ if (GetContactPhonesCount(hContact)) {
SEND_DLG_ITEM_MESSAGEW(hwndSendSms,IDC_NAME,CB_ADDSTRING,0,(LPARAM)GetContactNameW(hContact));
SendSMSWindowSMSContactAdd(hwndSendSms,hContact);
}
- }
}
return 0;
}
@@ -138,88 +134,64 @@ int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam)
//This function used to popup a read SMS window after the user clicked on the received SMS message.
int ReadMsgSMS(WPARAM wParam,LPARAM lParam)
{
- int iRet=1;
- DBEVENTINFO dbei={0};
-
- dbei.cbSize=sizeof(dbei);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,0))!=-1)
- {
- dbei.pBlob=(PBYTE)MEMALLOC(dbei.cbBlob);
- if (dbei.pBlob)
- {
- if (CallService(MS_DB_EVENT_GET,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,(LPARAM)&dbei)==0)
- if (dbei.eventType==ICQEVENTTYPE_SMS || dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)
- if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
- {
- if (RecvSMSWindowAdd(((CLISTEVENT*)lParam)->hContact,ICQEVENTTYPE_SMS,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
- {
- CallService(MS_DB_EVENT_MARKREAD,(WPARAM)((CLISTEVENT*)lParam)->hContact,(LPARAM)((CLISTEVENT*)lParam)->hDbEvent);
- iRet=0;
- }
+ CLISTEVENT *cle = (CLISTEVENT*)lParam;
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(((CLISTEVENT*)lParam)->hDbEvent)) != -1) {
+ dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
+
+ if (db_event_get(cle->hDbEvent, &dbei) == 0)
+ if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION)
+ if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) {
+ if (RecvSMSWindowAdd(cle->hContact,ICQEVENTTYPE_SMS,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob)) {
+ db_event_markRead(cle->hContact, cle->hDbEvent);
+ return 0;
}
- MEMFREE(dbei.pBlob);
}
}
-return(iRet);
+ return 1;
}
//This function used to popup a read SMS window after the user clicked on the received SMS confirmation.
int ReadAckSMS(WPARAM wParam,LPARAM lParam)
{
- int iRet=1;
- DBEVENTINFO dbei={0};
-
- dbei.cbSize=sizeof(dbei);
- CLISTEVENT *cle = ((CLISTEVENT*)lParam);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)cle->hDbEvent,0))!=-1)
- {
- dbei.pBlob=(PBYTE)MEMALLOC(dbei.cbBlob);
- if (dbei.pBlob)
- {
- if (CallService(MS_DB_EVENT_GET,(WPARAM)cle->hDbEvent,(LPARAM)&dbei)==0)
- if (dbei.eventType==ICQEVENTTYPE_SMS || dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)
- if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
- {
- if (RecvSMSWindowAdd(cle->hContact,ICQEVENTTYPE_SMSCONFIRMATION,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
- {
- CallService(MS_DB_EVENT_DELETE,(WPARAM)cle->hContact,(LPARAM)cle->hDbEvent);
- iRet=0;
- }
+ CLISTEVENT *cle = (CLISTEVENT*)lParam;
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(cle->hDbEvent)) != -1) {
+ dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
+
+ if (db_event_get(cle->hDbEvent, &dbei) == 0)
+ if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION)
+ if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) {
+ if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMSCONFIRMATION, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) {
+ db_event_delete(cle->hContact, cle->hDbEvent);
+ return 0;
}
- MEMFREE(dbei.pBlob);
}
}
-return(iRet);
+ return 1;
}
void RestoreUnreadMessageAlerts(void)
{
- DBEVENTINFO dbei={0};
- HANDLE hDbEvent,hContact;
+ DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.cbSize=sizeof(dbei);
- for(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
- for(hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);hDbEvent!=NULL;hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0))
- {
- dbei.cbBlob=0;
- if (CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei)==0)
- if ((dbei.flags&(DBEF_SENT|DBEF_READ))==0 && ((dbei.eventType==ICQEVENTTYPE_SMS) || (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)))
- if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
- {
- handleNewMessage((WPARAM)hContact,(LPARAM)hDbEvent);
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
+ for (HANDLE hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hDbEvent)) {
+ dbei.cbBlob=0;
+ if (db_event_get(hDbEvent, &dbei) == 0)
+ if ((dbei.flags & (DBEF_SENT|DBEF_READ))==0 && ((dbei.eventType==ICQEVENTTYPE_SMS) || (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)))
+ if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
+ handleNewMessage((WPARAM)hContact,(LPARAM)hDbEvent);
}
- }
- hContact=NULL;
- for(hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);hDbEvent!=NULL;hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0))
- {
+ for (HANDLE hDbEvent = db_event_firstUnread(NULL); hDbEvent; hDbEvent = db_event_next(hDbEvent)) {
dbei.cbBlob=0;
- if (CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei)==0)
- if ((dbei.flags&(DBEF_SENT|DBEF_READ))==0 && ((dbei.eventType==ICQEVENTTYPE_SMS) || (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)))
- if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
- {
- handleNewMessage((WPARAM)hContact,(LPARAM)hDbEvent);
- }
+ if (db_event_get(hDbEvent, &dbei) == 0)
+ if ((dbei.flags & (DBEF_SENT|DBEF_READ))==0 && ((dbei.eventType==ICQEVENTTYPE_SMS) || (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)))
+ if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN)
+ handleNewMessage(NULL, (LPARAM)hDbEvent);
}
}
diff --git a/plugins/SMS/src/common.h b/plugins/SMS/src/common.h
index 495aa6a7ae..14e04c614d 100644
--- a/plugins/SMS/src/common.h
+++ b/plugins/SMS/src/common.h
@@ -11,6 +11,7 @@
#include <windows.h>
#include <commctrl.h>
+#include <malloc.h>
#include <time.h>
#include <newpluginapi.h>
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp
index 157b85d78f..0bdb9ce46e 100644
--- a/plugins/SMS/src/functions.cpp
+++ b/plugins/SMS/src/functions.cpp
@@ -66,16 +66,15 @@ LPSTR GetModuleName(HANDLE hContact)
{
LPSTR lpszRet;
- if (hContact)
- {
- lpszRet=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (lpszRet==NULL) lpszRet=PROTOCOL_NAMEA;
- }else{
- lpszRet=PROTOCOL_NAMEA;
+ if (hContact) {
+ lpszRet = GetContactProto(hContact);
+ if (lpszRet == NULL)
+ lpszRet = PROTOCOL_NAMEA;
}
-return(lpszRet);
-}
+ else lpszRet = PROTOCOL_NAMEA;
+ return lpszRet;
+}
void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled)
{
@@ -211,11 +210,9 @@ BOOL IsContactPhone(HANDLE hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize)
{
BOOL bRet=FALSE;
WCHAR wszPhoneLocal[MAX_PHONE_LEN];
- LPSTR lpszProto;
- SIZE_T dwPhoneSizeLocal;
- dwPhoneSizeLocal=CopyNumberW(wszPhoneLocal,lpwszPhone,dwPhoneSize);
- lpszProto=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ SIZE_T dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal,lpwszPhone,dwPhoneSize);
+ LPSTR lpszProto = GetContactProto(hContact);
if (lpszProto) {
if (bRet==FALSE) bRet=IsContactPhoneParam(hContact,lpszProto,"Phone",wszPhoneLocal,dwPhoneSizeLocal);
if (bRet==FALSE) bRet=IsContactPhoneParam(hContact,lpszProto,"Cellular",wszPhoneLocal,dwPhoneSizeLocal);
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp
index b201f82db9..5e167739d0 100644
--- a/plugins/SMS/src/receive.cpp
+++ b/plugins/SMS/src/receive.cpp
@@ -47,7 +47,7 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam)
LPWSTR lpwszMessageXMLEncoded,lpwszMessageXMLDecoded;
SIZE_T dwBuffLen,dwMessageXMLEncodedSize,dwMessageXMLDecodedSize;
HANDLE hContact;
- DBEVENTINFO dbei={0};
+ DBEVENTINFO dbei = { sizeof(dbei) };
dwBuffLen=(dwDataSize+MAX_PATH);
dbei.pBlob=(LPBYTE)MEMALLOC((dwBuffLen+dwPhoneSize));
@@ -64,7 +64,6 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam)
dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,wszPhone,MAX_PHONE_LEN);
hContact=HContactFromPhone(wszPhone,dwPhoneSize);
- dbei.cbSize=sizeof(dbei);
dbei.szModule=GetModuleName(hContact);
dbei.timestamp=time(NULL);
dbei.flags=(DBEF_UTF);
@@ -72,12 +71,10 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam)
dbei.cbBlob=(mir_snprintf((LPSTR)dbei.pBlob,((dwBuffLen+dwPhoneSize)),"SMS From: +%s\r\n%s",szPhone,lpszMessageUTF)+sizeof(DWORD));
//dbei.pBlob=(LPBYTE)lpszBuff;
(*((DWORD*)(dbei.pBlob+(dbei.cbBlob-sizeof(DWORD)))))=0;
- CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
- if (hContact==NULL)
- {
- if (RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMS,wszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob))
- {
- CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)&dbei);
+ HANDLE hResult = db_event_add(hContact, &dbei);
+ if (hContact==NULL) {
+ if ( RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMS,wszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob)) {
+ db_event_markRead(hContact, hResult);
SkinPlaySound("RecvSMSMsg");
}
}
@@ -124,14 +121,12 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam)
}
}
- if (dbei.pBlob)
- {
+ if (dbei.pBlob) {
if (hContact)
- {
- CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
- }else{
+ db_event_add(hContact, &dbei);
+ else
RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMSCONFIRMATION,wszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob);
- }
+
MEMFREE(dbei.pBlob);
}
}
@@ -217,75 +212,62 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam)
}
//Handles new SMS messages added to the database
-int handleNewMessage(WPARAM wParam,LPARAM lParam)
+int handleNewMessage(WPARAM wParam, LPARAM lParam)
{
- CHAR szServiceFunction[MAX_PATH],*pszServiceFunctionName;
+ CHAR szServiceFunction[MAX_PATH], *pszServiceFunctionName;
WCHAR szToolTip[MAX_PATH];
- HANDLE hContact=(HANDLE)wParam,hDbEvent=(HANDLE)lParam;
- CLISTEVENT cle={0};
- DBEVENTINFO dbei={0};
+ HANDLE hContact = (HANDLE)wParam, hDbEvent = (HANDLE)lParam;
- dbei.cbSize=sizeof(dbei);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,lParam,0))!=-1)
- {
- dbei.pBlob=(PBYTE)MEMALLOC(dbei.cbBlob);
- if (dbei.pBlob)
- {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) != -1) {
+ dbei.pBlob = (PBYTE)MEMALLOC(dbei.cbBlob);
+ if (dbei.pBlob) {
CopyMemory(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE);
- pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
+ pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN;
- if (CallService(MS_DB_EVENT_GET,lParam,(LPARAM)&dbei)==0)
- if ((dbei.flags&DBEF_SENT)==0)
- if (dbei.eventType==ICQEVENTTYPE_SMS)
- {
- if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
- {
+ if (db_event_get(hDbEvent, &dbei) == 0)
+ if ((dbei.flags & DBEF_SENT) == 0)
+ if (dbei.eventType == ICQEVENTTYPE_SMS) {
+ if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN) {
SkinPlaySound("RecvSMSMsg");
- if (DB_SMS_GetByte(NULL,"AutoPopup",0))
- {
+ if (DB_SMS_GetByte(NULL,"AutoPopup",0)) {
if (RecvSMSWindowAdd(hContact,ICQEVENTTYPE_SMS,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
- {
- CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)&dbei);
- }
- }else{
+ db_event_markRead(hContact, hDbEvent);
+ }
+ else {
CopyMemory(pszServiceFunctionName,SMS_READ,sizeof(SMS_READ));
-
- cle.cbSize=sizeof(cle);
- cle.flags=CLEF_TCHAR;
- cle.hContact=hContact;
- cle.hDbEvent=hDbEvent;
- cle.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS);
- cle.pszService=szServiceFunction;
mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Message from %s"),GetContactNameW(hContact));
- cle.ptszTooltip=szToolTip;
+
+ CLISTEVENT cle = { sizeof(cle) };
+ cle.flags = CLEF_TCHAR;
+ cle.hContact = hContact;
+ cle.hDbEvent = hDbEvent;
+ cle.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS);
+ cle.pszService = szServiceFunction;
+ cle.ptszTooltip = szToolTip;
CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle);
}
}
- }else
- if (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)
- {
+ }
+ else if (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) {
SkinPlaySound("RecvSMSConfirmation");
- if (DB_SMS_GetByte(NULL,"AutoPopup",0))
- {
+ if (DB_SMS_GetByte(NULL, "AutoPopup", 0)) {
if (RecvSMSWindowAdd(hContact,ICQEVENTTYPE_SMSCONFIRMATION,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
- {
- CallService(MS_DB_EVENT_DELETE,(WPARAM)hContact,(LPARAM)&dbei);
- }
- }else{
+ db_event_delete(hContact, &dbei);
+ }
+ else {
UINT iIcon;
-
- if (GetDataFromMessage((LPSTR)dbei.pBlob,dbei.cbBlob,NULL,NULL,0,NULL,&iIcon))
- {
+ if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, NULL, NULL, 0, NULL, &iIcon)) {
CopyMemory(pszServiceFunctionName,SMS_READ_ACK,sizeof(SMS_READ_ACK));
-
- cle.cbSize=sizeof(cle);
- cle.flags=CLEF_TCHAR;
- cle.hContact=hContact;
- cle.hDbEvent=hDbEvent;
- cle.hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED);
- cle.pszService=szServiceFunction;
mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Confirmation from %s"),GetContactNameW(hContact));
- cle.ptszTooltip=szToolTip;
+
+ CLISTEVENT cle = { sizeof(cle) };
+ cle.flags = CLEF_TCHAR;
+ cle.hContact = hContact;
+ cle.hDbEvent = hDbEvent;
+ cle.hIcon = (HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED);
+ cle.pszService = szServiceFunction;
+ cle.ptszTooltip = szToolTip;
CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle);
}
}
@@ -295,5 +277,3 @@ int handleNewMessage(WPARAM wParam,LPARAM lParam)
}
return 0;
}
-
-
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp
index e4a0361ac2..965e7fcb6e 100644
--- a/plugins/SMS/src/senddlg.cpp
+++ b/plugins/SMS/src/senddlg.cpp
@@ -748,13 +748,10 @@ void SendSMSWindowDbeiSet(HWND hWndDlg,DBEVENTINFO *pdbei)
void SendSMSWindowDBAdd(HWND hWndDlg)
{
SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
-
- if (psswdWindowData)
- {
- psswdWindowData->pdbei->cbSize=sizeof(DBEVENTINFO);
- psswdWindowData->pdbei->szModule=GetModuleName(psswdWindowData->hContact);
-
- CallService(MS_DB_EVENT_ADD,(WPARAM)psswdWindowData->hContact,(LPARAM)psswdWindowData->pdbei);
+ if (psswdWindowData) {
+ psswdWindowData->pdbei->cbSize = sizeof(DBEVENTINFO);
+ psswdWindowData->pdbei->szModule = GetModuleName(psswdWindowData->hContact);
+ db_event_add(psswdWindowData->hContact, psswdWindowData->pdbei);
MEMFREE(psswdWindowData->pdbei);
}
}
@@ -763,7 +760,8 @@ void SendSMSWindowDBAdd(HWND hWndDlg)
void SendSMSWindowHItemSendSet(HWND hWndDlg,HTREEITEM hItemSend)
{
SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
- if (psswdWindowData) psswdWindowData->hItemSend=hItemSend;
+ if (psswdWindowData)
+ psswdWindowData->hItemSend=hItemSend;
}
//
@@ -773,7 +771,7 @@ HTREEITEM SendSMSWindowHItemSendGet(HWND hWndDlg)
SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
if (psswdWindowData) hRet=psswdWindowData->hItemSend;
-return(hRet);
+ return hRet;
}
//
@@ -1017,15 +1015,11 @@ void AddContactPhonesToComboToListParam(HANDLE hContact,LPSTR lpszModule,LPSTR l
void AddContactPhonesToCombo(HWND hWnd,HANDLE hContact)
{
- HWND hWndList;
- LPSTR lpszProto;
-
- hWndList=GetDlgItem(hWnd,IDC_ADDRESS);
+ HWND hWndList = GetDlgItem(hWnd,IDC_ADDRESS);
SEND_DLG_ITEM_MESSAGE(hWnd,IDC_ADDRESS,CB_RESETCONTENT,0,0);
- lpszProto=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (lpszProto)
- {
+ LPSTR lpszProto = GetContactProto(hContact);
+ if (lpszProto) {
AddContactPhonesToComboToListParam(hContact,lpszProto,"Phone",hWndList);
AddContactPhonesToComboToListParam(hContact,lpszProto,"Cellular",hWndList);
AddContactPhonesToComboToListParam(hContact,lpszProto,"Fax",hWndList);
@@ -1095,19 +1089,13 @@ void AddContactPhonesToTreeViewParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpsz
void SendSMSWindowFillTreeView(HWND hWnd)
{
- HWND hWndTreeView;
- LPSTR lpszProto;
- HTREEITEM hParent;
-
- hWndTreeView=GetDlgItem(hWnd,IDC_NUMBERSLIST);
+ HWND hWndTreeView=GetDlgItem(hWnd,IDC_NUMBERSLIST);
TreeView_DeleteAllItems(hWndTreeView);
- for(HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
- {
- hParent=NULL;
- lpszProto=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (lpszProto)
- {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ HTREEITEM hParent = NULL;
+ LPSTR lpszProto = GetContactProto(hContact);
+ if (lpszProto) {
AddContactPhonesToTreeViewParam(hContact,lpszProto,"Phone",hWndTreeView,&hParent);
AddContactPhonesToTreeViewParam(hContact,lpszProto,"Cellular",hWndTreeView,&hParent);
AddContactPhonesToTreeViewParam(hContact,lpszProto,"Fax",hWndTreeView,&hParent);