diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-29 13:45:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-29 13:45:33 +0300 |
commit | d788b07db648f5b435e552943cdd5a7b20a4ea3c (patch) | |
tree | 8be31ce0b73448d1c2505cc76996e2c6665c7bf0 /protocols/JabberG/src | |
parent | cdfc49025d69584ec57adf7e1bc8f9b8542ffb48 (diff) |
merge with trunk
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_adhoc.cpp | 17 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_thread.cpp | 2 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_util.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_xml.h | 5 |
4 files changed, 15 insertions, 11 deletions
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 9df5cd38aa..65fd559948 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -132,7 +132,6 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, char*, JabberAdHocData *dat // Messages handlers
int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, TiXmlElement *iqNode, JabberAdHocData *dat)
{
- int nodeIdx = 0;
const char *type = XmlGetAttr(iqNode, "type");
if (!type || !mir_strcmp(type, "error")) {
// error occurred here
@@ -148,18 +147,17 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, TiXmlElement *iqNo JabberFormSetInstruction(hwndDlg, CMStringA(FORMAT, TranslateU("Error %s %s"), code, description));
}
else if (!mir_strcmp(type, "result")) {
- BOOL validResponse = FALSE;
EnumChildWindows(GetDlgItem(hwndDlg, IDC_FRAME), sttDeleteChildWindowsProc, 0);
dat->CurrentHeight = 0;
dat->curPos = 0;
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE);
- auto *queryNode = XmlFirstChild(iqNode, "query");
- if (queryNode) {
- const char *xmlns = XmlGetAttr(queryNode, "xmlns");
- const char *node = XmlGetAttr(queryNode, "node");
- if (xmlns && node && !mir_strcmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !mir_strcmp(node, JABBER_FEAT_COMMANDS))
- validResponse = TRUE;
- }
+
+ bool validResponse = false;
+ auto *queryNode = XmlGetChildByTag(iqNode, "query", "xmlns", JABBER_FEAT_DISCO_ITEMS);
+ if (queryNode)
+ validResponse = queryNode->Attribute("node", JABBER_FEAT_COMMANDS) != 0;
+
+ int nodeIdx = 1;
if (queryNode && XmlFirstChild(queryNode, 0) && validResponse) {
dat->CommandsNode = queryNode->DeepClone(&dat->doc)->ToElement();
@@ -170,6 +168,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, TiXmlElement *iqNo name = XmlGetAttr(itemNode, "node");
ypos = AdHoc_AddCommandRadio(GetDlgItem(hwndDlg, IDC_FRAME), name, nodeIdx, ypos, (nodeIdx == 1) ? 1 : 0);
dat->CurrentHeight = ypos;
+ nodeIdx++;
}
}
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 0c0941c531..486fd6fbcc 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1885,7 +1885,7 @@ void CJabberProto::OnProcessIq(const TiXmlElement *node) auto *pFirstChild = XmlFirstChild(node);
if (pFirstChild)
- iq.InsertEndChild(pFirstChild->DeepClone(&iq)->ToElement());
+ iq += pFirstChild;
iq << XCHILD("error") << XATTR("type", "cancel")
<< XCHILDNS("service-unavailable", "urn:ietf:params:xml:ns:xmpp-stanzas");
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 30f4137d68..1d946f6a90 100755 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -372,7 +372,7 @@ void CJabberProto::SendPresenceTo(int status, const char *to, const TiXmlElement p << XATTR("to", to);
if (extra)
- p.InsertEndChild(extra->DeepClone(&p)->ToElement());
+ p += extra;
// XEP-0115:Entity Capabilities
if (m_bAllowVersionRequests) {
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 32fb0136c5..230be83e14 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -36,6 +36,11 @@ public: XmlNode(const char *name);
XmlNode(const char *pszName, const char *ptszText);
+ __forceinline void operator +=(const TiXmlElement *pNode)
+ {
+ m_hXml->InsertEndChild(pNode->DeepClone(this)->ToElement());
+ }
+
__forceinline TiXmlElement* node() const
{ return m_hXml;
}
|