diff options
author | George Hazan <george.hazan@gmail.com> | 2023-07-30 14:21:31 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-07-30 14:21:31 +0300 |
commit | 1a74863d624e2813a9d0009ab98be40f426707ce (patch) | |
tree | f139143bf5e51c33dd03aaa9dca3b1e053ddbf64 /protocols | |
parent | a770c8ead7594b589b3557a4cc97c6bc75badf07 (diff) |
Jabber: fix for storing dynamic features
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/JabberG/src/jabber_caps.cpp | 28 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 1 |
2 files changed, 17 insertions, 12 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 852ba4e935..77a7ed9ac9 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -112,18 +112,9 @@ void CJabberProto::OnIqResultCapsDiscoInfo(const TiXmlElement*, CJabberIqInfo *p if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT && query) {
JabberCapsBits jcbCaps = 0;
- for (auto *feature : TiXmlFilter(query, "feature")) {
- const char *featureName = XmlGetAttr(feature, "var");
- if (!featureName)
- continue;
-
- for (auto &it : g_JabberFeatCapPairs) {
- if (!mir_strcmp(it.szFeature, featureName)) {
- jcbCaps |= it.jcbCap;
- break;
- }
- }
- }
+ for (auto *feature : TiXmlFilter(query, "feature"))
+ if (auto *featureName = XmlGetAttr(feature, "var"))
+ jcbCaps += GetFeatureCaps(featureName);
// no XEP-0115 support? store info & exit
CJabberClientPartialCaps *pCaps = r->m_pCaps;
@@ -329,6 +320,19 @@ bool CJabberProto::HandleCapsInfoRequest(const TiXmlElement *, CJabberIqInfo *pI return true;
}
+JabberCapsBits CJabberProto::GetFeatureCaps(const char *pszFeature)
+{
+ for (auto &it : g_JabberFeatCapPairs)
+ if (!mir_strcmp(it.szFeature, pszFeature))
+ return it.jcbCap;
+
+ for (auto &it : m_lstJabberFeatCapPairsDynamic)
+ if (!mir_strcmp(it->szFeature, pszFeature))
+ return it->jcbCap;
+
+ return 0;
+}
+
JabberCapsBits CJabberProto::GetOwnCaps(bool IncludeDynamic)
{
JabberCapsBits jcb = JABBER_CAPS_MIRANDA_ALL;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index d08408df93..0e568605b6 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -426,6 +426,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void RequestOldCapsInfo(pResourceStatus &r, const char *fullJid);
void UpdateFeatHash();
+ JabberCapsBits GetFeatureCaps(const char *pszFeature);
JabberCapsBits GetTotalJidCapabilities(const char *jid);
JabberCapsBits GetResourceCapabilities(const char *jid);
JabberCapsBits GetResourceCapabilities(const char *jid, pResourceStatus &r);
|