diff options
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/adhoc_command.cpp | 12 | ||||
-rw-r--r-- | src/xmpp/adhoc_command.hpp | 1 | ||||
-rw-r--r-- | src/xmpp/adhoc_commands_handler.cpp | 3 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/xmpp/adhoc_command.cpp b/src/xmpp/adhoc_command.cpp index e1bfc97..c20976a 100644 --- a/src/xmpp/adhoc_command.cpp +++ b/src/xmpp/adhoc_command.cpp @@ -3,6 +3,8 @@ #include <bridge/bridge.hpp> +#include <utils/reload.hpp> + using namespace std::string_literals; AdhocCommand::AdhocCommand(std::vector<AdhocStep>&& callbacks, const std::string& name, const bool admin_only): @@ -198,3 +200,13 @@ void DisconnectUserStep2(XmppComponent* xmpp_component, AdhocSession& session, X session.terminate(); } +void Reload(XmppComponent*, AdhocSession& session, XmlNode& command_node) +{ + ::reload_process(); + command_node.delete_all_children(); + XmlNode note("note"); + note["type"] = "info"; + note.set_inner("Configuration reloaded."); + note.close(); + command_node.add_child(std::move(note)); +} diff --git a/src/xmpp/adhoc_command.hpp b/src/xmpp/adhoc_command.hpp index 60f7d6c..622d6b9 100644 --- a/src/xmpp/adhoc_command.hpp +++ b/src/xmpp/adhoc_command.hpp @@ -40,5 +40,6 @@ void HelloStep1(XmppComponent*, AdhocSession& session, XmlNode& command_node); void HelloStep2(XmppComponent*, AdhocSession& session, XmlNode& command_node); void DisconnectUserStep1(XmppComponent*, AdhocSession& session, XmlNode& command_node); void DisconnectUserStep2(XmppComponent*, AdhocSession& session, XmlNode& command_node); +void Reload(XmppComponent*, AdhocSession& session, XmlNode& command_node); #endif // ADHOC_COMMAND_HPP diff --git a/src/xmpp/adhoc_commands_handler.cpp b/src/xmpp/adhoc_commands_handler.cpp index a0defdd..def1dcb 100644 --- a/src/xmpp/adhoc_commands_handler.cpp +++ b/src/xmpp/adhoc_commands_handler.cpp @@ -15,7 +15,8 @@ AdhocCommandsHandler::AdhocCommandsHandler(XmppComponent* xmpp_component): commands{ {"ping", AdhocCommand({&PingStep1}, "Do a ping", false)}, {"hello", AdhocCommand({&HelloStep1, &HelloStep2}, "Receive a custom greeting", false)}, - {"disconnect-user", AdhocCommand({&DisconnectUserStep1, &DisconnectUserStep2}, "Disconnect a user from the gateway", true)} + {"disconnect-user", AdhocCommand({&DisconnectUserStep1, &DisconnectUserStep2}, "Disconnect a user from the gateway", true)}, + {"reload", AdhocCommand({&Reload}, "Reload biboumi’s configuration", true)} } { } |