From 07600605510b522c669305feeb0ef3b8d8bfba95 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Feb 2019 16:17:37 +0300 Subject: fix for ugly form packets from Psi+ --- protocols/JabberG/src/jabber_caps.cpp | 3 +++ protocols/JabberG/src/jabber_iq.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index d8ed2b6a35..508b7126c1 100755 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -169,6 +169,9 @@ void CJabberProto::OnIqResultCapsDiscoInfo(const TiXmlElement*, CJabberIqInfo *p JSONNode root; for (auto *field : TiXmlFilter(xform, "field")) { const char *fieldName = XmlGetAttr(field, "var"), *fieldValue = XmlGetChildText(field, "value"); + if (fieldValue == nullptr) + continue; + if (!mir_strcmp(fieldName, "os")) root.push_back(JSONNode("o", pCaps->m_szOs = mir_strdup(fieldValue))); else if (!mir_strcmp(fieldName, "os_version")) diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index a6888620f7..ca1f0b1e17 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -295,7 +295,7 @@ bool CJabberIqManager::HandleIqPermanent(const TiXmlElement *pNode) // have to get all data here, in the loop, because there's always possibility that previous handler modified it const char *szType = XmlGetAttr(pNode, "type"); if (!szType) - return FALSE; + return false; CJabberIqInfo iqInfo; iqInfo.m_nIqType = JABBER_IQ_TYPE_FAIL; @@ -304,14 +304,14 @@ bool CJabberIqManager::HandleIqPermanent(const TiXmlElement *pNode) else if (!mir_strcmpi(szType, "set")) iqInfo.m_nIqType = JABBER_IQ_TYPE_SET; else - return FALSE; + return false; if (!(pInfo->m_nIqTypes & iqInfo.m_nIqType)) continue; auto *pFirstChild = XmlFirstChild(pNode); if (!pFirstChild || !pFirstChild->Name()) - return FALSE; + return false; const char *szTagName = pFirstChild->Name(); const char *szXmlns = XmlGetAttr(pFirstChild, "xmlns"); -- cgit v1.2.3