summaryrefslogtreecommitdiff
path: root/louloulibs
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-09-29 20:53:40 +0200
committerlouiz’ <louiz@louiz.org>2016-09-29 20:53:40 +0200
commitee4cf5dc2d3eaa43794a8ac736a6409e08082882 (patch)
treecc463fcacd4b5ebf06f67de2a5cad44c78c8542c /louloulibs
parent363a0bf02cf20592b2f9f034de1c5f54c8922b82 (diff)
downloadbiboumi-ee4cf5dc2d3eaa43794a8ac736a6409e08082882.tar.gz
biboumi-ee4cf5dc2d3eaa43794a8ac736a6409e08082882.tar.bz2
biboumi-ee4cf5dc2d3eaa43794a8ac736a6409e08082882.tar.xz
biboumi-ee4cf5dc2d3eaa43794a8ac736a6409e08082882.zip
Add AdhocCommandHandlers::add_command to simplify the usage of this class
And make things a little bit clearer
Diffstat (limited to 'louloulibs')
-rw-r--r--louloulibs/xmpp/adhoc_commands_handler.cpp4
-rw-r--r--louloulibs/xmpp/adhoc_commands_handler.hpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/louloulibs/xmpp/adhoc_commands_handler.cpp b/louloulibs/xmpp/adhoc_commands_handler.cpp
index 17c4e67..573c9ec 100644
--- a/louloulibs/xmpp/adhoc_commands_handler.cpp
+++ b/louloulibs/xmpp/adhoc_commands_handler.cpp
@@ -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)
diff --git a/louloulibs/xmpp/adhoc_commands_handler.hpp b/louloulibs/xmpp/adhoc_commands_handler.hpp
index 91eb5bd..e37d913 100644
--- a/louloulibs/xmpp/adhoc_commands_handler.hpp
+++ b/louloulibs/xmpp/adhoc_commands_handler.hpp
@@ -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