X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_silence.cpp;h=b0ce8f56c2b3a20ab050147f6f706cd98c204c67;hb=f2cdf27dd9c45f91f4184b81ea3b9be7c5d88173;hp=817c8ffcfe2e91aae18974c75cca988d1d2fc009;hpb=d00914ed6f5de67ab69c69e1cd1efa0797b5f62d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 817c8ffcf..b0ce8f56c 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -66,7 +66,7 @@ class CommandSVSSilence : public Command CommandSVSSilence(Module* Creator) : Command(Creator,"SVSSILENCE", 2) { syntax = " {[+|-] }"; - TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ + TRANSLATE3(TR_NICK, TR_TEXT, TR_TEXT); } CmdResult Handle (const std::vector& parameters, User *user) @@ -112,7 +112,6 @@ class CommandSilence : public Command { allow_empty_last_param = false; syntax = "{[+|-] }"; - TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } CmdResult Handle (const std::vector& parameters, User *user) @@ -149,7 +148,7 @@ class CommandSilence : public Command if (pattern == 0) { - user->WriteServ("NOTICE %s :Bad SILENCE pattern",user->nick.c_str()); + user->WriteNotice("Bad SILENCE pattern"); return CMD_INVALID; } @@ -302,28 +301,28 @@ class ModuleSilence : public Module { } - void init() + void init() CXX11_OVERRIDE { OnRehash(NULL); ServerInstance->Modules->AddService(cmdsilence); ServerInstance->Modules->AddService(cmdsvssilence); ServerInstance->Modules->AddService(cmdsilence.ext); - Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite }; + Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreMessage, I_OnUserPreInvite }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - void OnRehash(User* user) + void OnRehash(User* user) CXX11_OVERRIDE { maxsilence = ServerInstance->Config->ConfValue("showwhois")->getInt("maxentries", 32); if (!maxsilence) maxsilence = 32; } - void On005Numeric(std::string &output) + void On005Numeric(std::map& tokens) CXX11_OVERRIDE { - // we don't really have a limit... - output = output + " ESILENCE SILENCE=" + ConvToStr(maxsilence); + tokens["ESILENCE"]; + tokens["SILENCE"] = ConvToStr(maxsilence); } void OnBuildExemptList(MessageType message_type, Channel* chan, User* sender, char status, CUList &exempt_list, const std::string &text) @@ -343,34 +342,24 @@ class ModuleSilence : public Module } } - ModResult PreText(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list, int silence_type) + ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE { if (target_type == TYPE_USER && IS_LOCAL(((User*)dest))) { - return MatchPattern((User*)dest, user, silence_type); + return MatchPattern((User*)dest, user, ((msgtype == MSG_PRIVMSG) ? SILENCE_PRIVATE : SILENCE_NOTICE)); } else if (target_type == TYPE_CHANNEL) { Channel* chan = (Channel*)dest; if (chan) { - this->OnBuildExemptList((silence_type == SILENCE_PRIVATE ? MSG_PRIVMSG : MSG_NOTICE), chan, user, status, exempt_list, ""); + this->OnBuildExemptList(msgtype, chan, user, status, exempt_list, ""); } } return MOD_RES_PASSTHRU; } - ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) - { - return PreText(user, dest, target_type, text, status, exempt_list, SILENCE_PRIVATE); - } - - ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) - { - return PreText(user, dest, target_type, text, status, exempt_list, SILENCE_NOTICE); - } - - ModResult OnUserPreInvite(User* source,User* dest,Channel* channel, time_t timeout) + ModResult OnUserPreInvite(User* source,User* dest,Channel* channel, time_t timeout) CXX11_OVERRIDE { return MatchPattern(dest, source, SILENCE_INVITE); } @@ -393,11 +382,7 @@ class ModuleSilence : public Module return MOD_RES_PASSTHRU; } - ~ModuleSilence() - { - } - - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides support for the /SILENCE command", VF_OPTCOMMON | VF_VENDOR); }