summaryrefslogtreecommitdiff
path: root/src/modules/m_silence.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_silence.cpp')
-rw-r--r--src/modules/m_silence.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 817c8ffcf..0e9a45720 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -149,7 +149,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 +302,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<std::string, std::string>& 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 +343,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 +383,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);
}