Commit 6210a9d5 authored by louiz’'s avatar louiz’

Add an <error/> element when the provided form is wrong, in two ad-hoc commands

parent 5d1a567e
...@@ -83,9 +83,14 @@ void HelloStep2(XmppComponent*, AdhocSession& session, XmlNode& command_node) ...@@ -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 command_node.delete_all_children();
// useless to terminate it, since this step is the last of the command XmlNode error(ADHOC_NS":error");
// anyway. But this is for the example. 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(); session.terminate();
} }
...@@ -182,7 +187,13 @@ void DisconnectUserStep2(XmppComponent* xmpp_component, AdhocSession& session, X ...@@ -182,7 +187,13 @@ void DisconnectUserStep2(XmppComponent* xmpp_component, AdhocSession& session, X
command_node.add_child(std::move(note)); 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(); session.terminate();
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment