diff options
author | George Hazan <ghazan@miranda.im> | 2020-10-28 19:03:01 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-10-28 19:03:01 +0300 |
commit | 21aaad51c5e0bcf7157bd8e37e6e8ee0d1e55525 (patch) | |
tree | aa87b18bcf00431ae2bacf6ca2a0a738efa2ced6 /protocols/JabberG/src/jabber_thread.cpp | |
parent | 005bde628864f2335445aab8c1b8f42d62da25d4 (diff) |
Jabber: we store now server caps in our cache not to rerequest them on each login
Diffstat (limited to 'protocols/JabberG/src/jabber_thread.cpp')
-rwxr-xr-x | protocols/JabberG/src/jabber_thread.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 111ef69fb8..01bdddd0eb 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -612,6 +612,8 @@ void CJabberProto::PerformAuthentication(ThreadData *info) void CJabberProto::OnProcessFeatures(const TiXmlElement *node, ThreadData *info)
{
+ info->jabberServerCaps = JABBER_RESOURCE_CAPS_NONE;
+
bool isRegisterAvailable = false;
bool areMechanismsDefined = false;
@@ -702,6 +704,15 @@ void CJabberProto::OnProcessFeatures(const TiXmlElement *node, ThreadData *info) m_StrmMgmt.CheckStreamFeatures(n);
else if (!mir_strcmp(pszName, "csi") && n->Attribute("xmlns", JABBER_FEAT_CSI))
m_bCisAvailable = true;
+ else if (!mir_strcmp(pszName, "c") && !mir_strcmp(n->Attribute("xmlns"), JABBER_FEAT_ENTITY_CAPS)) {
+ auto *szNode = n->Attribute("node"), *szHash = n->Attribute("ver");
+ auto *pCaps = g_clientCapsManager.GetPartialCaps(szNode, szHash);
+ if (pCaps == nullptr) {
+ CMStringA payLoad(FORMAT, "%s%c%s", szNode, 0, szHash);
+ info->pPendingQuery = AddIQ(&CJabberProto::OnIqResultServerDiscoInfo, JABBER_IQ_TYPE_GET, info->conn.server, payLoad.Detach(), 1);
+ }
+ else info->jabberServerCaps |= pCaps->GetCaps();
+ }
}
if (areMechanismsDefined) {
|