From f5f33f37e22e5dbd2a6d50282bb6c4ca45985583 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 24 Jan 2014 20:25:53 +0000 Subject: translation fixes and code cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@7865 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SMS/src/SMSConstans.h | 6 +- plugins/SMS/src/SMS_svc.cpp | 22 +--- plugins/SMS/src/common.h | 23 +--- plugins/SMS/src/main.cpp | 4 +- plugins/SMS/src/options.cpp | 38 +++---- plugins/SMS/src/receive.cpp | 52 ++++----- plugins/SMS/src/recvdlg.cpp | 17 ++- plugins/SMS/src/senddlg.cpp | 247 ++++++++++++++++++++---------------------- 8 files changed, 178 insertions(+), 231 deletions(-) diff --git a/plugins/SMS/src/SMSConstans.h b/plugins/SMS/src/SMSConstans.h index d20ce5dc1d..67159180f5 100644 --- a/plugins/SMS/src/SMSConstans.h +++ b/plugins/SMS/src/SMSConstans.h @@ -4,7 +4,7 @@ #define PROTOCOL_NAMEA "SMSPlugin" #define PROTOCOL_NAME_LEN (sizeof(PROTOCOL_NAMEA)-1) #define PROTOCOL_NAME_SIZE sizeof(PROTOCOL_NAMEA) -#define PROTOCOL_DISPLAY_NAME_ORIG "SMS" +#define PROTOCOL_DISPLAY_NAME_ORIG LPGEN("SMS") #define TIMEOUT_MSGSEND 60000 // send sms timeout #define MIN_SMS_DBEVENT_LEN 4 // для фильтрации событий авторизации от джабер плагина @@ -66,8 +66,8 @@ int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam); #define SMS_READ "/ReadSms" #define SMS_READ_ACK "/ReadSmsAck" #define SMS_SEND "/SendSMS" -#define SMS_SEND_STR L"Send &SMS..." -#define SMS_SEND_CM_STR L"&SMS Message" +#define SMS_SEND_STR LPGENT("Send &SMS...") +#define SMS_SEND_CM_STR LPGENT("&SMS Message") // структура содержащая информацию о сервисах/функциях struct SERVICE_ITEM diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 49cda03964..7e5d31be65 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -2,7 +2,7 @@ int LoadServices(void) { - CHAR szServiceFunction[MAX_PATH],*pszServiceFunctionName; + char szServiceFunction[MAX_PATH],*pszServiceFunctionName; CopyMemory(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE); pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN; @@ -25,7 +25,7 @@ int LoadModules(void) HookEvent(ME_DB_EVENT_ADDED,handleNewMessage); HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList); - CHAR szServiceFunction[MAX_PATH]; + char szServiceFunction[MAX_PATH]; mir_snprintf(szServiceFunction,sizeof(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND); CLISTMENUITEM mi = { sizeof(mi) }; @@ -79,7 +79,7 @@ int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam) 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)); + SendDlgItemMessage(hwndSendSms,IDC_NAME,CB_ADDSTRING,0,(LPARAM)GetContactNameW(hContact)); SendSMSWindowSMSContactAdd(hwndSendSms,hContact); } } @@ -151,19 +151,3 @@ void RestoreUnreadMessageAlerts(void) handleNewMessage(NULL, (LPARAM)hDbEvent); } } - - - - - - - - - - - - - - - - diff --git a/plugins/SMS/src/common.h b/plugins/SMS/src/common.h index 7c2eab9643..5388d6dda6 100644 --- a/plugins/SMS/src/common.h +++ b/plugins/SMS/src/common.h @@ -78,30 +78,11 @@ extern SMS_SETTINGS ssSMSSettings; #define MEMREALLOC(Mem,Size) HeapReAlloc(ssSMSSettings.hHeap,(HEAP_ZERO_MEMORY),(LPVOID)Mem,(Size+sizeof(SIZE_T))) #define MEMFREE(Mem) if (Mem) {HeapFree(ssSMSSettings.hHeap,0,(LPVOID)Mem);Mem=NULL;} -#define SEND_DLG_ITEM_MESSAGEW(hDlg,nIDDlgItem,Msg,wParam,lParam) SendMessageW(GetDlgItem(hDlg,nIDDlgItem),Msg,wParam,lParam) -#define SEND_DLG_ITEM_MESSAGEA(hDlg,nIDDlgItem,Msg,wParam,lParam) SendMessageA(GetDlgItem(hDlg,nIDDlgItem),Msg,wParam,lParam) -#define SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,Msg,wParam,lParam) SendMessage(GetDlgItem(hDlg,nIDDlgItem),Msg,wParam,lParam) -#define IS_DLG_BUTTON_CHECKED(hDlg,nIDDlgItem) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,BM_GETCHECK,NULL,NULL) -#define CHECK_DLG_BUTTON(hDlg,nIDDlgItem,uCheck) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,BM_SETCHECK,(WPARAM)uCheck,NULL) +#define GET_DLG_ITEM_TEXT_LENGTH(hDlg,nIDDlgItem) SendDlgItemMessage(hDlg,nIDDlgItem,WM_GETTEXTLENGTH,NULL,NULL) +#define GET_CURRENT_COMBO_DATA(hWndDlg,ControlID) SendDlgItemMessage(hWndDlg,ControlID,CB_GETITEMDATA,SendDlgItemMessage(hWndDlg,ControlID,CB_GETCURSEL,0,0),0) -#define SET_DLG_ITEM_TEXTW(hDlg,nIDDlgItem,lpString) SEND_DLG_ITEM_MESSAGEW(hDlg,nIDDlgItem,WM_SETTEXT,0,(LPARAM)lpString) -#define SET_DLG_ITEM_TEXTA(hDlg,nIDDlgItem,lpString) SEND_DLG_ITEM_MESSAGEA(hDlg,nIDDlgItem,WM_SETTEXT,0,(LPARAM)lpString) -#define SET_DLG_ITEM_TEXT(hDlg,nIDDlgItem,lpString) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,WM_SETTEXT,0,(LPARAM)lpString) -#define GET_DLG_ITEM_TEXTW(hDlg,nIDDlgItem,lpString,nMaxCount) SEND_DLG_ITEM_MESSAGEW(hDlg,nIDDlgItem,WM_GETTEXT,(WPARAM)nMaxCount,(LPARAM)lpString) -#define GET_DLG_ITEM_TEXTA(hDlg,nIDDlgItem,lpString,nMaxCount) SEND_DLG_ITEM_MESSAGEA(hDlg,nIDDlgItem,WM_GETTEXT,(WPARAM)nMaxCount,(LPARAM)lpString) -#define GET_DLG_ITEM_TEXT(hDlg,nIDDlgItem,lpString,nMaxCount) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,WM_GETTEXT,(WPARAM)nMaxCount,(LPARAM)lpString) - -#define GET_DLG_ITEM_TEXT_LENGTH(hDlg,nIDDlgItem) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,WM_GETTEXTLENGTH,NULL,NULL) -#define GET_WINDOW_TEXT_LENGTH(hDlg) SendMessage(hDlg,WM_GETTEXTLENGTH,NULL,NULL) - -#define GET_CURRENT_COMBO_DATA(hWndDlg,ControlID) SEND_DLG_ITEM_MESSAGE(hWndDlg,ControlID,CB_GETITEMDATA,SEND_DLG_ITEM_MESSAGE(hWndDlg,ControlID,CB_GETCURSEL,0,0),0) - - - - -#define GetContactNameA(Contact) (LPSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)Contact,0) #define GetContactNameW(Contact) (LPWSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)Contact,GCDNF_UNICODE) #define DB_SMS_DeleteValue(Contact,valueName) db_unset(Contact,PROTOCOL_NAMEA,valueName) diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp index d2a846e5e1..592641acaa 100644 --- a/plugins/SMS/src/main.cpp +++ b/plugins/SMS/src/main.cpp @@ -96,7 +96,7 @@ extern "C" int __declspec(dllexport) Unload(void) return 0; } -int OnModulesLoaded(WPARAM wParam,LPARAM lParam) +int OnModulesLoaded(WPARAM,LPARAM) { VersionConversions(); @@ -105,7 +105,7 @@ int OnModulesLoaded(WPARAM wParam,LPARAM lParam) return 0; } -int OnPreShutdown(WPARAM wParam,LPARAM lParam) +int OnPreShutdown(WPARAM,LPARAM) { RecvSMSWindowDestroy(); SendSMSWindowDestroy(); diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp index e7314b2180..06ac339f22 100644 --- a/plugins/SMS/src/options.cpp +++ b/plugins/SMS/src/options.cpp @@ -31,36 +31,36 @@ WORD wSMSSignControlsList[] = { IDC_BEGIN, IDC_END, IDC_SIGNATURE, IDC_SIGNGROUP INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - WCHAR wszSign[1024]; + TCHAR tszSign[1024]; switch(msg){ case WM_INITDIALOG: TranslateDialogDefault(hWndDlg); - if (DB_SMS_GetStaticStringW(NULL,"Signature",wszSign,SIZEOF(wszSign),NULL)==FALSE) - mir_sntprintf(wszSign,SIZEOF(wszSign),TranslateT("From %s:\r\n\r\n"),GetContactNameW(NULL)); + if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,SIZEOF(tszSign),NULL)==FALSE) + mir_sntprintf(tszSign,SIZEOF(tszSign),TranslateT("From %s:\r\n\r\n"),GetContactNameW(NULL)); - SET_DLG_ITEM_TEXTW(hWndDlg,IDC_SIGNATURE,wszSign); + SetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign); { BOOL bUseSign = DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE); - CHECK_DLG_BUTTON(hWndDlg,IDC_USESIGNATURE,bUseSign); + CheckDlgButton(hWndDlg,IDC_USESIGNATURE,bUseSign); EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),bUseSign); BOOL bSignBebefore=DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS); - CHECK_DLG_BUTTON(hWndDlg,IDC_BEGIN,bSignBebefore); - CHECK_DLG_BUTTON(hWndDlg,IDC_END,(!bSignBebefore)); + CheckDlgButton(hWndDlg,IDC_BEGIN,bSignBebefore); + CheckDlgButton(hWndDlg,IDC_END,(!bSignBebefore)); } - CHECK_DLG_BUTTON(hWndDlg,IDC_SHOWACK,DB_SMS_GetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK)); - CHECK_DLG_BUTTON(hWndDlg,IDC_AUTOPOP,DB_SMS_GetByte(NULL,"AutoPopup",SMS_DEFAULT_AUTOPOP)); - CHECK_DLG_BUTTON(hWndDlg,IDC_SAVEWINPOS,DB_SMS_GetByte(NULL,"SavePerContact",SMS_DEFAULT_SAVEWINPOS)); + CheckDlgButton(hWndDlg,IDC_SHOWACK,DB_SMS_GetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK)); + CheckDlgButton(hWndDlg,IDC_AUTOPOP,DB_SMS_GetByte(NULL,"AutoPopup",SMS_DEFAULT_AUTOPOP)); + CheckDlgButton(hWndDlg,IDC_SAVEWINPOS,DB_SMS_GetByte(NULL,"SavePerContact",SMS_DEFAULT_SAVEWINPOS)); return TRUE; case WM_COMMAND: SendMessage(GetParent(hWndDlg),PSM_CHANGED,0,0); switch(LOWORD(wParam)){ case IDC_USESIGNATURE: - EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_USESIGNATURE)); + EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE)); break; } break; @@ -70,14 +70,14 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA case 0: switch (((LPNMHDR)lParam)->code){ case PSN_APPLY: - GET_DLG_ITEM_TEXTW(hWndDlg,IDC_SIGNATURE,wszSign,SIZEOF(wszSign)); + GetDlgItemText(hWndDlg,IDC_SIGNATURE,wszSign,SIZEOF(wszSign)); DB_SMS_SetStringW(NULL,"Signature",wszSign); - DB_SMS_SetByte(NULL,"UseSignature",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_USESIGNATURE)); - DB_SMS_SetByte(NULL,"SignaturePos",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_BEGIN)); - DB_SMS_SetByte(NULL,"ShowACK",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_SHOWACK)); - DB_SMS_SetByte(NULL,"AutoPopup",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_AUTOPOP)); - DB_SMS_SetByte(NULL,"SavePerContact",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_SAVEWINPOS)); + DB_SMS_SetByte(NULL,"UseSignature",IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE)); + DB_SMS_SetByte(NULL,"SignaturePos",IsDlgButtonChecked(hWndDlg,IDC_BEGIN)); + DB_SMS_SetByte(NULL,"ShowACK",IsDlgButtonChecked(hWndDlg,IDC_SHOWACK)); + DB_SMS_SetByte(NULL,"AutoPopup",IsDlgButtonChecked(hWndDlg,IDC_AUTOPOP)); + DB_SMS_SetByte(NULL,"SavePerContact",IsDlgButtonChecked(hWndDlg,IDC_SAVEWINPOS)); return TRUE; } } @@ -86,12 +86,12 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA return FALSE; } -int OptInitialise(WPARAM wParam,LPARAM lParam) +int OptInitialise(WPARAM wParam,LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; odp.hInstance = ssSMSSettings.hInstance; - odp.pszGroup = "Events"; + odp.pszGroup = LPGEN("Events"); odp.flags = ODPF_BOLDGROUPS; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SMSPLUGIN); odp.pszTitle = PROTOCOL_DISPLAY_NAME_ORIG; diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index 5e167739d0..43cab8af13 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -34,7 +34,7 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) if (((ACKDATA*)lParam)->type==ICQACKTYPE_SMS) { char szPhone[MAX_PHONE_LEN]={0}; - WCHAR wszPhone[MAX_PHONE_LEN]={0}; + TCHAR tszPhone[MAX_PHONE_LEN]={0}; LPSTR lpszXML=(LPSTR)((ACKDATA*)lParam)->lParam,lpszData,lpszPhone; SIZE_T dwXMLSize=lstrlenA(lpszXML),dwDataSize,dwPhoneSize; ACKDATA *ack=((ACKDATA*)lParam); @@ -44,15 +44,14 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) if (GetXMLFieldEx(lpszXML,dwXMLSize,&lpszPhone,&dwPhoneSize,"sms_message","sender",NULL)) { LPSTR lpszMessageUTF; - LPWSTR lpwszMessageXMLEncoded,lpwszMessageXMLDecoded; SIZE_T dwBuffLen,dwMessageXMLEncodedSize,dwMessageXMLDecodedSize; HANDLE hContact; DBEVENTINFO dbei = { sizeof(dbei) }; dwBuffLen=(dwDataSize+MAX_PATH); dbei.pBlob=(LPBYTE)MEMALLOC((dwBuffLen+dwPhoneSize)); - lpwszMessageXMLEncoded=(LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR))); - lpwszMessageXMLDecoded=(LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR))); + LPWSTR lpwszMessageXMLEncoded=(LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR))); + LPWSTR lpwszMessageXMLDecoded=(LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR))); if (dbei.pBlob && lpwszMessageXMLEncoded && lpwszMessageXMLDecoded) { dwMessageXMLEncodedSize=MultiByteToWideChar(CP_UTF8,0,lpszData,dwDataSize,lpwszMessageXMLEncoded,dwBuffLen); @@ -61,8 +60,8 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) WideCharToMultiByte(CP_UTF8,0,lpwszMessageXMLDecoded,dwMessageXMLDecodedSize,lpszMessageUTF,dwBuffLen,NULL,NULL); dwPhoneSize=CopyNumberA(szPhone,lpszPhone,dwPhoneSize); - dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,wszPhone,MAX_PHONE_LEN); - hContact=HContactFromPhone(wszPhone,dwPhoneSize); + dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,tszPhone,MAX_PHONE_LEN); + hContact=HContactFromPhone(tszPhone,dwPhoneSize); dbei.szModule=GetModuleName(hContact); dbei.timestamp=time(NULL); @@ -73,7 +72,7 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) (*((DWORD*)(dbei.pBlob+(dbei.cbBlob-sizeof(DWORD)))))=0; HANDLE hResult = db_event_add(hContact, &dbei); if (hContact==NULL) { - if ( RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMS,wszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob)) { + if ( RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMS,tszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob)) { db_event_markRead(hContact, hResult); SkinPlaySound("RecvSMSMsg"); } @@ -88,13 +87,11 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) { if (GetXMLFieldEx(lpszXML,dwXMLSize,&lpszPhone,&dwPhoneSize,"sms_delivery_receipt","destination",NULL)) { - HANDLE hContact; - DBEVENTINFO dbei={0}; - dwPhoneSize=CopyNumberA(szPhone,lpszPhone,dwPhoneSize); - dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,wszPhone,MAX_PHONE_LEN); - hContact=HContactFromPhone(wszPhone,dwPhoneSize); + dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,tszPhone,MAX_PHONE_LEN); + HANDLE hContact=HContactFromPhone(tszPhone,dwPhoneSize); + DBEVENTINFO dbei={0}; dbei.cbSize=sizeof(dbei); dbei.szModule=GetModuleName(hContact); dbei.timestamp=time(NULL); @@ -125,7 +122,7 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) if (hContact) db_event_add(hContact, &dbei); else - RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMSCONFIRMATION,wszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob); + RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMSCONFIRMATION,tszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob); MEMFREE(dbei.pBlob); } @@ -141,20 +138,19 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) GetXMLFieldExBuff(lpszXML,dwXMLSize,szNetwork,sizeof(szNetwork),NULL,"sms_response","network",NULL); if (ack->result==ACKRESULT_FAILED || CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszData,dwDataSize,"no",2)==CSTR_EQUAL) { - HWND hwndTimeOut; char szBuff[1024]; - WCHAR wszErrorMessage[1028]; + TCHAR tszErrorMessage[1028]; LPSTR lpszErrorDescription; if (SendSMSWindowMultipleGet(hWndDlg)) { TVITEM tvi; tvi.mask=TVIF_TEXT; tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg); - tvi.pszText=wszPhone; - tvi.cchTextMax=SIZEOF(wszPhone); + tvi.pszText=tszPhone; + tvi.cchTextMax=SIZEOF(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); } - else GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(szPhone)); + else GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(szPhone)); if (ack->result == ACKRESULT_FAILED) lpszErrorDescription=lpszXML; @@ -163,11 +159,11 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) GetXMLFieldExBuff(lpszXML,dwXMLSize,szBuff,sizeof(szBuff),NULL,"sms_response","error","params","param",NULL); } - mir_sntprintf(wszErrorMessage,SIZEOF(wszErrorMessage),TranslateT("SMS message didn't send by %S to %s because: %S"),szNetwork,wszPhone,lpszErrorDescription); + mir_sntprintf(tszErrorMessage,SIZEOF(tszErrorMessage),TranslateT("SMS message didn't send by %S to %s because: %S"),szNetwork,tszPhone,lpszErrorDescription); ShowWindow(hWndDlg,SW_SHOWNORMAL); EnableWindow(hWndDlg,FALSE); - hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc); - SET_DLG_ITEM_TEXTW(hwndTimeOut,IDC_STATUS,wszErrorMessage); + HWND hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc); + SetDlgItemText(hwndTimeOut,IDC_STATUS,tszErrorMessage); } else { SendSMSWindowDBAdd(hWndDlg); @@ -191,14 +187,14 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) GetXMLFieldExBuff(lpszXML,dwXMLSize,szMessageID,sizeof(szMessageID),NULL,"sms_response","message_id",NULL); } else { - SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_SOURCE,TranslateT("From:")); - SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_MESSAGEID,TranslateT("To:")); + SetDlgItemText(hwndAccepted,IDC_ST_SOURCE,TranslateT("From:")); + SetDlgItemText(hwndAccepted,IDC_ST_MESSAGEID,TranslateT("To:")); GetXMLFieldExBuff(lpszXML,dwXMLSize,szSource,sizeof(szSource),NULL,"sms_response","from",NULL); GetXMLFieldExBuff(lpszXML,dwXMLSize,szMessageID,sizeof(szMessageID),NULL,"sms_response","to",NULL); } - SET_DLG_ITEM_TEXTA(hwndAccepted,IDC_NETWORK,szNetwork); - SET_DLG_ITEM_TEXTA(hwndAccepted,IDC_SOURCE,szSource); - SET_DLG_ITEM_TEXTA(hwndAccepted,IDC_MESSAGEID,szMessageID); + SetDlgItemTextA(hwndAccepted,IDC_NETWORK,szNetwork); + SetDlgItemTextA(hwndAccepted,IDC_SOURCE,szSource); + SetDlgItemTextA(hwndAccepted,IDC_MESSAGEID,szMessageID); } else SendSMSWindowRemove(hWndDlg); } @@ -214,8 +210,8 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) //Handles new SMS messages added to the database int handleNewMessage(WPARAM wParam, LPARAM lParam) { - CHAR szServiceFunction[MAX_PATH], *pszServiceFunctionName; - WCHAR szToolTip[MAX_PATH]; + char szServiceFunction[MAX_PATH], *pszServiceFunctionName; + TCHAR szToolTip[MAX_PATH]; HANDLE hContact = (HANDLE)wParam, hDbEvent = (HANDLE)lParam; DBEVENTINFO dbei = { sizeof(dbei) }; diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index 40d52cde6f..e7f640ffca 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -75,13 +75,12 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l mir_subclassWindow(GetDlgItem(hWndDlg,IDC_MESSAGE), MessageSubclassProc); { - HFONT hFont; LOGFONT lf; - hFont=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0); - if (hFont && hFont!=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont); + HFONT hFont=(HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0); + if (hFont && hFont!=(HFONT)SendDlgItemMessage(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont); LoadMsgDlgFont(MSGFONTID_YOURMSG,&lf,NULL); hFont=CreateFontIndirect(&lf); - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0)); + SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0)); COLORREF colour=db_get_dw(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR); prswdWindowData->hBkgBrush=CreateSolidBrush(colour); @@ -137,13 +136,13 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l HWND hwndSendSms; HANDLE hContact; - hContact=HContactFromPhone(wszPhone,GET_DLG_ITEM_TEXTW(hWndDlg,IDC_NUMBER,wszPhone,SIZEOF(wszPhone))); + hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,SIZEOF(wszPhone))); hwndSendSms=SendSMSWindowIsOtherInstanceHContact(hContact); if (hwndSendSms) SetFocus(hwndSendSms); else { hwndSendSms=SendSMSWindowAdd(prswdWindowData->hContact); - SET_DLG_ITEM_TEXTW(hwndSendSms,IDC_ADDRESS,wszPhone); + SetDlgItemText(hwndSendSms,IDC_ADDRESS,wszPhone); } } case IDCANCEL: @@ -222,9 +221,9 @@ HWND RecvSMSWindowAdd(HANDLE hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T MultiByteToWideChar(CP_UTF8,0,lpszMessage,dwMessageSize,lpwszMessage,(dwMessageSize+MAX_PATH)); SendMessageW(prswdWindowData->hWnd,WM_SETTEXT,NULL,(LPARAM)wszTitle); - SET_DLG_ITEM_TEXTW(prswdWindowData->hWnd,IDC_NAME,lpwszContactDisplayName); - SET_DLG_ITEM_TEXTW(prswdWindowData->hWnd,IDC_NUMBER,wszPhoneLocal); - SET_DLG_ITEM_TEXTW(prswdWindowData->hWnd,IDC_MESSAGE,lpwszMessage); + SetDlgItemText(prswdWindowData->hWnd,IDC_NAME,lpwszContactDisplayName); + SetDlgItemText(prswdWindowData->hWnd,IDC_NUMBER,wszPhoneLocal); + SetDlgItemText(prswdWindowData->hWnd,IDC_MESSAGE,lpwszMessage); SendMessage(prswdWindowData->hWnd,WM_SETICON,ICON_BIG,(LPARAM)hIcon); SetFocus(GetDlgItem(prswdWindowData->hWnd,IDC_MESSAGE)); diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index ce85e08ecc..e92fdbe2ce 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -87,23 +87,25 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc); SendMessage(hWndDlg,WM_SETICON,ICON_BIG,(LPARAM)LoadSkinnedIcon(SKINICON_OTHER_SMS)); - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_HISTORY,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadSkinnedIcon(SKINICON_OTHER_HISTORY)); + SendDlgItemMessage(hWndDlg,IDC_HISTORY,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadSkinnedIcon(SKINICON_OTHER_HISTORY)); { HICON hIcon; HIMAGELIST hIml=ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,30); TreeView_SetImageList(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),hIml,TVSIL_NORMAL); - hIcon=LoadSkinnedIcon(SKINICON_OTHER_NOTICK); ImageList_AddIcon(hIml,hIcon); - hIcon=LoadSkinnedIcon(SKINICON_OTHER_TICK); ImageList_AddIcon(hIml,hIcon); - hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDI_HALFTICK),IMAGE_ICON,0,0,LR_SHARED); ImageList_AddIcon(hIml,hIcon); + hIcon=LoadSkinnedIcon(SKINICON_OTHER_NOTICK); + ImageList_AddIcon(hIml,hIcon); + hIcon=LoadSkinnedIcon(SKINICON_OTHER_TICK); + ImageList_AddIcon(hIml,hIcon); + hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDI_HALFTICK),IMAGE_ICON,0,0,LR_SHARED); + ImageList_AddIcon(hIml,hIcon); } - { - HFONT hFont; + { LOGFONT lf; - hFont=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0); - if (hFont && hFont!=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont); + HFONT hFont=(HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0); + if (hFont && hFont!=(HFONT)SendDlgItemMessage(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont); LoadMsgDlgFont(MSGFONTID_MESSAGEAREA,&lf,NULL); hFont=CreateFontIndirect(&lf); - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0)); + SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0)); COLORREF colour=db_get_dw(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR); psswdWindowData->hBkgBrush=CreateSolidBrush(colour); @@ -140,20 +142,20 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l SendSMSWindowUpdateAccountList(hWndDlg); { - WCHAR wszSign[1024]; + TCHAR tszSign[1024]; SIZE_T dwSignLen; if (DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE)) - if (DB_SMS_GetStaticStringW(NULL,"Signature",wszSign,SIZEOF(wszSign),&dwSignLen)) + if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,SIZEOF(tszSign),&dwSignLen)) { - SET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,wszSign); + SetDlgItemText(hWndDlg,IDC_MESSAGE,tszSign); - if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS)) SEND_DLG_ITEM_MESSAGEW(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen); + if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS)) SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen); EnableWindow(GetDlgItem(hWndDlg,IDOK),dwSignLen); } - mir_sntprintf(wszSign,SIZEOF(wszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg)); - SET_DLG_ITEM_TEXTW(hWndDlg,IDC_COUNT,wszSign); + mir_sntprintf(tszSign,SIZEOF(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg)); + SetDlgItemText(hWndDlg,IDC_COUNT,tszSign); } if (Utils_RestoreWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? psswdWindowData->hMyContact:NULL),PROTOCOL_NAMEA,"send")) @@ -207,25 +209,25 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l if (wParam==TIMERID_MSGSEND) { HWND hwndTimeOut; - TCHAR wszMessage[1028],wszPhone[MAX_PHONE_LEN]; + TCHAR tszMessage[1028],tszPhone[MAX_PHONE_LEN]; if (psswdWindowData->bMultiple) { TVITEM tvi; tvi.mask=TVIF_TEXT; tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg); - tvi.pszText=wszPhone; - tvi.cchTextMax=SIZEOF(wszPhone); + tvi.pszText=tszPhone; + tvi.cchTextMax=SIZEOF(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); }else{ - GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone)); + GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)); } - mir_sntprintf(wszMessage,SIZEOF(wszMessage),TranslateT("The SMS message send to %s timed out."),wszPhone); + mir_sntprintf(tszMessage,SIZEOF(tszMessage),TranslateT("The SMS message send to %s timed out."),tszPhone); KillTimer(hWndDlg,wParam); ShowWindow(hWndDlg,SW_SHOWNORMAL); EnableWindow(hWndDlg,FALSE); hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc); - SET_DLG_ITEM_TEXTW(hwndTimeOut,IDC_STATUS,wszMessage); + SetDlgItemText(hwndTimeOut,IDC_STATUS,tszMessage); } break; case WM_CTLCOLOREDIT: @@ -254,7 +256,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l } }else{ EnableWindow(GetDlgItem(hWndDlg,IDOK),TRUE); - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,FALSE,0); + SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,FALSE,0); EnableWindow(GetDlgItem(hWndDlg,IDC_ACCOUNTS),TRUE); EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),TRUE); EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),TRUE); @@ -267,12 +269,11 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l break; case TIMEDOUT_RETRY: { - WCHAR wszPhone[MAX_PHONE_LEN]; - LPWSTR lpwszMessage; - SIZE_T dwPhoneSize,dwMessageSize; + TCHAR tszPhone[MAX_PHONE_LEN]; + SIZE_T dwPhoneSize; - dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); - lpwszMessage=(LPWSTR)MEMALLOC(((dwMessageSize+4)*sizeof(WCHAR))); + SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); + LPTSTR lpwszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR))); if (lpwszMessage) { if (psswdWindowData->bMultiple) @@ -280,16 +281,16 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l TVITEM tvi; tvi.mask=TVIF_TEXT; tvi.hItem=psswdWindowData->hItemSend; - tvi.pszText=wszPhone; - tvi.cchTextMax=SIZEOF(wszPhone); + tvi.pszText=tszPhone; + tvi.cchTextMax=SIZEOF(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); - dwPhoneSize=lstrlenW(wszPhone); + dwPhoneSize=lstrlen(tszPhone); }else{ - dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone)); + dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)); } - dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); - SendSMSWindowNumberSet(hWndDlg,wszPhone,dwPhoneSize); - StartSmsSend(hWndDlg,SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),wszPhone,dwPhoneSize,lpwszMessage,dwMessageSize); + dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); + SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize); + StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lpwszMessage,dwMessageSize); MEMFREE(lpwszMessage); } } @@ -305,15 +306,15 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l case IDC_ADDNUMBER: { - WCHAR wszPhone[MAX_PHONE_LEN]; - if (IsPhoneW(wszPhone,GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone)))) { + TCHAR tszPhone[MAX_PHONE_LEN]; + if (IsPhoneW(tszPhone,GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)))) { TVINSERTSTRUCT tvis = {0}; tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.hInsertAfter = TVI_SORT; - tvis.item.pszText = wszPhone; + tvis.item.pszText = tszPhone; TreeView_InsertItem( GetDlgItem(hWndDlg,IDC_NUMBERSLIST), &tvis); } - else MessageBox(hWndDlg,TranslateT("The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK); + else MessageBox(hWndDlg,TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK); } break; @@ -339,7 +340,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l EnableWindow(GetDlgItem(hWndDlg,IDC_MULTIPLE),FALSE); EnableWindow(GetDlgItem(hWndDlg,IDC_ADDNUMBER),FALSE); //EnableWindow(GetDlgItem(hWndDlg,IDC_REMOVENUMBER),FALSE); - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0); + SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0); EnableWindow(GetDlgItem(hWndDlg,IDC_ACCOUNTS),FALSE); EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),FALSE); SendSMSWindowNext(hWndDlg); @@ -347,16 +348,16 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l MessageBox(hWndDlg,TranslateT("There must be numbers in the list first."),TranslateT("No Numbers"),MB_OK); } }else{ - WCHAR wszPhone[MAX_PHONE_LEN]; - SIZE_T dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone)); - if (IsPhoneW(wszPhone,dwPhoneSize)) + TCHAR tszPhone[MAX_PHONE_LEN]; + SIZE_T dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)); + if (IsPhoneW(tszPhone,dwPhoneSize)) { SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); - LPWSTR lpwszMessage=(LPWSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR)); + LPTSTR lpwszMessage=(LPTSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR)); if (lpwszMessage) { - dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); - SendSMSWindowNumberSet(hWndDlg,wszPhone,dwPhoneSize); + dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); + SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize); EnableWindow(GetDlgItem(hWndDlg,IDOK),FALSE); EnableWindow(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),FALSE); EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),FALSE); @@ -364,69 +365,69 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l EnableWindow(GetDlgItem(hWndDlg,IDC_MULTIPLE),FALSE); EnableWindow(GetDlgItem(hWndDlg,IDC_ACCOUNTS),FALSE); EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),FALSE); - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0); - StartSmsSend(hWndDlg,SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),wszPhone,dwPhoneSize,lpwszMessage,dwMessageSize); + SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0); + StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lpwszMessage,dwMessageSize); SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL); MEMFREE(lpwszMessage); } }else{ - MessageBox(hWndDlg,TranslateT("Valid phone numbers are of the form '+(country code)(phone szPhone)'. The contents of the phone szPhone portion is dependent on the national layout of phone numbers, but often omits the leading zero."),TranslateT("Invalid phone number"),MB_OK); + MessageBox(hWndDlg,TranslateT("Valid phone numbers are of the form '+(country code)(phone number)'. The contents of the phone number portion is dependent on the national layout of phone numbers, but often omits the leading zero."),TranslateT("Invalid phone number"),MB_OK); SetFocus(GetDlgItem(hWndDlg,IDC_ADDRESS)); - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ADDRESS,CB_SETEDITSEL,0,MAKELPARAM(0,-1)); + SendDlgItemMessage(hWndDlg,IDC_ADDRESS,CB_SETEDITSEL,0,MAKELPARAM(0,-1)); } } } break; case IDCANCEL: - DeleteObject((HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0)); + DeleteObject((HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0)); KillTimer(GetParent(hWndDlg),TIMERID_MSGSEND); SendSMSWindowRemove(hWndDlg); break; case IDC_MESSAGE: if (HIWORD(wParam)==EN_CHANGE) { - WCHAR wszBuff[MAX_PATH]; + TCHAR tszBuff[MAX_PATH]; SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); EnableWindow(GetDlgItem(hWndDlg,IDOK),dwMessageSize); - mir_sntprintf(wszBuff, SIZEOF(wszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg)); - SET_DLG_ITEM_TEXTW(hWndDlg,IDC_COUNT,wszBuff); + mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg)); + SetDlgItemText(hWndDlg,IDC_COUNT,tszBuff); } break; case IDC_SAVENUMBER: { BOOL bCont=TRUE; char szBuff[MAX_PATH]; - WCHAR wszPhone[MAX_PHONE_LEN]; + TCHAR tszPhone[MAX_PHONE_LEN]; DBVARIANT dbv; - SIZE_T dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,(SIZEOF(wszPhone)-4)); - if (IsPhoneW(wszPhone,dwPhoneSize)) + SIZE_T dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(SIZEOF(tszPhone)-4)); + if (IsPhoneW(tszPhone,dwPhoneSize)) { - if (IsContactPhone(psswdWindowData->hMyContact,wszPhone,dwPhoneSize)==FALSE) + if (IsContactPhone(psswdWindowData->hMyContact,tszPhone,dwPhoneSize)==FALSE) { - lstrcatW(wszPhone, _T(" SMS")); + lstrcat(tszPhone, _T(" SMS")); for(DWORD i=0;bCont;i++) { mir_snprintf(szBuff,SIZEOF(szBuff),"MyPhone%d",i); if (db_get(psswdWindowData->hMyContact,"UserInfo",szBuff,&dbv)) bCont=FALSE; db_free(&dbv); } - DB_SetStringW(psswdWindowData->hMyContact,"UserInfo",szBuff,wszPhone); + DB_SetStringW(psswdWindowData->hMyContact,"UserInfo",szBuff,tszPhone); } }else{ - MessageBox(hWndDlg, TranslateT("The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK); + MessageBox(hWndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK); } } break; case IDC_NAME: if (HIWORD(wParam)==CBN_SELCHANGE) { - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ADDRESS,CB_RESETCONTENT,0,0); - if (SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)) + SendDlgItemMessage(hWndDlg,IDC_ADDRESS,CB_RESETCONTENT,0,0); + if (SendDlgItemMessage(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)) { - HANDLE hContact=SendSMSWindowSMSContactGet(hWndDlg,(SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)-1)); + HANDLE hContact=SendSMSWindowSMSContactGet(hWndDlg,(SendDlgItemMessage(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)-1)); if (hContact) AddContactPhonesToCombo(hWndDlg,hContact); } } @@ -488,7 +489,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l } break; case WM_CLOSE: - DeleteObject((HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0)); + DeleteObject((HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0)); DeleteObject(psswdWindowData->hBkgBrush); ////////RemWinHandle(GetDlgItem(hWndDlg,IDC_MESSAGE)); KillTimer(GetParent(hWndDlg),TIMERID_MSGSEND); @@ -564,18 +565,16 @@ HWND SendSMSWindowAdd(HANDLE hContact) psswdWindowData->hMyContact = hContact; psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), NULL, SendSmsDlgProc, (LPARAM)psswdWindowData); if (psswdWindowData->hWnd) { - WCHAR wszTitle[MAX_PATH]; - LPWSTR lpwszContactDisplayName; - ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); ListMTItemAdd(&ssSMSSettings.lmtSendSMSWindowsListMT,&psswdWindowData->lmtListMTItem,psswdWindowData); ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - lpwszContactDisplayName=GetContactNameW(hContact); - mir_sntprintf(wszTitle, SIZEOF(wszTitle), _T("%s - %s"), lpwszContactDisplayName, TranslateT("Send SMS")); - SendMessageW(psswdWindowData->hWnd,WM_SETTEXT,NULL,(LPARAM)wszTitle); - SEND_DLG_ITEM_MESSAGEW(psswdWindowData->hWnd,IDC_NAME,CB_ADDSTRING,0,(LPARAM)lpwszContactDisplayName); - SEND_DLG_ITEM_MESSAGE(psswdWindowData->hWnd,IDC_NAME,CB_SETCURSEL,0,0); + LPTSTR lptszContactDisplayName=GetContactNameW(hContact); + TCHAR tszTitle[MAX_PATH]; + mir_sntprintf(tszTitle, SIZEOF(tszTitle), _T("%s - %s"), lptszContactDisplayName, TranslateT("Send SMS")); + SetWindowText(psswdWindowData->hWnd,tszTitle); + SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_ADDSTRING,0,(LPARAM)lptszContactDisplayName); + SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_SETCURSEL,0,0); AddContactPhonesToCombo(psswdWindowData->hWnd,hContact); SetFocus(GetDlgItem(psswdWindowData->hWnd,IDC_MESSAGE)); hRet=psswdWindowData->hWnd; @@ -593,7 +592,7 @@ void SendSMSWindowRemove(HWND hWndDlg) if (psswdWindowData) { - DB_SMS_SetDword(NULL,"LastProto",SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0)); + DB_SMS_SetDword(NULL,"LastProto",SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0)); SendSMSWindowMultipleSet(hWndDlg,FALSE); Utils_SaveWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? psswdWindowData->hMyContact:NULL),PROTOCOL_NAMEA,"send"); @@ -690,14 +689,14 @@ void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple) SendSMSWindowFillTreeView(hWndDlg); EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),FALSE); - SET_DLG_ITEM_TEXTW(hWndDlg, IDC_MULTIPLE, TranslateT("<< Single")); + SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("<< Single")); if (wp.showCmd==SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); SetWindowPos(hWndDlg, 0 ,rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right-rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); }else{ if (psswdWindowData->hMyContact) AddContactPhonesToCombo(hWndDlg,psswdWindowData->hMyContact); EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE); - SET_DLG_ITEM_TEXTW(hWndDlg, IDC_MULTIPLE, TranslateT("Multiple >>")); + SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("Multiple >>")); SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right-rcWin.left - (rcList.right-rcList.left) - 11, rcWin.bottom - rcWin.top,SWP_NOZORDER | SWP_NOMOVE); if (wp.showCmd==SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); } @@ -863,29 +862,28 @@ return(hRet); // void SendSMSWindowNext(HWND hWndDlg) { - WCHAR wszPhone[MAX_PHONE_LEN]; - LPWSTR lpwszMessage; + TCHAR tszPhone[MAX_PHONE_LEN]; SIZE_T dwPhoneSize,dwMessageSize; TVITEM tvi={0}; dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); - lpwszMessage=(LPWSTR)MEMALLOC(((dwMessageSize+4)*sizeof(WCHAR))); - if (lpwszMessage) + LPTSTR lptszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR))); + if (lptszMessage) { - dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); + dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lptszMessage,dwMessageSize+2); // if (SendSMSWindowNextHItemGet(hWndDlg,SendSMSWindowHItemSendGet(hWndDlg))==NULL) SendSMSWindowMultipleSet(hWndDlg,FALSE); tvi.mask=TVIF_TEXT; tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg); - tvi.pszText=wszPhone; - tvi.cchTextMax=SIZEOF(wszPhone); + tvi.pszText=tszPhone; + tvi.cchTextMax=SIZEOF(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); TreeView_SelectItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),tvi.hItem); - dwPhoneSize=lstrlenW(wszPhone); - SendSMSWindowNumberSet(hWndDlg,wszPhone,dwPhoneSize); - StartSmsSend(hWndDlg,SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),wszPhone,dwPhoneSize,lpwszMessage,dwMessageSize); + dwPhoneSize=lstrlenW(tszPhone); + SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize); + StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lptszMessage,dwMessageSize); SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL); - MEMFREE(lpwszMessage); + MEMFREE(lptszMessage); } } @@ -941,16 +939,16 @@ void SendSMSWindowUpdateAccountList(HWND hWndDlg) { SIZE_T i,dwCurSel; - dwCurSel=SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0); + dwCurSel=SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0); if (dwCurSel==-1) dwCurSel=DB_SMS_GetDword(NULL,"LastProto",0); if (dwCurSel==-1) dwCurSel=0; - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_RESETCONTENT,0,0); + SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_RESETCONTENT,0,0); for(i=0;iszModuleName); + SendDlgItemMessageA(hWndDlg,IDC_ACCOUNTS,CB_ADDSTRING,0,(LPARAM)ssSMSSettings.ppaSMSAccounts[i]->szModuleName); } - SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_SETCURSEL,(WPARAM)dwCurSel,0); + SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_SETCURSEL,(WPARAM)dwCurSel,0); } } @@ -982,29 +980,29 @@ void SendSMSWindowsUpdateAllAccountLists() void AddContactPhonesToComboToListParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList) { char szBuff[MAX_PATH]; - WCHAR wszPhone[MAX_PHONE_LEN],wszPhoneRaw[MAX_PHONE_LEN]; + TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN]; SIZE_T i,dwPhoneSize; - if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize)) + if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) { - wszPhone[0]='+'; - dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize); - if (IsPhoneW(wszPhone,dwPhoneSize)) + tszPhone[0]='+'; + dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); + if (IsPhoneW(tszPhone,dwPhoneSize)) { - if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)wszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)wszPhone); + if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)tszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)tszPhone); } } for (i=0;TRUE;i++) { mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i); - if (DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize)) + if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) { - wszPhone[0]='+'; - dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize); - if (IsPhoneW(wszPhone,dwPhoneSize)) + tszPhone[0]='+'; + dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); + if (IsPhoneW(tszPhone,dwPhoneSize)) { - if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)wszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)wszPhone); + if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)tszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)tszPhone); } }else{ if (i>PHONES_MIN_COUNT) break; @@ -1016,7 +1014,7 @@ void AddContactPhonesToComboToListParam(HANDLE hContact,LPSTR lpszModule,LPSTR l void AddContactPhonesToCombo(HWND hWnd,HANDLE hContact) { HWND hWndList = GetDlgItem(hWnd,IDC_ADDRESS); - SEND_DLG_ITEM_MESSAGE(hWnd,IDC_ADDRESS,CB_RESETCONTENT,0,0); + SendDlgItemMessage(hWnd,IDC_ADDRESS,CB_RESETCONTENT,0,0); LPSTR lpszProto = GetContactProto(hContact); if (lpszProto) { @@ -1029,7 +1027,7 @@ void AddContactPhonesToCombo(HWND hWnd,HANDLE hContact) AddContactPhonesToComboToListParam(hContact,"UserInfo","Cellular",hWndList); AddContactPhonesToComboToListParam(hContact,"UserInfo","Fax",hWndList); - SEND_DLG_ITEM_MESSAGE(hWnd,IDC_ADDRESS,CB_SETCURSEL,0,0); + SendDlgItemMessage(hWnd,IDC_ADDRESS,CB_SETCURSEL,0,0); } @@ -1037,7 +1035,7 @@ void AddContactPhonesToCombo(HWND hWnd,HANDLE hContact) void AddContactPhonesToTreeViewParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList,HTREEITEM *phParent) { char szBuff[MAX_PATH]; - WCHAR wszPhone[MAX_PHONE_LEN],wszPhoneRaw[MAX_PHONE_LEN]; + TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN]; SIZE_T i,dwPhoneSize; TVINSERTSTRUCT tvis={0}; @@ -1046,18 +1044,18 @@ void AddContactPhonesToTreeViewParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpsz tvis.hInsertAfter=TVI_SORT; tvis.item.iImage=tvis.item.iSelectedImage=0; - if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize)) + if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) { - wszPhone[0]='+'; - dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize); - if (IsPhoneW(wszPhone,dwPhoneSize)) + tszPhone[0]='+'; + dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); + if (IsPhoneW(tszPhone,dwPhoneSize)) { if (tvis.hParent==NULL) { tvis.item.pszText=GetContactNameW(hContact); tvis.hParent=TreeView_InsertItem(hWndList,&tvis); } - tvis.item.pszText=wszPhone; + tvis.item.pszText=tszPhone; TreeView_InsertItem(hWndList,&tvis); } } @@ -1065,18 +1063,18 @@ void AddContactPhonesToTreeViewParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpsz for (i=0;TRUE;i++) { mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i); - if (DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize)) + if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) { - wszPhone[0]='+'; - dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize); - if (IsPhoneW(wszPhone,dwPhoneSize)) + tszPhone[0]='+'; + dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); + if (IsPhoneW(tszPhone,dwPhoneSize)) { if (tvis.hParent==NULL) { tvis.item.pszText=GetContactNameW(hContact); tvis.hParent=TreeView_InsertItem(hWndList,&tvis); } - tvis.item.pszText=wszPhone; + tvis.item.pszText=tszPhone; TreeView_InsertItem(hWndList,&tvis); } }else{ @@ -1110,26 +1108,15 @@ void SendSMSWindowFillTreeView(HWND hWnd) SIZE_T GetSMSMessageLenMax(HWND hWndDlg) { - LPWSTR lpwszMessage; SIZE_T dwMessageSize,dwLenght=160; dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); - lpwszMessage=(LPWSTR)MEMALLOC(((dwMessageSize+4)*sizeof(WCHAR))); - if (lpwszMessage) + LPTSTR lptszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR))); + if (lptszMessage) { - dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); - if (dwMessageSize!=WideCharToMultiByte(CP_UTF8,0,lpwszMessage,dwMessageSize,NULL,0,NULL,NULL)) dwLenght=70; - MEMFREE(lpwszMessage); + dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lptszMessage,(dwMessageSize+2)); + if (dwMessageSize!=WideCharToMultiByte(CP_UTF8,0,lptszMessage,dwMessageSize,NULL,0,NULL,NULL)) dwLenght=70; + MEMFREE(lptszMessage); } return(dwLenght); } - - - - - - - - - - -- cgit v1.2.3