summaryrefslogtreecommitdiff
path: root/protocols/MRA
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-03-06 01:16:01 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-03-06 01:16:01 +0000
commit522586d7b8f7274fad2fe58c2615fc0d06618fcd (patch)
tree0a1e22eacb864e035af10f11021816d83163d974 /protocols/MRA
parentd5adcdbd5c1fda81f1be805dadc8021837ed706d (diff)
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
Diffstat (limited to 'protocols/MRA')
-rw-r--r--protocols/MRA/src/MraProto.h4
-rw-r--r--protocols/MRA/src/MraSendCommand.cpp12
-rw-r--r--protocols/MRA/src/Mra_functions.cpp4
-rw-r--r--protocols/MRA/src/Mra_menus.cpp15
-rw-r--r--protocols/MRA/src/Mra_proto.cpp14
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp15
6 files changed, 31 insertions, 33 deletions
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<CMraProto>
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),
"<sms_response><source>Mail.ru</source><deliverable>Yes</deliverable><network>Mail.ru, Russia</network><message_id>%s-1-1955988055-%s</message_id><destination>%s</destination><messages_left>0</messages_left></sms_response>\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) {