Add AdhocCommandHandlers::add_command to simplify the usage of this class

And make things a little bit clearer
This commit is contained in:
louiz’
2016-09-29 20:53:40 +02:00
parent 363a0bf02c
commit ee4cf5dc2d
3 changed files with 16 additions and 27 deletions
+2 -2
View File
@@ -15,9 +15,9 @@ const std::map<const std::string, const AdhocCommand>& AdhocCommandsHandler::get
return this->commands;
}
std::map<const std::string, const AdhocCommand>& AdhocCommandsHandler::get_commands()
void AdhocCommandsHandler::add_command(std::string name, AdhocCommand command)
{
return this->commands;
this->commands.emplace(std::make_pair(std::move(name), std::move(command)));
}
XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, const std::string& to, XmlNode command_node)
+2 -2
View File
@@ -31,9 +31,9 @@ public:
*/
const std::map<const std::string, const AdhocCommand>& get_commands() const;
/**
* This one can be used to add new commands.
* Add a command into the list, associated with the given name
*/
std::map<const std::string, const AdhocCommand>& get_commands();
void add_command(std::string name, AdhocCommand command);
/**
* Find the requested command, create a new session or use an existing
* one, and process the request (provide a new form, an error, or a