summaryrefslogtreecommitdiff
path: root/protocols/MSN
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/MSN')
-rw-r--r--protocols/MSN/msn_global.h2
-rw-r--r--protocols/MSN/msn_http.cpp18
-rw-r--r--protocols/MSN/msn_threads.cpp13
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);