From 0ab40dc1ab4e689921da54080b135e1d22b1c586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 14 Mar 2017 21:45:23 +0100 Subject: Refactoring louloulibs and cmake Use OBJECT libraries Remove the louloulibs directory Write FOUND variables in the cache --- src/xmpp/adhoc_command.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/xmpp/adhoc_command.hpp (limited to 'src/xmpp/adhoc_command.hpp') diff --git a/src/xmpp/adhoc_command.hpp b/src/xmpp/adhoc_command.hpp new file mode 100644 index 0000000..7c4de47 --- /dev/null +++ b/src/xmpp/adhoc_command.hpp @@ -0,0 +1,44 @@ +#pragma once + +/** + * Describe an ad-hoc command. + * + * Can only have zero or one step for now. When execution is requested, it + * can return a result immediately, or provide a form to be filled, and + * provide a result once the filled form is received. + */ + +#include + +#include +#include + +class AdhocCommand +{ + friend class AdhocSession; +public: + AdhocCommand(std::vector&& callback, const std::string& name, const bool admin_only); + ~AdhocCommand() = default; + AdhocCommand(const AdhocCommand&) = default; + AdhocCommand(AdhocCommand&&) = default; + AdhocCommand& operator=(AdhocCommand&&) = delete; + AdhocCommand& operator=(const AdhocCommand&) = delete; + + const std::string name; + + bool is_admin_only() const; + +private: + /** + * A command may have one or more steps. Each step is a different + * callback, inserting things into a XmlNode and calling + * methods of an AdhocSession. + */ + std::vector callbacks; + const bool admin_only; +}; + +void PingStep1(XmppComponent&, AdhocSession& session, XmlNode& command_node); +void HelloStep1(XmppComponent&, AdhocSession& session, XmlNode& command_node); +void HelloStep2(XmppComponent&, AdhocSession& session, XmlNode& command_node); +void Reload(XmppComponent&, AdhocSession& session, XmlNode& command_node); -- cgit v1.2.3 From 1a09c965eb3723cdaab9ea556f30ffbc7f09a6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 29 Mar 2017 23:32:43 +0200 Subject: Remove two sneaky log_debug --- src/xmpp/adhoc_command.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xmpp/adhoc_command.hpp') diff --git a/src/xmpp/adhoc_command.hpp b/src/xmpp/adhoc_command.hpp index 7c4de47..ced4549 100644 --- a/src/xmpp/adhoc_command.hpp +++ b/src/xmpp/adhoc_command.hpp @@ -17,7 +17,7 @@ class AdhocCommand { friend class AdhocSession; public: - AdhocCommand(std::vector&& callback, const std::string& name, const bool admin_only); + AdhocCommand(std::vector&& callbacks, const std::string& name, const bool admin_only); ~AdhocCommand() = default; AdhocCommand(const AdhocCommand&) = default; AdhocCommand(AdhocCommand&&) = default; -- cgit v1.2.3 From 5402a256d1f0ebbeafa32d250d000cf38fe748fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 7 Apr 2017 18:45:24 +0200 Subject: Apply all the clang-tidy modernize-* fixes --- src/xmpp/adhoc_command.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xmpp/adhoc_command.hpp') diff --git a/src/xmpp/adhoc_command.hpp b/src/xmpp/adhoc_command.hpp index ced4549..c00d9e6 100644 --- a/src/xmpp/adhoc_command.hpp +++ b/src/xmpp/adhoc_command.hpp @@ -17,7 +17,7 @@ class AdhocCommand { friend class AdhocSession; public: - AdhocCommand(std::vector&& callbacks, const std::string& name, const bool admin_only); + AdhocCommand(std::vector&& callbacks, std::string name, const bool admin_only); ~AdhocCommand() = default; AdhocCommand(const AdhocCommand&) = default; AdhocCommand(AdhocCommand&&) = default; -- cgit v1.2.3