X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_callerid.cpp;h=e8448bc91a0e6b6515b0b2d2eb3fb6aa0e7b6130;hb=551d687ec6d7ce44be35fae0dd7345fe73c4f63a;hp=86b6d8d3ce7e4dfce07c54dc99365463d0ef3944;hpb=a17421dca39d4afabf7143797baa6e13a19a5a97;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 86b6d8d3c..e8448bc91 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -22,7 +22,7 @@ #include "inspircd.h" -/* $ModDesc: Implementation of callerid (umode +g & /accept, ala hybrid etc) */ +/* $ModDesc: Implementation of callerid, usermode +g, /accept */ class callerid_data { @@ -119,6 +119,7 @@ struct CallerIDExtInfo : public ExtensionItem if (it2 != targ->wholistsme.end()) targ->wholistsme.erase(it2); } + delete dat; } }; @@ -136,6 +137,7 @@ public: CommandAccept(Module* Creator) : Command(Creator, "ACCEPT", 1), extInfo(Creator) { + allow_empty_last_param = false; syntax = "{[+|-]}|*}"; TRANSLATE2(TR_CUSTOM, TR_END); } @@ -144,7 +146,7 @@ public: { if (index != 0) return; - std::string out = ""; + std::string out; irc::commasepstream nicks(parameter); std::string tok; while (nicks.GetToken(tok)) @@ -290,7 +292,6 @@ public: class ModuleCallerID : public Module { -private: CommandAccept cmd; User_g myumode; @@ -338,21 +339,17 @@ public: ServerInstance->Modules->AddService(cmd.extInfo); Implementation eventlist[] = { I_OnRehash, I_OnUserPostNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage }; - ServerInstance->Modules->Attach(eventlist, this, 6); - } - - virtual ~ModuleCallerID() - { + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } virtual Version GetVersion() { - return Version("Implementation of callerid (umode +g & /accept, ala hybrid etc)", VF_COMMON | VF_VENDOR); + return Version("Implementation of callerid, usermode +g, /accept", VF_COMMON | VF_VENDOR); } - virtual void On005Numeric(std::string& output) + virtual void On005Numeric(std::map& tokens) { - output += " CALLERID=g"; + tokens["CALLERID"] = "g"; } ModResult PreText(User* user, User* dest, std::string& text) @@ -360,7 +357,7 @@ public: if (!dest->IsModeSet('g')) return MOD_RES_PASSTHRU; - if (operoverride && IS_OPER(user)) + if (operoverride && user->IsOper()) return MOD_RES_PASSTHRU; callerid_data* dat = cmd.extInfo.get(dest, true); @@ -412,14 +409,12 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf; - cmd.maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true); - operoverride = Conf.ReadFlag("callerid", "operoverride", "0", 0); - tracknick = Conf.ReadFlag("callerid", "tracknick", "0", 0); - notify_cooldown = Conf.ReadInteger("callerid", "cooldown", "60", 0, true); + ConfigTag* tag = ServerInstance->Config->ConfValue("callerid"); + cmd.maxaccepts = tag->getInt("maxaccepts", 16); + operoverride = tag->getBool("operoverride"); + tracknick = tag->getBool("tracknick"); + notify_cooldown = tag->getInt("cooldown", 60); } }; MODULE_INIT(ModuleCallerID) - -