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 | |
parent | ea322d5c50ebfc21df05ced2b592e8ce16115623 (diff) |
Jabber: client info disappears if remote has the same Miranda version as me
Diffstat (limited to 'protocols/JabberG/src')
-rwxr-xr-x | protocols/JabberG/src/jabber_caps.cpp | 43 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_caps.h | 1 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.cpp | 3 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_userinfo.cpp | 6 |
5 files changed, 34 insertions, 21 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);
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index 363fb27614..7b7e5e1069 100755 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -283,7 +283,6 @@ public: CJabberClientCapsManager(CJabberProto *proto);
~CJabberClientCapsManager();
- void AddDefaultCaps();
const wchar_t* GetFeaturesCrc();
void UpdateFeatHash();
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 866bd1b030..2b587e2415 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -127,7 +127,8 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_iqManager.Start();
m_messageManager.FillPermanentHandlers();
m_adhocManager.FillDefaultNodes();
- m_clientCapsManager.AddDefaultCaps();
+
+ AddDefaultCaps();
IconsInit();
InitPopups();
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 04b8118278..7822b06bee 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -311,6 +311,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_caps.cpp ---------------------------------------------------------------
+ void AddDefaultCaps();
+
JabberCapsBits GetTotalJidCapabilites(const wchar_t *jid);
JabberCapsBits GetResourceCapabilites(const wchar_t *jid, bool appendBestResource);
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 42659c2485..7079c8a5c6 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -239,13 +239,15 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti sttInfoLineId(resource, INFOLINE_SOFTWARE)); // Version + const wchar_t *wszVer = pCaps->GetSoftMir() ? pCaps->GetSoftMir() : pCaps->GetSoftVer(); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Version"), - pCaps->GetSoftVer() ? pCaps->GetSoftVer() : TranslateT("<not specified>"), + wszVer ? wszVer : TranslateT("<not specified>"), sttInfoLineId(resource, INFOLINE_VERSION)); // System + wszVer = pCaps->GetOsVer() ? pCaps->GetOsVer() : pCaps->GetOs(); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("System"), - pCaps->GetOs() ? pCaps->GetOs() : TranslateT("<not specified>"), + wszVer ? wszVer : TranslateT("<not specified>"), sttInfoLineId(resource, INFOLINE_SYSTEM)); if (hIcon) |