diff options
Diffstat (limited to 'src/modules/m_alias.cpp')
-rw-r--r-- | src/modules/m_alias.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 25f071bab..118cedeea 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -59,20 +59,18 @@ class Alias class ModuleAlias : public Module { - private: - char fprefix; /* We cant use a map, there may be multiple aliases with the same name. * We can, however, use a fancy invention: the multimap. Maps a key to one or more values. * -- w00t - */ + */ std::multimap<irc::string, Alias> Aliases; /* whether or not +B users are allowed to use fantasy commands */ bool AllowBots; - virtual void ReadAliases() + void ReadAliases() { ConfigTag* fantasy = ServerInstance->Config->ConfValue("fantasy"); AllowBots = fantasy->getBool("allowbots", false); @@ -100,19 +98,14 @@ class ModuleAlias : public Module } public: - - void init() + void init() CXX11_OVERRIDE { ReadAliases(); Implementation eventlist[] = { I_OnPreCommand, I_OnRehash, I_OnUserMessage }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual ~ModuleAlias() - { - } - - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides aliases of commands.", VF_VENDOR); } @@ -142,7 +135,7 @@ class ModuleAlias : public Module return word; } - virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, LocalUser *user, bool validated, const std::string &original_line) + ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, LocalUser *user, bool validated, const std::string &original_line) CXX11_OVERRIDE { std::multimap<irc::string, Alias>::iterator i, upperbound; @@ -182,9 +175,9 @@ class ModuleAlias : public Module return MOD_RES_PASSTHRU; } - virtual void OnUserMessage(User *user, void *dest, int target_type, const std::string &text, char status, const CUList &exempt_list) + void OnUserMessage(User *user, void *dest, int target_type, const std::string &text, char status, const CUList &exempt_list, MessageType msgtype) CXX11_OVERRIDE { - if (target_type != TYPE_CHANNEL) + if ((target_type != TYPE_CHANNEL) || (msgtype != MSG_PRIVMSG)) { return; } @@ -270,7 +263,7 @@ class ModuleAlias : public Module } } - if ((a->OperOnly) && (!IS_OPER(user))) + if ((a->OperOnly) && (!user->IsOper())) return 0; if (!a->RequiredNick.empty()) @@ -367,19 +360,19 @@ class ModuleAlias : public Module std::string command, token; ss.GetToken(command); - while (ss.GetToken(token) && (pars.size() <= MAXPARAMETERS)) + while (ss.GetToken(token)) { pars.push_back(token); } ServerInstance->Parser->CallHandler(command, pars, user); } - virtual void OnRehash(User* user) + void OnRehash(User* user) CXX11_OVERRIDE { ReadAliases(); } - virtual void Prioritize() + void Prioritize() { // Prioritise after spanningtree so that channel aliases show the alias before the effects. Module* linkmod = ServerInstance->Modules->Find("m_spanningtree.so"); |