diff options
Diffstat (limited to 'Swiftob/Commands.h')
-rw-r--r-- | Swiftob/Commands.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Swiftob/Commands.h b/Swiftob/Commands.h index 8423252..d5aac2c 100644 --- a/Swiftob/Commands.h +++ b/Swiftob/Commands.h @@ -22,4 +22,5 @@ namespace Swift { class Storage; class Commands { + typedef boost::function<void(Swift::Message::ref)> ListenerCallback; public: enum RoleList {Anyone, Owner}; @@ -42,8 +43,11 @@ class Commands { public: Commands(Users* users, Swift::Client* client, Storage* storage, MUCs* mucs); + ~Commands(); bool hasCommand(const std::string&); bool runCommand(const std::string& command, const std::string& params, Swift::Message::ref message); + void runListeners(Swift::Message::ref message); void replyTo(Swift::Message::ref source, std::string replyBody, bool outOfMUC = false); void registerCommand(const std::string& name, RoleList roles, const std::string& description, boost::function<void(const std::string& /*command*/, const std::string& /*params*/, Swift::Message::ref)> callback); + void registerListener(ListenerCallback); void resetCommands(); void setRehashError(const std::string& error); @@ -51,5 +55,7 @@ class Commands { public: boost::signal<void ()> onReset; + boost::signal<void ()> onRestartRequested; private: + void clearCommands(); bool roleIn(const Users::User::Role userRole, RoleList roles); void handleQuitCommand(const std::string& command, const std::string& params, Swift::Message::ref message); @@ -60,6 +66,10 @@ class Commands { void handlePartCommand(const std::string& /*command*/, const std::string& params, Swift::Message::ref message); void handleRehashCommand(const std::string& command, const std::string& params, Swift::Message::ref message); + void handleRestartCommand(const std::string& command, const std::string& params, Swift::Message::ref message); + void handleChangeNick(const std::string& command, const std::string& params, Swift::Message::ref message); + void handleChangeOwner(const std::string& command, const std::string& params, Swift::Message::ref message); private: std::map<std::string, Command*> commands_; + std::vector<ListenerCallback> listeners_; Users* users_; Swift::Client* client_; |