diff options
author | George Hazan <ghazan@miranda.im> | 2022-10-23 17:55:10 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-10-23 17:55:10 +0300 |
commit | e44efd52b62e375eb76bec62b71e83d6b8b23972 (patch) | |
tree | b15ef78b07b0e456e456376f533df4498fddefda /protocols/ICQ-WIM/src | |
parent | 8834935d6dbfd190b0a39ac8f30cce571f08750e (diff) |
fixes #3227 (ICQ: не работает получение инфы о контакте)
Diffstat (limited to 'protocols/ICQ-WIM/src')
-rw-r--r-- | protocols/ICQ-WIM/src/poll.cpp | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 4 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 39 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/utils.cpp | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/version.h | 2 |
5 files changed, 9 insertions, 40 deletions
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index db15c5be6f..d7ca7298ad 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -72,8 +72,6 @@ void CIcqProto::ProcessBuddyList(const JSONNode &ev) for (auto &it : m_arCache) if (!it->m_bInList && !getBool(it->m_hContact, "IcqDeleted")) Contact::RemoveFromList(it->m_hContact); - - RetrieveUserInfo(); } void CIcqProto::ProcessDiff(const JSONNode &ev) diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index fdb8e39307..b909a0d74a 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -264,7 +264,7 @@ class CIcqProto : public PROTO<CIcqProto> void MoveContactToGroup(MCONTACT hContact, const wchar_t *pwszGroup, const wchar_t *pwszNewGroup); bool RetrievePassword(); void RetrieveUserHistory(MCONTACT, __int64 startMsgId, bool bCreateRead); - void RetrieveUserInfo(MCONTACT = INVALID_CONTACT_ID); + void RetrieveUserInfo(MCONTACT hContact); void SendMrimLogin(NETLIBHTTPREQUEST *pReply); void SetServerStatus(int iNewStatus); void ShutdownSession(void); @@ -286,8 +286,6 @@ class CIcqProto : public PROTO<CIcqProto> LIST<IcqCacheItem> m_arMarkReadQueue; void SendMarkRead(); - 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 9795da2c3c..167aabfee9 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -605,35 +605,10 @@ LBL_Error: 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); + auto *pReq = new AsyncRapiRequest(this, "getUserInfo", &CIcqProto::OnGetUserInfo); + pReq->params << WCHAR_PARAM("sn", GetUserId(hContact)); pReq->hContact = hContact; - pReq << AIMSID(this) << INT_PARAM("mdir", 1) << INT_PARAM("capabilities", 1); - return pReq; + Push(pReq); } void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId, bool bCreateRead) @@ -1077,15 +1052,13 @@ void CIcqProto::OnGetUserHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pR void CIcqProto::OnGetUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) { - JsonReply root(pReply); - if (root.error() != 200) { + RobustReply root(pReply); + if (root.error() != 20000) { ProtoBroadcastAck(pReq->hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, nullptr); return; } - auto &data = root.data(); - for (auto &it : data["users"]) - ParseBuddyInfo(it, pReq->hContact); + ParseBuddyInfo(root.results(), pReq->hContact, true); ProtoBroadcastAck(pReq->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr); } diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 98ccc45dfe..4fa65d0302 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -278,7 +278,7 @@ bool IsChat(const CMStringW &aimid) bool IsValidType(const JSONNode &n) { auto type = n["userType"].as_string(); - return type == "icq" || type == "aim" || type == "interop"; + return type == "icq" || type == "aim" || type == "interop" || type == ""; } int CIcqProto::StatusFromPresence(const JSONNode &presence, MCONTACT hContact) diff --git a/protocols/ICQ-WIM/src/version.h b/protocols/ICQ-WIM/src/version.h index bdad28cfc2..d66fea62b5 100644 --- a/protocols/ICQ-WIM/src/version.h +++ b/protocols/ICQ-WIM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 96 #define __RELEASE_NUM 2 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #include <stdver.h> |