diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-10 19:01:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-10 19:01:23 +0300 |
commit | c98ff02a2e28c4f720bacc642d674bd90762ac34 (patch) | |
tree | d73d2651be7c77b0caf17b1c0dc1ff04491ad01d /protocols/ICQ-WIM | |
parent | 8a241ad63bf5d3ed0ac1d30dc9e257ca2b60d23e (diff) |
ICQ-WIM: fix for retrieving info in large contact lists
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 33 |
2 files changed, 28 insertions, 7 deletions
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 564865f7db..dd241ad8fa 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -169,6 +169,8 @@ class CIcqProto : public PROTO<CIcqProto> LIST<IcqCacheItem> arMarkReadQueue; static void CALLBACK MarkReadTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD); + AsyncHttpRequest* UserInfoRequest(MCONTACT); + __int64 getId(MCONTACT hContact, const char *szSetting); void setId(MCONTACT hContact, const char *szSetting, __int64 iValue); diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 1144df6b4b..920e826f78 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -423,17 +423,36 @@ bool CIcqProto::RefreshRobustToken() void CIcqProto::RetrieveUserInfo(MCONTACT hContact) { + auto *pReq = UserInfoRequest(hContact); + + if (hContact == INVALID_CONTACT_ID) { + int i = 0; + for (auto &it : m_arCache) { + if (i == 0) + pReq = UserInfoRequest(hContact); + + pReq << WCHAR_PARAM("t", GetUserId(it->m_hContact)); + if (i == 100) { + i = 0; + Push(pReq); + + pReq = UserInfoRequest(hContact); + } + else i++; + } + } + else pReq << WCHAR_PARAM("t", GetUserId(hContact)); + + Push(pReq); +} + +AsyncHttpRequest* CIcqProto::UserInfoRequest(MCONTACT hContact) +{ auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/presence/get", &CIcqProto::OnGetUserInfo); pReq->flags |= NLHRF_NODUMPSEND; pReq->hContact = hContact; pReq << CHAR_PARAM("f", "json") << CHAR_PARAM("aimsid", m_aimsid) << INT_PARAM("mdir", 1) << INT_PARAM("capabilities", 1); - if (hContact == INVALID_CONTACT_ID) - for (auto &it : m_arCache) - pReq << WCHAR_PARAM("t", GetUserId(it->m_hContact)); - else - pReq << WCHAR_PARAM("t", GetUserId(hContact)); - - Push(pReq); + return pReq; } void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId, __int64 endMsgId) |