X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_alias.cpp;h=cd53c9f9733cc45ea17cdc6be70375af3de1e0eb;hb=e9e75e50bc25e67af22dd88b39b12217a553d5cb;hp=686938eb4be97445f88df16a451ae6a90a90588f;hpb=c8b41aa5d256d99eee67ec94492a94dc30e0ea35;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 686938eb4..cd53c9f97 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -59,14 +59,12 @@ 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 Aliases; /* whether or not +B users are allowed to use fantasy commands */ @@ -74,11 +72,9 @@ class ModuleAlias : public Module virtual void ReadAliases() { - ConfigReader MyConf; - - AllowBots = MyConf.ReadFlag("fantasy", "allowbots", "no", 0); - - std::string fpre = MyConf.ReadValue("fantasy","prefix",0); + ConfigTag* fantasy = ServerInstance->Config->ConfValue("fantasy"); + AllowBots = fantasy->getBool("allowbots", false); + std::string fpre = fantasy->getString("prefix", "!"); fprefix = fpre.empty() ? '!' : fpre[0]; Aliases.clear(); @@ -102,17 +98,11 @@ class ModuleAlias : public Module } public: - - ModuleAlias() + void init() { ReadAliases(); - ServerInstance->Modules->Attach(I_OnPreCommand, this); - ServerInstance->Modules->Attach(I_OnRehash, this); - ServerInstance->Modules->Attach(I_OnUserMessage, this); - } - - virtual ~ModuleAlias() - { + Implementation eventlist[] = { I_OnPreCommand, I_OnRehash, I_OnUserMessage }; + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } virtual Version GetVersion() @@ -273,7 +263,7 @@ class ModuleAlias : public Module } } - if ((a->OperOnly) && (!IS_OPER(user))) + if ((a->OperOnly) && (!user->IsOper())) return 0; if (!a->RequiredNick.empty())