diff options
author | George Hazan <ghazan@miranda.im> | 2017-08-14 16:18:15 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-08-14 16:18:15 +0300 |
commit | cc9adee406ad0434e470dfc11ed3896c6be32073 (patch) | |
tree | 22643d0888e35c56fad6df9071bc6ec5c11235dd /protocols | |
parent | 444f8615792ebdfeb8278a13a2adf27c66783013 (diff) |
Jabber: fix for retrieving QIP versions
Diffstat (limited to 'protocols')
-rwxr-xr-x | protocols/JabberG/src/jabber_misc.cpp | 31 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.h | 1 |
2 files changed, 18 insertions, 14 deletions
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 0f4eae9e81..2c89d52b94 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -250,14 +250,25 @@ struct }
static sttCapsNodeToName_Map[] =
{
- { L"http://miranda-im.org", L"Miranda IM Jabber" },
- { L"http://miranda-ng.org", L"Miranda NG Jabber" },
- { L"http://www.google.com", L"GTalk" },
+ { L"http://miranda-im.org", L"Miranda IM Jabber" },
+ { L"http://miranda-ng.org", L"Miranda NG Jabber" },
+ { L"http://www.google.com", L"GTalk" },
{ L"http://mail.google.com", L"GMail" },
- { L"http://talk.google.com/xmpp/bot", L"GTalk Bot" },
{ L"http://www.android.com", L"Android" },
+ { L"http://qip.ru", L"QIP 2012" },
+ { L"http://2010.qip.ru", L"QIP 2010"}
};
+const wchar_t* CJabberProto::GetSoftName(const wchar_t *wszName)
+{
+ // search through known software list
+ for (int i = 0; i < _countof(sttCapsNodeToName_Map); i++)
+ if (wcsstr(wszName, sttCapsNodeToName_Map[i].node))
+ return sttCapsNodeToName_Map[i].name;
+
+ return nullptr;
+}
+
void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item)
{
MCONTACT hContact = HContactFromJID(item->jid);
@@ -293,17 +304,9 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMStringW &res) CJabberClientPartialCaps *pCaps = resource->m_pCaps;
debugLogW(L"JabberUpdateMirVer: for rc %s: %s#%s", resource->m_tszResourceName, pCaps->GetNode(), pCaps->GetHash());
- // search through known software list
- int i;
- for (i = 0; i < _countof(sttCapsNodeToName_Map); i++)
- if (wcsstr(pCaps->GetNode(), sttCapsNodeToName_Map[i].node)) {
- res.Format(L"%s %s", sttCapsNodeToName_Map[i].name, pCaps->GetSoftVer());
- break;
- }
-
// unknown software
- if (i == _countof(sttCapsNodeToName_Map))
- res.Format(L"%s %s", pCaps->GetSoft(), pCaps->GetSoftVer());
+ const wchar_t *szDefaultName = GetSoftName(pCaps->GetNode());
+ res.Format(L"%s %s", (szDefaultName == nullptr) ? pCaps->GetSoft() : szDefaultName, pCaps->GetSoftVer());
}
// attach additional info for fingerprint plguin
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index aa2218411d..04b8118278 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -603,6 +603,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void InitPopups(void);
void MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle);
CMStringW ExtractImage(HXML node);
+ const wchar_t* GetSoftName(const wchar_t *wszName);
//---- jabber_opt.cpp ----------------------------------------------------------------
INT_PTR __cdecl OnMenuHandleRosterControl(WPARAM wParam, LPARAM lParam);
|