summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-08-10 22:55:51 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-08-10 22:55:51 +0300
commit67632f24c08ee19cc80bf08bb4bcd387d3e6b042 (patch)
treeef41d3468b5275b97039247e97c5221bfd060150 /protocols
parent84432de6088e2f929585ba425c0e02b728969f0e (diff)
Jabber:
- fix for partially supported XEP-0115; - unused methods removed
Diffstat (limited to 'protocols')
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.cpp53
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.h8
2 files changed, 22 insertions, 39 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 4c5afa7a3e..bf1979cb11 100755
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -122,23 +122,28 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
// no XEP-0115 support?
if (r) {
- if (!r->m_pCaps) {
+ CJabberClientPartialCaps *pCaps = r->m_pCaps;
+ if (pCaps == nullptr) {
r->m_jcbCachedCaps = jcbCaps;
r->m_dwDiscoInfoRequestTime = -1;
return;
}
+ HXML identity;
+ for (int i = 1; (identity = XmlGetNthChild(query, L"identity", i)) != nullptr; i++) {
+ const wchar_t *identityName = XmlGetAttrValue(identity, L"name");
+ if (identityName)
+ pCaps->SetVer(identityName);
+ }
+
HXML xform;
for (int i = 1; (xform = XmlGetNthChild(query, L"x", i)) != NULL; i++) {
wchar_t *szFormTypeValue = XPath(xform, L"field[@var='FORM_TYPE']/value");
if (!mir_wstrcmp(szFormTypeValue, L"urn:xmpp:dataforms:softwareinfo"))
- r->m_pCaps->Parse(xform);
+ pCaps->Parse(xform);
}
- JabberUserInfoUpdate(pInfo->GetHContact());
-
- if (!m_clientCapsManager.SetClientCaps(pInfo->GetIqId(), jcbCaps))
- r->m_jcbCachedCaps = jcbCaps;
+ pCaps->SetCaps(jcbCaps, pInfo->GetIqId());
UpdateMirVer(pInfo->GetHContact(), r);
}
@@ -146,12 +151,13 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
JabberUserInfoUpdate(pInfo->GetHContact());
}
else {
- // no version info support and no XEP-0115 support?
- if (r && !r->m_pCaps) {
- r->m_jcbCachedCaps = JABBER_RESOURCE_CAPS_NONE;
- r->m_dwDiscoInfoRequestTime = -1;
+ if (r) {
+ if (!r->m_pCaps) { // no XEP-0115 support?
+ r->m_jcbCachedCaps = JABBER_RESOURCE_CAPS_NONE;
+ r->m_dwDiscoInfoRequestTime = -1;
+ }
+ else r->m_pCaps->SetCaps(JABBER_RESOURCE_CAPS_ERROR);
}
- else m_clientCapsManager.SetClientCaps(pInfo->GetIqId(), JABBER_RESOURCE_CAPS_ERROR);
}
}
@@ -390,16 +396,6 @@ CJabberClientPartialCaps* CJabberClientCaps::SetPartialCaps(const wchar_t *szHas
return pCaps;
}
-CJabberClientPartialCaps* CJabberClientCaps::SetPartialCaps(int nIqId, JabberCapsBits jcbCaps)
-{
- CJabberClientPartialCaps *pCaps = FindById(nIqId);
- if (!pCaps)
- return nullptr;
-
- pCaps->SetCaps(jcbCaps, -1);
- return pCaps;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// CJabberClientCapsManager class
@@ -520,21 +516,6 @@ CJabberClientPartialCaps* CJabberClientCapsManager::SetClientCaps(const wchar_t
return res;
}
-CJabberClientPartialCaps* CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps)
-{
- mir_cslock lck(m_cs);
-
- for (int i = 0; i < m_arCaps.getCount(); i++) {
- CJabberClientCaps &p = m_arCaps[i];
- CJabberClientPartialCaps *res = p.SetPartialCaps(nIqId, jcbCaps);
- if (res != nullptr) {
- ppro->debugLogA("CAPS: set caps %I64x for iq %d", jcbCaps, nIqId);
- return res;
- }
- }
- return nullptr;
-}
-
bool CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode)
{
int i;
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h
index eaf9875891..70f1ff188c 100755
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -240,6 +240,11 @@ public:
__inline const wchar_t* GetSoftMir() const { return m_szSoftMir.get(); }
__inline int GetIqId() const { return m_nIqId; }
+
+ __inline void SetVer(const wchar_t *szVer)
+ {
+ m_szSoft = mir_wstrdup(szVer);
+ }
};
class CJabberClientCaps
@@ -256,7 +261,6 @@ public:
JabberCapsBits GetPartialCaps(const wchar_t *szVer);
CJabberClientPartialCaps* SetPartialCaps(const wchar_t *szHash, const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId = -1);
- CJabberClientPartialCaps* SetPartialCaps(int nIqId, JabberCapsBits jcbCaps);
__inline wchar_t* GetNode() const { return m_szNode; }
};
@@ -286,8 +290,6 @@ public:
CJabberClientPartialCaps* GetPartialCaps(const wchar_t *szNode, const wchar_t *szHash);
CJabberClientPartialCaps* SetClientCaps(const wchar_t *szNode, const wchar_t *szHash, const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId = -1);
- CJabberClientPartialCaps* SetClientCaps(int nIqId, JabberCapsBits jcbCaps);
-
__inline CJabberClientPartialCaps* SetOwnCaps(const wchar_t *szNode, const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId = -1)
{
return SetClientCaps(szNode, m_szFeaturesCrc, szVer, jcbCaps, nIqId);