From 522586d7b8f7274fad2fe58c2615fc0d06618fcd Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Thu, 6 Mar 2014 01:16:01 +0000 Subject: MRA * Fix: SMS sending SMS * Fix: windows sizes then aero enabled * Fix: ICQEVENTTYPE_SMSCONFIRMATION db event write NewEventNotify + Add: support event types: ICQEVENTTYPE_SMS and ICQEVENTTYPE_SMSCONFIRMATION git-svn-id: http://svn.miranda-ng.org/main/trunk@8423 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewEventNotify/src/neweventnotify.h | 5 ++++ plugins/NewEventNotify/src/popup.cpp | 34 ++++++++++++++++++++++ plugins/SMS/src/SMSConstans.h | 44 ++++++++++++++--------------- plugins/SMS/src/receive.cpp | 7 +++-- plugins/SMS/src/recvdlg.cpp | 2 ++ plugins/SMS/src/senddlg.cpp | 10 ++++--- 6 files changed, 73 insertions(+), 29 deletions(-) (limited to 'plugins') diff --git a/plugins/NewEventNotify/src/neweventnotify.h b/plugins/NewEventNotify/src/neweventnotify.h index 521ff9083a..31e6295c3d 100644 --- a/plugins/NewEventNotify/src/neweventnotify.h +++ b/plugins/NewEventNotify/src/neweventnotify.h @@ -132,6 +132,11 @@ #define POPUP_COMMENT_AUTH LPGEN("Requests your authorization") #define POPUP_COMMENT_WEBPAGER LPGEN("ICQ Web pager") #define POPUP_COMMENT_EMAILEXP LPGEN("ICQ Email express") + +#define ICQEVENTTYPE_SMSCONFIRMATION 3001 +#define POPUP_COMMENT_SMS LPGEN("SMS Message") +#define POPUP_COMMENT_SMSCONFIRMATION LPGEN("SMS Confirmation") + #define POPUP_COMMENT_OTHER LPGEN("Unknown Event") #define MENUITEM_NAME LPGEN("Notify of new events") diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index d1d196dc9e..835a05102a 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -334,6 +334,40 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) commentFix = POPUP_COMMENT_EMAILEXP; break; + //blob format is: + //ASCIIZ text, usually of the form "SMS From: +XXXXXXXX\r\nTEXT" + case ICQEVENTTYPE_SMS: + if (dbei->pBlob) { + if (dbei->flags & DBEF_UTF) { + // utf-8 in blob + comment1 = mir_utf8decodeT((char*)dbei->pBlob); + } + else if (dbei->cbBlob == (_tcslen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { + // wchar in blob (the old hack) + comment1 = mir_tstrdup((TCHAR*)dbei->pBlob); + } + else comment1 = mir_a2t((char *)dbei->pBlob); + } + commentFix = POPUP_COMMENT_SMS; + break; + + //blob format is: + //ASCIIZ text, usually of the form "SMS Confirmation From: +XXXXXXXXXXXX\r\nSMS was sent succesfully" + case ICQEVENTTYPE_SMSCONFIRMATION: + if (dbei->pBlob) { + if (dbei->flags & DBEF_UTF) { + // utf-8 in blob + comment1 = mir_utf8decodeT((char*)dbei->pBlob); + } + else if (dbei->cbBlob == (_tcslen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) { + // wchar in blob (the old hack) + comment1 = mir_tstrdup((TCHAR*)dbei->pBlob); + } + else comment1 = mir_a2t((char *)dbei->pBlob); + } + commentFix = POPUP_COMMENT_SMSCONFIRMATION; + break; + default: if (ServiceExists(MS_DB_EVENT_GETTYPE)) { DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType); diff --git a/plugins/SMS/src/SMSConstans.h b/plugins/SMS/src/SMSConstans.h index 67159180f5..d76888d622 100644 --- a/plugins/SMS/src/SMSConstans.h +++ b/plugins/SMS/src/SMSConstans.h @@ -1,21 +1,21 @@ #if !defined(AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) #define AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_ -#define PROTOCOL_NAMEA "SMSPlugin" -#define PROTOCOL_NAME_LEN (sizeof(PROTOCOL_NAMEA)-1) -#define PROTOCOL_NAME_SIZE sizeof(PROTOCOL_NAMEA) -#define PROTOCOL_DISPLAY_NAME_ORIG LPGEN("SMS") +#define PROTOCOL_NAMEA "SMSPlugin" +#define PROTOCOL_NAME_LEN (sizeof(PROTOCOL_NAMEA)-1) +#define PROTOCOL_NAME_SIZE sizeof(PROTOCOL_NAMEA) +#define PROTOCOL_DISPLAY_NAME_ORIG LPGEN("SMS") -#define TIMEOUT_MSGSEND 60000 // send sms timeout -#define MIN_SMS_DBEVENT_LEN 4 // для фильтрации событий авторизации от джабер плагина -#define MAX_PHONE_LEN MAX_PATH -#define PHONES_MIN_COUNT 4 //internal // колличество элементов обязательно проверяемых при извлечении email адреса из инфы юзера +#define TIMEOUT_MSGSEND 60000 // send sms timeout +#define MIN_SMS_DBEVENT_LEN 4 // для фильтрации событий авторизации от джабер плагина +#define MAX_PHONE_LEN MAX_PATH +#define PHONES_MIN_COUNT 4 //internal // колличество элементов обязательно проверяемых при извлечении email адреса из инфы юзера #define SMS_DEFAULT_ #define SMS_DEFAULT_SIGNATUREPOS FALSE -#define SMS_DEFAULT_SHOWACK TRUE +#define SMS_DEFAULT_SHOWACK TRUE #define SMS_DEFAULT_USESIGNATURE TRUE -#define SMS_DEFAULT_AUTOPOP FALSE +#define SMS_DEFAULT_AUTOPOP FALSE #define SMS_DEFAULT_SAVEWINPOS FALSE @@ -25,8 +25,8 @@ //Fonts defenitions -//#define SRMMMOD "SRMM" -#define SRMMMOD "TabSRMM_Fonts" +//#define SRMMMOD "SRMM" +#define SRMMMOD "TabSRMM_Fonts" #define FONTF_BOLD 1 #define FONTF_ITALIC 2 @@ -39,16 +39,16 @@ struct FontOptionsList } static fontOptionsList[] = { - { RGB(106, 106, 106), _T("Arial"), 0, -12}, + { RGB(106, 106, 106), _T("Arial"), 0, -12}, }; -#define MSGFONTID_MYMSG 0 -#define MSGFONTID_YOURMSG 2 -#define MSGFONTID_MESSAGEAREA 16 +#define MSGFONTID_MYMSG 0 +#define MSGFONTID_YOURMSG 2 +#define MSGFONTID_MESSAGEAREA 16 -#define SRMSGSET_BKGCOLOUR "BkgColour" +#define SRMSGSET_BKGCOLOUR "BkgColour" #define SRMSGSET_INPBKGCOLOUR "inputbg" #define SRMSGDEFSET_BKGCOLOUR GetSysColor(COLOR_WINDOW) #define FONTF_BOLD 1 @@ -63,11 +63,11 @@ int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam); -#define SMS_READ "/ReadSms" -#define SMS_READ_ACK "/ReadSmsAck" -#define SMS_SEND "/SendSMS" -#define SMS_SEND_STR LPGENT("Send &SMS...") -#define SMS_SEND_CM_STR LPGENT("&SMS Message") +#define SMS_READ "/ReadSms" +#define SMS_READ_ACK "/ReadSmsAck" +#define SMS_SEND "/SendSMS" +#define SMS_SEND_STR LPGENT("Send &SMS...") +#define SMS_SEND_CM_STR LPGENT("&SMS Message") // структура содержащая информацию о сервисах/функциях struct SERVICE_ITEM diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index 6ab752776a..8e77708bd0 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -64,8 +64,8 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) dbei.szModule=GetModuleName(hContact); dbei.timestamp=time(NULL); - dbei.flags=(DBEF_UTF); - dbei.eventType=ICQEVENTTYPE_SMS; + dbei.flags = DBEF_UTF; + dbei.eventType = ICQEVENTTYPE_SMS; 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; @@ -94,7 +94,8 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) dbei.cbSize=sizeof(dbei); dbei.szModule=GetModuleName(hContact); dbei.timestamp=time(NULL); - dbei.eventType=ICQEVENTTYPE_SMSCONFIRMATION; + dbei.flags = DBEF_UTF; + dbei.eventType = ICQEVENTTYPE_SMSCONFIRMATION; if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszData,dwDataSize,"yes",3)==CSTR_EQUAL) { dbei.cbBlob=(MAX_PHONE_LEN+MAX_PATH); diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index db1cdf4093..2465635c36 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -117,6 +117,8 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l GetWindowRect(hWndDlg,&rcWin); cx = rcWin.right - rcWin.left; cy = rcWin.bottom - rcWin.top; + cx -= 10; /* XXX: fix window sizes for aero. */ + cy -= 10; SetWindowPos(GetDlgItem(hWndDlg,IDC_MESSAGE),0,0,0,cx - 14,cy - 112,SWP_NOZORDER|SWP_NOMOVE); SetWindowPos(GetDlgItem(hWndDlg,IDC_NAME),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE); SetWindowPos(GetDlgItem(hWndDlg,IDC_NUMBER),0,cx - (cx*35)/100 - 11,5,(cx*35)/100,20,SWP_NOZORDER); diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index b5a6285382..3f2d7f3543 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -181,12 +181,14 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l GetWindowRect(hWndDlg,&rcWin); if (psswdWindowData->bMultiple) { - cx=rcWin.right-rcWin.left-181; - cy=rcWin.bottom-rcWin.top; + cx = rcWin.right-rcWin.left-181; + cy = rcWin.bottom-rcWin.top; }else{ - cx=rcWin.right-rcWin.left; - cy=rcWin.bottom-rcWin.top; + cx = rcWin.right-rcWin.left; + cy = rcWin.bottom-rcWin.top; } + cx -= 10; /* XXX: fix window sizes for aero. */ + cy -= 10; SetWindowPos(GetDlgItem(hWndDlg,IDC_MESSAGE),0,0,0,cx - 14,cy - 132,SWP_NOZORDER|SWP_NOMOVE); SetWindowPos(GetDlgItem(hWndDlg,IDC_NAME),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE); SetWindowPos(GetDlgItem(hWndDlg,IDC_ACCOUNTS),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE); -- cgit v1.2.3