From 75b344c4c8b4148602279b51bc2cc5d45b03c324 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Nov 2017 12:26:50 +0300 Subject: more strict version of caps reading --- protocols/JabberG/src/jabber_misc.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'protocols/JabberG/src/jabber_misc.cpp') diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 7ade567dec..91d7955c7e 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -277,17 +277,13 @@ void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item) debugLogW(L"JabberUpdateMirVer: for jid %s", item->jid); - pResourceStatus p(nullptr); if (item->resourceMode == RSMODE_LASTSEEN) - p = item->m_pLastSeenResource; + UpdateMirVer(hContact, pResourceStatus(item->m_pLastSeenResource)); else if (item->resourceMode == RSMODE_MANUAL) - p = item->m_pManualResource; - - if (p) - UpdateMirVer(hContact, p); + UpdateMirVer(hContact, pResourceStatus(item->m_pManualResource)); } -void CJabberProto::FormatMirVer(pResourceStatus &resource, CMStringW &res) +void CJabberProto::FormatMirVer(const pResourceStatus &resource, CMStringW &res) { res.Empty(); if (resource == nullptr) @@ -338,10 +334,13 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMStringW &res) res.AppendFormat(L" [%s]", resource->m_tszResourceName); } -void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) +void CJabberProto::UpdateMirVer(MCONTACT hContact, const pResourceStatus &r) { + if (r == nullptr) + return; + CMStringW tszMirVer; - FormatMirVer(resource, tszMirVer); + FormatMirVer(r, tszMirVer); if (!tszMirVer.IsEmpty()) setWString(hContact, "MirVer", tszMirVer); @@ -350,8 +349,8 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) return; wchar_t szFullJid[JABBER_MAX_JID_LEN]; - if (resource->m_tszResourceName && !wcschr(jid, '/')) - mir_snwprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName); + if (r->m_tszResourceName && !wcschr(jid, '/')) + mir_snwprintf(szFullJid, L"%s/%s", jid, r->m_tszResourceName); else mir_wstrncpy(szFullJid, jid, _countof(szFullJid)); setWString(hContact, DBSETTING_DISPLAY_UID, szFullJid); -- cgit v1.2.3