diff options
author | George Hazan <ghazan@miranda.im> | 2017-08-16 15:10:53 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-08-16 15:10:53 +0300 |
commit | d8fe65f78ea4f440a53069b43a08ab0000986d56 (patch) | |
tree | 9c865b283307eb3e4c34887eb9f05e84654d156a /protocols/JabberG/src/jabber_caps.cpp | |
parent | ea322d5c50ebfc21df05ced2b592e8ce16115623 (diff) |
Jabber: client info disappears if remote has the same Miranda version as me
Diffstat (limited to 'protocols/JabberG/src/jabber_caps.cpp')
-rwxr-xr-x | protocols/JabberG/src/jabber_caps.cpp | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 6515418513..c04ea943be 100755 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -98,6 +98,26 @@ const JabberFeatCapPairExt g_JabberFeatCapPairsExt[] = { { NULL }
};
+void CJabberProto::AddDefaultCaps()
+{
+ JabberCapsBits myCaps = JABBER_CAPS_MIRANDA_ALL;
+ if (m_options.UseOMEMO)
+ myCaps |= JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
+
+ wchar_t szOsBuffer[256]; szOsBuffer[0] = 0;
+ GetOSDisplayString(szOsBuffer, _countof(szOsBuffer));
+
+ CJabberClientPartialCaps *pCaps = m_clientCapsManager.SetOwnCaps(JABBER_CAPS_MIRANDA_NODE, _T(__VERSION_STRING_DOTS), myCaps);
+ pCaps->m_szOs = mir_wstrdup(L"Microsoft Windows");
+ pCaps->m_szOsVer = mir_wstrdup(szOsBuffer);
+ pCaps->m_szSoft = mir_wstrdup(L"Miranda NG Jabber Protocol");
+ pCaps->m_szSoftMir = mir_wstrdup(szCoreVersion);
+
+ for (int i = 0; g_JabberFeatCapPairsExt[i].szFeature; i++)
+ if (g_JabberFeatCapPairsExt[i].Valid())
+ m_clientCapsManager.SetOwnCaps(JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature, g_JabberFeatCapPairsExt[i].jcbCap);
+}
+
void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
{
pResourceStatus r(ResourceInfoFromJID(pInfo->GetFrom()));
@@ -458,15 +478,6 @@ CJabberClientCaps* CJabberClientCapsManager::FindClient(const wchar_t *szNode) return m_arCaps.find((CJabberClientCaps*)&szNode);
}
-void CJabberClientCapsManager::AddDefaultCaps()
-{
- SetOwnCaps(JABBER_CAPS_MIRANDA_NODE, szCoreVersion, ppro->m_options.UseOMEMO ? (JABBER_CAPS_MIRANDA_ALL | JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY) : JABBER_CAPS_MIRANDA_ALL);
-
- for (int i = 0; g_JabberFeatCapPairsExt[i].szFeature; i++)
- if (g_JabberFeatCapPairsExt[i].Valid())
- SetOwnCaps(JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature, g_JabberFeatCapPairsExt[i].jcbCap);
-}
-
JabberCapsBits CJabberClientCapsManager::GetClientCaps(const wchar_t *szNode, const wchar_t *szVer)
{
mir_cslockfull lck(m_cs);
@@ -575,20 +586,18 @@ LBL_All: query << XCHILD(L"feature") << XATTR(L"var", ppro->m_lstJabberFeatCapPairsDynamic[i]->szFeature);
if (ppro->m_options.AllowVersionRequests && !szNode) {
- wchar_t szOsBuffer[256]; szOsBuffer[0] = 0;
- GetOSDisplayString(szOsBuffer, _countof(szOsBuffer));
-
HXML form = query << XCHILDNS(L"x", JABBER_FEAT_DATA_FORMS) << XATTR(L"type", L"result");
form << XCHILD(L"field") << XATTR(L"var", L"FORM_TYPE") << XATTR(L"type", L"hidden")
<< XCHILD(L"value", L"urn:xmpp:dataforms:softwareinfo");
+ CJabberClientPartialCaps *pCaps = GetPartialCaps(JABBER_CAPS_MIRANDA_NODE, m_szFeaturesCrc);
if (ppro->m_options.ShowOSVersion) {
- form << XCHILD(L"field") << XATTR(L"var", L"os") << XCHILD(L"value", L"Microsoft Windows");
- form << XCHILD(L"field") << XATTR(L"var", L"os_version") << XCHILD(L"value", szOsBuffer);
+ form << XCHILD(L"field") << XATTR(L"var", L"os") << XCHILD(L"value", pCaps->GetOs());
+ form << XCHILD(L"field") << XATTR(L"var", L"os_version") << XCHILD(L"value", pCaps->GetOsVer());
}
- form << XCHILD(L"field") << XATTR(L"var", L"software") << XCHILD(L"value", L"Miranda NG Jabber Protocol");
- form << XCHILD(L"field") << XATTR(L"var", L"software_version") << XCHILD(L"value", _T(__VERSION_STRING_DOTS));
- form << XCHILD(L"field") << XATTR(L"var", L"x-miranda-core-version") << XCHILD(L"value", szCoreVersion);
+ form << XCHILD(L"field") << XATTR(L"var", L"software") << XCHILD(L"value", pCaps->GetSoft());
+ form << XCHILD(L"field") << XATTR(L"var", L"software_version") << XCHILD(L"value", pCaps->GetSoftVer());
+ form << XCHILD(L"field") << XATTR(L"var", L"x-miranda-core-version") << XCHILD(L"value", pCaps->GetSoftMir());
}
ppro->m_ThreadInfo->send(iq);
|