summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-06-11 01:00:02 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-06-11 01:00:02 +0200
commit6210a9d50b216f22a8b755c2c9daea66659514f0 (patch)
tree94280503eca824eb5a3630c1ccdd14d08ef7ae46
parent5d1a567ea5b6407deff81f1ea02422d7a49441ec (diff)
downloadbiboumi-6210a9d50b216f22a8b755c2c9daea66659514f0.tar.gz
biboumi-6210a9d50b216f22a8b755c2c9daea66659514f0.tar.bz2
biboumi-6210a9d50b216f22a8b755c2c9daea66659514f0.tar.xz
biboumi-6210a9d50b216f22a8b755c2c9daea66659514f0.zip
Add an <error/> element when the provided form is wrong, in two ad-hoc commands
-rw-r--r--src/xmpp/adhoc_command.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/xmpp/adhoc_command.cpp b/src/xmpp/adhoc_command.cpp
index 419c3ae..67bc706 100644
--- a/src/xmpp/adhoc_command.cpp
+++ b/src/xmpp/adhoc_command.cpp
@@ -83,9 +83,14 @@ void HelloStep2(XmppComponent*, AdhocSession& session, XmlNode& command_node)
}
}
}
- // TODO insert an error telling the name value is missing. Also it's
- // useless to terminate it, since this step is the last of the command
- // anyway. But this is for the example.
+ command_node.delete_all_children();
+ XmlNode error(ADHOC_NS":error");
+ error["type"] = "modify";
+ XmlNode condition(STANZA_NS":bad-request");
+ condition.close();
+ error.add_child(std::move(condition));
+ error.close();
+ command_node.add_child(std::move(error));
session.terminate();
}
@@ -182,7 +187,13 @@ void DisconnectUserStep2(XmppComponent* xmpp_component, AdhocSession& session, X
command_node.add_child(std::move(note));
}
}
- // TODO insert an error telling the values are missing.
+ XmlNode error(ADHOC_NS":error");
+ error["type"] = "modify";
+ XmlNode condition(STANZA_NS":bad-request");
+ condition.close();
+ error.add_child(std::move(condition));
+ error.close();
+ command_node.add_child(std::move(error));
session.terminate();
}