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 --- protocols/MRA/src/MraProto.h | 4 ++-- protocols/MRA/src/MraSendCommand.cpp | 12 +++++++----- protocols/MRA/src/Mra_functions.cpp | 4 ++-- protocols/MRA/src/Mra_menus.cpp | 15 --------------- protocols/MRA/src/Mra_proto.cpp | 14 +++++--------- protocols/MRA/src/Mra_svcs.cpp | 15 +++++++++++++++ 6 files changed, 31 insertions(+), 33 deletions(-) (limited to 'protocols/MRA/src') diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index fe54da40f7..690e19e563 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -120,14 +120,14 @@ struct CMraProto : public PROTO INT_PTR __cdecl MraSetListeningTo(WPARAM, LPARAM); + INT_PTR __cdecl MraSendSMS(WPARAM, LPARAM); + INT_PTR __cdecl MraSendNudge(WPARAM, LPARAM); INT_PTR __cdecl MraGetAvatarCaps(WPARAM, LPARAM); INT_PTR __cdecl MraGetAvatarInfo(WPARAM, LPARAM); INT_PTR __cdecl MraGetMyAvatar(WPARAM, LPARAM); - INT_PTR __cdecl MraSendSMS(WPARAM, LPARAM); - INT_PTR __cdecl MraGotoInbox(WPARAM, LPARAM); INT_PTR __cdecl MraShowInboxStatus(WPARAM, LPARAM); INT_PTR __cdecl MraEditProfile(WPARAM, LPARAM); diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 37341ba126..ed502a3cd9 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -443,14 +443,16 @@ DWORD CMraProto::MraSMSW(MCONTACT hContact, const CMStringA &lpszPhone, const CM { CMStringA szPhoneLocal = "+" + CopyNumber(lpszPhone); - OutBuffer buf, buf2; + OutBuffer buf; buf.SetUL(0); buf.SetLPS(szPhoneLocal); buf.SetLPSW(lpwszMessage); - buf2.SetLPS(szPhoneLocal); - buf.SetLPSW(lpwszMessage); - return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ICQACKTYPE_SMS, buf2.Data(), buf2.Len(), MRIM_CS_SMS, buf.Data(), buf.Len()); + LPBYTE lpbData = (LPBYTE)mir_calloc(lpszPhone.GetLength() + sizeof(size_t)); + if (NULL == lpbData) + return (0); + memcpy(lpbData, lpszPhone, lpszPhone.GetLength()); + return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ICQACKTYPE_SMS, lpbData, lpszPhone.GetLength(), MRIM_CS_SMS, buf.Data(), buf.Len()); } // Соединение с прокси @@ -498,7 +500,7 @@ DWORD CMraProto::MraChangeUserBlogStatus(DWORD dwFlags, const CMStringW &wszText DWORD CMraProto::MraSendPacket(HANDLE m_hConnection, DWORD dwCMDNum, DWORD dwType, LPVOID lpData, size_t dwDataSize) { - LPBYTE lpbData = (LPBYTE)_alloca(dwDataSize+sizeof(mrim_packet_header_t)); + LPBYTE lpbData = (LPBYTE)_alloca(dwDataSize + sizeof(mrim_packet_header_t)); mrim_packet_header_t *pmaHeader = (mrim_packet_header_t*)lpbData; memset(pmaHeader, 0, sizeof(mrim_packet_header_t)); diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 22def539cd..56d22b66a5 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1455,7 +1455,7 @@ static const size_t dwXMLSymbolsCount[] = { sizeof(TCHAR), sizeof(TCHAR), sizeof //Decode XML coded string. The function translate special xml code into standard characters. CMStringW DecodeXML(const CMStringW &lptszMessage) { - CMStringW ret('\0', lptszMessage.GetLength()); + CMStringW ret('\0', (lptszMessage.GetLength() * 4)); ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), SIZEOF(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, ret); return ret; } @@ -1463,7 +1463,7 @@ CMStringW DecodeXML(const CMStringW &lptszMessage) //Encode XML coded string. The function translate special saved xml characters into special characters. CMStringW EncodeXML(const CMStringW &lptszMessage) { - CMStringW ret; + CMStringW ret('\0', (lptszMessage.GetLength() * 4)); ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), SIZEOF(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret); return ret; } diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index c1a0261516..d8dc3c9e33 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -13,21 +13,6 @@ INT_PTR CMraProto::MraShowInboxStatus(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR CMraProto::MraSendSMS(WPARAM wParam, LPARAM lParam) -{ - if (!m_bLoggedIn || !wParam || !lParam) - return 0; - - ptrW lpwszMessageXMLEncoded(mir_utf8decodeW((LPSTR)lParam)); - if (lpwszMessageXMLEncoded) { - CMStringW decoded = DecodeXML(CMStringW(lpwszMessageXMLEncoded)); - if (decoded.GetLength()) - MraSMSW(NULL, CMStringA((LPSTR)wParam), decoded); - } - - return 0; -} - INT_PTR CMraProto::MraEditProfile(WPARAM wParam, LPARAM lParam) { MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_EDIT_PROFILE_URL); diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 9fcea8eeb0..e1840dc275 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -1520,19 +1520,15 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader) case MRIM_CS_SMS_ACK: buf >> dwTemp; if (MraSendQueueFind(hSendQueueHandle, pmaHeader->seq, NULL, &hContact, &dwAckType, &pByte, &dwSize) == NO_ERROR) { + /* pByte point to phone number ansi string. */ + /* dwAckType = ICQACKTYPE_SMS */ CMStringA szEmail; if (mraGetStringA(NULL, "e-mail", szEmail)) { - DWORD dwPhoneSize = *(DWORD*)pByte; - DWORD dwMessageSize = dwSize - (dwPhoneSize + sizeof(DWORD)+2); - LPSTR lpszPhone = (LPSTR)pByte + sizeof(DWORD); - LPWSTR lpwszMessage = (LPWSTR)(lpszPhone + dwPhoneSize + 1); - - mir_snprintf((LPSTR)szBuff, SIZEOF(szBuff), + mir_snprintf((LPSTR)szBuff, sizeof(szBuff), "Mail.ruYesMail.ru, Russia%s-1-1955988055-%s%s0\r\n", - szEmail.c_str(), lpszPhone, lpszPhone); - ProtoBroadcastAck(NULL, dwAckType, ACKRESULT_SENTREQUEST, (HANDLE)pmaHeader->seq, (LPARAM)szBuff); + szEmail.c_str(), (LPSTR)pByte, (LPSTR)pByte); + ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SENTREQUEST, (HANDLE)pmaHeader->seq, (LPARAM)szBuff); } - mir_free(pByte); MraSendQueueFree(hSendQueueHandle, pmaHeader->seq); } diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 1ffb37e18e..73b1401a55 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -542,6 +542,21 @@ DWORD CMraProto::MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const C return 0; } +INT_PTR CMraProto::MraSendSMS(WPARAM wParam, LPARAM lParam) +{ + if (!m_bLoggedIn || !wParam || !lParam) + return 0; + + ptrW lpwszMessageXMLEncoded(mir_utf8decodeW((LPSTR)lParam)); + if (lpwszMessageXMLEncoded) { + CMStringW decoded = DecodeXML(CMStringW(lpwszMessageXMLEncoded)); + if (decoded.GetLength()) + return (MraSMSW(NULL, CMStringA((LPSTR)wParam), decoded)); + } + + return 0; +} + INT_PTR CMraProto::MraSendNudge(WPARAM hContact, LPARAM lParam) { if (m_bLoggedIn && hContact) { -- cgit v1.2.3