diff options
author | George Hazan <ghazan@miranda.im> | 2020-05-03 15:12:11 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-05-03 15:12:11 +0300 |
commit | 1592aaa2eb5fb9536d651cda57cc0006f2d57134 (patch) | |
tree | 72014f2830b6065f1790b26f8d700b7774bacdd9 | |
parent | e85b4c67372900013faa7793db0f7e664d5bca2e (diff) |
fixes #2376 (Jabber: Add XEP-0319 support, XEP-0256 support discontinued)
-rwxr-xr-x | protocols/JabberG/src/jabber_caps.h | 3 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_thread.cpp | 12 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_util.cpp | 8 |
3 files changed, 19 insertions, 4 deletions
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index 8da657548c..448c20952c 100755 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -196,7 +196,8 @@ typedef unsigned __int64 JabberCapsBits; #define JABBER_FEAT_BIND "urn:ietf:params:xml:ns:xmpp-bind"
#define JABBER_FEAT_CAPTCHA "urn:xmpp:captcha"
#define JABBER_FEAT_CSI "urn:xmpp:csi:0"
-#define JABBER_FEAT_JUD "jabber:iq:search"
+#define JABBER_FEAT_JUD "jabber:iq:search"
+#define JABBER_FEAT_IDLE "urn:xmpp:idle:1"
#define JABBER_FEAT_SERVER_AVATAR "storage:client:avatar"
#define JABBER_FEAT_UPLOAD "urn:xmpp:http:upload"
#define JABBER_FEAT_UPLOAD0 "urn:xmpp:http:upload:0"
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index abc46ca6a2..e10d285b74 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1571,14 +1571,24 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info) else if (!mir_strcmp(show, "chat")) status = ID_STATUS_FREECHAT;
}
+ int idleTime = 0;
+ if (auto *idle = XmlGetChildByTag(node, "idle", "xmlns", JABBER_FEAT_IDLE)) {
+ status = ID_STATUS_IDLE;
+ if (auto *szSince = XmlGetAttr(idle, "since"))
+ idleTime = str2time(szSince);
+ }
+
int priority = XmlGetChildInt(node, "priority");
const char *pszStatus = XmlGetChildText(node, "status");
ListAddResource(LIST_ROSTER, from, status, pszStatus, priority);
// XEP-0115: Entity Capabilities
pResourceStatus r(ResourceInfoFromJID(from));
- if (r != nullptr)
+ if (r != nullptr) {
+ if (idleTime)
+ r->m_dwIdleStartTime = idleTime;
OnProcessPresenceCapabilites(node, r);
+ }
UpdateJidDbSettings(from);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index ec09d029ec..6a079d734e 100755 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -439,8 +439,12 @@ void CJabberProto::SendPresenceTo(int status, const char *to, const TiXmlElement }
}
- if (m_tmJabberIdleStartTime)
- p << XQUERY(JABBER_FEAT_LAST_ACTIVITY) << XATTRI("seconds", time(0) - m_tmJabberIdleStartTime);
+ if (m_tmJabberIdleStartTime) {
+ // XEP-0319 support
+ char szSince[100];
+ time2str(m_tmJabberIdleStartTime, szSince, _countof(szSince));
+ p << XCHILDNS("idle", JABBER_FEAT_IDLE) << XATTR("since", szSince);
+ }
if (m_bEnableAvatars) {
TiXmlElement *x = p << XCHILDNS("x", "vcard-temp:x:update");
|