From 4c1143795a4e0ab188e23f89ee456408fdb6da24 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 3 Jun 2012 19:17:51 +0000 Subject: sync git-svn-id: http://svn.miranda-ng.org/main/trunk@286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/icq_menu.cpp | 2 +- protocols/IcqOscarJ/icq_proto.h | 2 -- protocols/IcqOscarJ/icq_servlist.cpp | 22 ---------------------- protocols/MSN/msn_global.h | 2 +- protocols/MSN/msn_http.cpp | 18 ++++++++++++------ protocols/MSN/msn_threads.cpp | 13 +++++++------ 6 files changed, 21 insertions(+), 38 deletions(-) (limited to 'protocols') diff --git a/protocols/IcqOscarJ/icq_menu.cpp b/protocols/IcqOscarJ/icq_menu.cpp index 46da48ad1a..7b62c370f7 100644 --- a/protocols/IcqOscarJ/icq_menu.cpp +++ b/protocols/IcqOscarJ/icq_menu.cpp @@ -240,7 +240,7 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)); } - sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact)); + sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact) != 0); BYTE bXStatus = getContactXStatus((HANDLE)wParam); sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0); diff --git a/protocols/IcqOscarJ/icq_proto.h b/protocols/IcqOscarJ/icq_proto.h index ef33b456f6..329ab4d897 100644 --- a/protocols/IcqOscarJ/icq_proto.h +++ b/protocols/IcqOscarJ/icq_proto.h @@ -735,8 +735,6 @@ struct CIcqProto : public PROTO_INTERFACE DWORD icq_removeServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType); DWORD icq_addServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType); - time_t dwLastCListGroupsChange; - int __cdecl ServListDbSettingChanged(WPARAM wParam, LPARAM lParam); int __cdecl ServListDbContactDeleted(WPARAM wParam, LPARAM lParam); int __cdecl ServListCListGroupChange(WPARAM wParam, LPARAM lParam); diff --git a/protocols/IcqOscarJ/icq_servlist.cpp b/protocols/IcqOscarJ/icq_servlist.cpp index 9da5e3e756..5be3c895d8 100644 --- a/protocols/IcqOscarJ/icq_servlist.cpp +++ b/protocols/IcqOscarJ/icq_servlist.cpp @@ -2667,15 +2667,6 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam; - // We can't upload changes to NULL contact - if ((HANDLE)wParam == NULL) - { // only note last change of CListGroups - contact/group operation detection - if (!strcmpnull(cws->szModule, "CListGroups")) - dwLastCListGroupsChange = time(NULL); - - return 0; - } - // TODO: Queue changes that occur while offline if (!icqOnline() || !m_bSsiEnabled || bIsSyncingCL) return 0; @@ -2689,15 +2680,6 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmpnull(cws->szModule, "CList")) { - // Has a temporary contact just been added permanently? - if (!strcmpnull(cws->szSetting, "NotOnList") && - (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_BYTE && cws->value.bVal == 0))) - { // Add to server-list - setContactHidden((HANDLE)wParam, 0); - if (getSettingByte(NULL, "ServerAddRemove", DEFAULT_SS_ADDSERVER)) - AddServerContact(wParam, 0); - } - // Has contact been renamed? if (!strcmpnull(cws->szSetting, "MyHandle") && getSettingByte(NULL, "StoreServerDetails", DEFAULT_SS_STORE)) @@ -2711,10 +2693,6 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) { // Read group from DB char* szNewGroup = getContactCListGroup((HANDLE)wParam); - // it is contact operation only ? no, if CListGroups was changed less than 10 secs ago - if (szNewGroup && (dwLastCListGroupsChange + 10 < time(NULL))) - servlistMoveContact((HANDLE)wParam, szNewGroup); - SAFE_FREE(&szNewGroup); } } 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); -- cgit v1.2.3