diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-03 19:17:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-03 19:17:51 +0000 |
commit | 4c1143795a4e0ab188e23f89ee456408fdb6da24 (patch) | |
tree | c86c49ab0bceb32a67336805a37dfd1470e8fa02 /protocols/MSN | |
parent | 31ad5a2b294f59b5a64a8e7d8383669baeb7fdd0 (diff) |
sync
git-svn-id: http://svn.miranda-ng.org/main/trunk@286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN')
-rw-r--r-- | protocols/MSN/msn_global.h | 2 | ||||
-rw-r--r-- | protocols/MSN/msn_http.cpp | 18 | ||||
-rw-r--r-- | protocols/MSN/msn_threads.cpp | 13 |
3 files changed, 20 insertions, 13 deletions
diff --git a/protocols/MSN/msn_global.h b/protocols/MSN/msn_global.h index a2c1ba6dd6..0edd856495 100644 --- a/protocols/MSN/msn_global.h +++ b/protocols/MSN/msn_global.h @@ -562,7 +562,7 @@ struct ThreadData //----| methods |---------------------------------------------------------------------
void applyGatewayData(HANDLE hConn, bool isPoll);
void getGatewayUrl(char* dest, int destlen, bool isPoll);
- void processSessionData(const char*);
+ void processSessionData(const char* xMsgr, const char* xHost);
void startThread(MsnThreadFunc , CMsnProto *prt);
int send(const char data[], size_t datalen);
diff --git a/protocols/MSN/msn_http.cpp b/protocols/MSN/msn_http.cpp index cb3b60bbc3..5f727ef30b 100644 --- a/protocols/MSN/msn_http.cpp +++ b/protocols/MSN/msn_http.cpp @@ -82,20 +82,26 @@ PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST* nlhr, PBYTE buf, int len, int if (nlhr->resultCode == 200)
{
+ char *xMsgr = NULL, *xHost = NULL;
+
for (int i=0; i < nlhr->headersCount; i++)
{
NETLIBHTTPHEADER& tHeader = nlhr->headers[i];
- if (_stricmp(tHeader.szName, "X-MSN-Messenger") != 0)
- continue;
+ if (_stricmp(tHeader.szName, "X-MSN-Messenger") == 0)
+ xMsgr = tHeader.szValue;
+ else if (_stricmp(tHeader.szName, "X-MSN-Host") == 0)
+ xHost = tHeader.szValue;
+
+ }
+ if (xMsgr)
+ {
isMsnPacket = true;
- if (strstr(tHeader.szValue, "Session=close") == 0)
+ if (strstr(xMsgr, "Session=close") == 0)
isSessionClosed = false;
- else
- break;
- T->processSessionData(tHeader.szValue);
+ T->processSessionData(xMsgr, xHost);
T->applyGatewayData(nlhr->nlc, false);
}
}
diff --git a/protocols/MSN/msn_threads.cpp b/protocols/MSN/msn_threads.cpp index f312fcdc01..3581f9afad 100644 --- a/protocols/MSN/msn_threads.cpp +++ b/protocols/MSN/msn_threads.cpp @@ -747,24 +747,25 @@ void ThreadData::getGatewayUrl(char* dest, int destlen, bool isPoll) mir_snprintf(dest, destlen, isPoll ? pollFmtStr : cmdFmtStr, mGatewayIP, mSessionID);
}
-void ThreadData::processSessionData(const char* str)
+void ThreadData::processSessionData(const char* xMsgr, const char* xHost)
{
- char tSessionID[40], tGateIP[40];
+ char tSessionID[40], tGateIP[80];
- char* tDelim = (char*)strchr(str, ';');
+ char* tDelim = (char*)strchr(xMsgr, ';');
if (tDelim == NULL)
return;
*tDelim = 0; tDelim += 2;
- if (!sscanf(str, "SessionID=%s", tSessionID))
+ if (!sscanf(xMsgr, "SessionID=%s", tSessionID))
return;
char* tDelim2 = strchr(tDelim, ';');
if (tDelim2 != NULL)
*tDelim2 = '\0';
-
- if (!sscanf(tDelim, "GW-IP=%s", tGateIP))
+ if (xHost)
+ strcpy(tGateIP, xHost);
+ else if (!sscanf(tDelim, "GW-IP=%s", tGateIP))
return;
strcpy(mGatewayIP, tGateIP);
|