summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-29 12:06:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-29 12:06:30 +0300
commit9909cc3afdc580ca34dea4be7522278565d7e43f (patch)
tree5030be59d828db15f42ed7ff6ca4e197fbd41ff4 /protocols/JabberG
parent2886b48fd0543151cecaf1739b48c296cbedd4b4 (diff)
Jabber: fix for ad-hoc form behavior
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp17
1 files changed, 8 insertions, 9 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++;
}
}