From ee58369830f5e7e07075952b24a64759cddd8faa Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 30 Nov 2023 20:27:45 +0300 Subject: =?UTF-8?q?fixes=20#3967=20(ICQ:=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D1=80=20"=D0=92=20=D1=81=D0=B5=D1=82=D0=B8=20?= =?UTF-8?q?=D1=81"=20=D0=B1=D0=B5=D1=81=D0=BF=D0=BE=D0=BB=D0=B5=D0=B7?= =?UTF-8?q?=D0=B5=D0=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/ICQ-WIM/src/server.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'protocols/ICQ-WIM/src/server.cpp') diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index c27e1f4429..a03dfaddf0 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -417,12 +417,6 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact, boo // we shall not remove existing phone number anyhow Json2string(hContact, buddy, "phoneNumber", DB_KEY_PHONE, true); - int onlineTime = buddy["onlineTime"].as_int(); - if (onlineTime) - setDword(hContact, DB_KEY_ONLINETS, time(0) - onlineTime); - else - delSetting(hContact, DB_KEY_ONLINETS); - Json2int(hContact, buddy, "official", "Official", bIsPartial); Json2int(hContact, buddy, "idleTime", "IdleTS", bIsPartial); @@ -717,6 +711,30 @@ void CIcqProto::RetrieveUserCaps(IcqUser *pUser) ///////////////////////////////////////////////////////////////////////////////////////// +void CIcqProto::OnGePresence(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) +{ + JsonReply root(pReply); + if (root.error() != 200) + return; + + auto &data = root.data(); + for (auto &it : data["users"]) + ProcessOnline(it, pReq->hContact); +} + +void CIcqProto::RetrievePresence(MCONTACT hContact) +{ + CMStringW wszId(GetUserId(hContact)); + + auto *pReq = new AsyncHttpRequest(CONN_OLD, REQUEST_GET, "/presence/get", &CIcqProto::OnGePresence); + pReq->hContact = hContact; + pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", appId()) << CHAR_PARAM("r", pReq->m_reqId) + << WCHAR_PARAM("t", wszId) << INT_PARAM("mdir", 1); + Push(pReq); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CIcqProto::OnGetUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) { RobustReply root(pReply); -- cgit v1.2.3