summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_caps.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-10-13 00:38:23 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-10-13 00:38:32 +0300
commit196e01a2ca9f8aefbd3ac55eedc955f56d3d6428 (patch)
treee7695abc56934941307ffb58cf76ec72b8dfcb44 /protocols/JabberG/src/jabber_caps.cpp
parent6da03d864d6f778c6d6cbab4229675f276036b79 (diff)
fixes #987 (more fixes for clients that don't support XEP-0115)
Diffstat (limited to 'protocols/JabberG/src/jabber_caps.cpp')
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 3c716018a4..baf87bfce2 100755
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -299,16 +299,39 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, bool app
return r->m_jcbCachedCaps;
case 0:
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
- pInfo->SetTimeout(JABBER_RESOURCE_CAPS_QUERY_TIMEOUT);
- r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
-
- m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO));
+ RequestOldCapsInfo(r, fullJid);
break;
}
return JABBER_RESOURCE_CAPS_IN_PROGRESS;
}
+void CJabberProto::RequestOldCapsInfo(pResourceStatus &r, const wchar_t *fullJid)
+{
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
+ pInfo->SetTimeout(JABBER_RESOURCE_CAPS_QUERY_TIMEOUT);
+ r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
+
+ m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO));
+}
+
+void CJabberProto::GetCachedCaps(const wchar_t *szNode, const wchar_t *szVer, pResourceStatus &r)
+{
+ CMStringA szName(FORMAT, "%S#%S", szNode, szVer);
+ ptrA szValue(db_get_sa(0, "JabberCaps", szName));
+ if (szValue != 0) {
+ JSONNode root = JSONNode::parse(szValue);
+ if (root) {
+ CMStringW wszCaps = root["c"].as_mstring();
+ r->m_pCaps = m_clientCapsManager.SetClientCaps(szNode, szVer, nullptr, _wtoi64(wszCaps));
+ r->m_pCaps->m_szOs = mir_wstrdup(root["o"].as_mstring());
+ r->m_pCaps->m_szOsVer = mir_wstrdup(root["ov"].as_mstring());
+ r->m_pCaps->m_szSoft = mir_wstrdup(root["s"].as_mstring());
+ r->m_pCaps->m_szSoftVer = mir_wstrdup(root["sv"].as_mstring());
+ r->m_pCaps->m_szSoftMir = mir_wstrdup(root["sm"].as_mstring());
+ }
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// CJabberClientPartialCaps class