diff options
author | George Hazan <george.hazan@gmail.com> | 2012-09-16 16:18:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-09-16 16:18:46 +0000 |
commit | 7eb813e28f5b94886487cfd6e3c916eeb96c8dee (patch) | |
tree | 78ac2b8f99608779ebe274a19f95e2e91f553d12 /protocols | |
parent | 39c4a49dbfa7fd2e7bce9b7c56c91dceae726542 (diff) |
- fix for double auth req
- packet logging added
git-svn-id: http://svn.miranda-ng.org/main/trunk@1581 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/MRA/MraProto.cpp | 18 | ||||
-rw-r--r-- | protocols/MRA/MraSendCommand.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/Mra_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/Mra_svcs.cpp | 18 |
4 files changed, 25 insertions, 19 deletions
diff --git a/protocols/MRA/MraProto.cpp b/protocols/MRA/MraProto.cpp index 8f758e9b6b..08a4092e57 100644 --- a/protocols/MRA/MraProto.cpp +++ b/protocols/MRA/MraProto.cpp @@ -348,24 +348,6 @@ int CMraProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) int CMraProto::AuthRequest(HANDLE hContact, const TCHAR *lptszMessage)
{
- if (!m_bLoggedIn )
- return 1;
-
- CHAR szEMail[MAX_EMAIL_LEN];
- size_t dwEMailSize, dwMessageSize;
-
- dwMessageSize = lstrlen(lptszMessage);
- if (dwMessageSize) {
- if (mraGetStaticStringA(hContact, "e-mail", szEMail, SIZEOF(szEMail), &dwEMailSize)) {
- BOOL bSlowSend = mraGetByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND);
- int iRet = MraMessageW(bSlowSend, hContact, ACKTYPE_AUTHREQ, MESSAGE_FLAG_AUTHORIZE, szEMail, dwEMailSize, lptszMessage, dwMessageSize, NULL, 0);
- if (bSlowSend == FALSE)
- ProtoBroadcastAckAsynchEx(hContact, ACKTYPE_AUTHREQ, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)NULL, 0);
-
- return 0;
- }
- }
-
return 1;
}
diff --git a/protocols/MRA/MraSendCommand.cpp b/protocols/MRA/MraSendCommand.cpp index f192afe889..2d56edb6b7 100644 --- a/protocols/MRA/MraSendCommand.cpp +++ b/protocols/MRA/MraSendCommand.cpp @@ -67,6 +67,8 @@ static void SetLPSLowerCaseW(LPBYTE *plpBuff, LPCWSTR lpwszData, DWORD dwSize) DWORD CMraProto::MraMessageW(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, DWORD dwFlags, LPSTR lpszEMail, size_t dwEMailSize, LPCWSTR lpwszMessage, size_t dwMessageSize, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize)
{
+ Netlib_Logf(hNetlibUser, "Sending message: flags %08x, to '%S', message '%S'\n", dwFlags, lpszEMail, lpwszMessage);
+
DWORD dwRet = 0;
LPBYTE lpbData, lpbDataCurrent;
LPSTR lpszMessageConverted = (LPSTR)lpwszMessage;
@@ -661,6 +663,8 @@ DWORD CMraProto::MraSendPacket(HANDLE hConnection, DWORD dwCMDNum, DWORD dwType, pmaHeader->msg = dwType;// Тип пакета
pmaHeader->dlen = dwDataSize;// Длина данных
+ Netlib_Logf(hNetlibUser, "Sending packet %08x\n", dwType);
+
memmove((lpbData+sizeof(mrim_packet_header_t)), lpData, dwDataSize);
dwRet = Netlib_Send(hConnection, (LPSTR)lpbData, (dwDataSize+sizeof(mrim_packet_header_t)), 0);
mir_free(lpbData);
diff --git a/protocols/MRA/Mra_proto.cpp b/protocols/MRA/Mra_proto.cpp index 91ac4f9d0e..638f61d8f0 100644 --- a/protocols/MRA/Mra_proto.cpp +++ b/protocols/MRA/Mra_proto.cpp @@ -386,6 +386,8 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd lpbDataCurrent = lpbData;
dwDataSize = pmaHeader->dlen;
+ Netlib_Logf(hNetlibUser, "Received packet %x\n", pmaHeader->msg);
+
switch (pmaHeader->msg) {
case MRIM_CS_HELLO_ACK://Подтверждение установки соединения// UL ## ping_period ## Ожидаемая частота подтверждения соединения (в секундах)
//bit of a security hole here, since it's easy to extract a password from an edit box
@@ -1874,6 +1876,8 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl }
}
+ Netlib_Logf(hNetlibUser, "Processing message: %08X, from '%s', text '%S'\n", dwFlags, plpsFrom->lpszData, lpwszMessage);
+
// processing
if (dwRetErrorCode == NO_ERROR)
if (MraAntiSpamReceivedMessageW(plpsFrom->lpszData, plpsFrom->dwSize, dwFlags, lpwszMessage, dwMessageSize) == MESSAGE_NOT_SPAM) {
diff --git a/protocols/MRA/Mra_svcs.cpp b/protocols/MRA/Mra_svcs.cpp index 2c10934b7e..426343ebbd 100644 --- a/protocols/MRA/Mra_svcs.cpp +++ b/protocols/MRA/Mra_svcs.cpp @@ -357,7 +357,23 @@ INT_PTR CMraProto::MraRequestAuthorization(WPARAM wParam, LPARAM lParam) if (mraGetStaticStringW(NULL, "AuthMessage", wszAuthMessage, SIZEOF(wszAuthMessage), NULL) == FALSE)
lstrcpynW(wszAuthMessage, TranslateW(MRA_DEFAULT_AUTH_MESSAGE), SIZEOF(wszAuthMessage));
- return AuthRequest((HANDLE)wParam, wszAuthMessage);
+ CHAR szEMail[MAX_EMAIL_LEN];
+ size_t dwEMailSize, dwMessageSize;
+
+ dwMessageSize = lstrlen(wszAuthMessage);
+ if (dwMessageSize) {
+ HANDLE hContact = (HANDLE)wParam;
+ if ( mraGetStaticStringA(hContact, "e-mail", szEMail, SIZEOF(szEMail), &dwEMailSize)) {
+ BOOL bSlowSend = mraGetByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND);
+ int iRet = MraMessageW(bSlowSend, hContact, ACKTYPE_AUTHREQ, MESSAGE_FLAG_AUTHORIZE, szEMail, dwEMailSize, wszAuthMessage, dwMessageSize, NULL, 0);
+ if (bSlowSend == FALSE)
+ ProtoBroadcastAckAsynchEx(hContact, ACKTYPE_AUTHREQ, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)NULL, 0);
+
+ return 0;
+ }
+ }
+
+ return 1;
}
return 0;
}
|