diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-30 20:27:45 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-30 20:27:45 +0300 |
commit | ee58369830f5e7e07075952b24a64759cddd8faa (patch) | |
tree | e4411ab1995aeb304caa94c161f9fe830a217fdf /protocols/ICQ-WIM/src/server.cpp | |
parent | b4c481c84032871bae26e47ca5f8dc2747a196cb (diff) |
fixes #3967 (ICQ: параметр "В сети с" бесполезен)
Diffstat (limited to 'protocols/ICQ-WIM/src/server.cpp')
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
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);
|