diff options
Diffstat (limited to 'protocols')
-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) |