X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_silence.cpp;h=1e73bda27569b82cdf350d066d5f25a39892c4c8;hb=4e3d655dff6f8a5aed626475fbf19c2a7119c20b;hp=3b32097eabb7da9419977609f42011e3bac30409;hpb=e57d1b19ff4823b7885eb7f4d3b37c84d2edca0e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 3b32097ea..1e73bda27 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -187,7 +187,7 @@ class SilenceMessage : public ClientProtocol::Message : ClientProtocol::Message("SILENCE") { PushParam(mask); - PushParamRef(flags); + PushParam(flags); } }; @@ -201,7 +201,7 @@ class CommandSilence : public SplitCommand SilenceList* list = ext.get(user); if (list && list->size() > maxsilence) { - user->WriteNumeric(ERR_SILELISTFULL, mask, SilenceEntry::BitsToFlags(flags), "Your silence list is full"); + user->WriteNumeric(ERR_SILELISTFULL, mask, SilenceEntry::BitsToFlags(flags), "Your SILENCE list is full"); return CMD_FAILURE; } else if (!list) @@ -213,7 +213,7 @@ class CommandSilence : public SplitCommand if (!list->insert(SilenceEntry(flags, mask)).second) { - user->WriteNumeric(ERR_SILENCE, mask, SilenceEntry::BitsToFlags(flags), "The silence entry you specified already exists"); + user->WriteNumeric(ERR_SILENCE, mask, SilenceEntry::BitsToFlags(flags), "The SILENCE entry you specified already exists"); return CMD_FAILURE; } @@ -239,7 +239,7 @@ class CommandSilence : public SplitCommand } } - user->WriteNumeric(ERR_SILENCE, mask, SilenceEntry::BitsToFlags(flags), "The silence entry you specified could not be found"); + user->WriteNumeric(ERR_SILENCE, mask, SilenceEntry::BitsToFlags(flags), "The SILENCE entry you specified could not be found"); return CMD_FAILURE; } @@ -253,7 +253,7 @@ class CommandSilence : public SplitCommand user->WriteNumeric(RPL_SILELIST, iter->mask, SilenceEntry::BitsToFlags(iter->flags)); } } - user->WriteNumeric(RPL_ENDOFSILELIST, "End of silence list"); + user->WriteNumeric(RPL_ENDOFSILELIST, "End of SILENCE list"); return CMD_SUCCESS; } @@ -384,32 +384,38 @@ class ModuleSilence bool is_ctcp = details.IsCTCP(ctcpname) && !irc::equals(ctcpname, "ACTION"); SilenceEntry::SilenceFlags flag = SilenceEntry::SF_NONE; - if (target.type == MessageTarget::TYPE_CHANNEL) - { - if (is_ctcp) - flag = SilenceEntry::SF_CTCP_CHANNEL; - else if (details.type == MSG_NOTICE) - flag = SilenceEntry::SF_NOTICE_CHANNEL; - else if (details.type == MSG_PRIVMSG) - flag = SilenceEntry::SF_PRIVMSG_CHANNEL; - - return BuildChannelExempts(user, target.Get(), flag, details.exemptions); - } - - if (target.type == MessageTarget::TYPE_USER) + switch (target.type) { - if (is_ctcp) - flag = SilenceEntry::SF_CTCP_USER; - else if (details.type == MSG_NOTICE) - flag = SilenceEntry::SF_NOTICE_USER; - else if (details.type == MSG_PRIVMSG) - flag = SilenceEntry::SF_PRIVMSG_USER; - - if (!CanReceiveMessage(user, target.Get(), flag)) + case MessageTarget::TYPE_CHANNEL: + { + if (is_ctcp) + flag = SilenceEntry::SF_CTCP_CHANNEL; + else if (details.type == MSG_NOTICE) + flag = SilenceEntry::SF_NOTICE_CHANNEL; + else if (details.type == MSG_PRIVMSG) + flag = SilenceEntry::SF_PRIVMSG_CHANNEL; + + return BuildChannelExempts(user, target.Get(), flag, details.exemptions); + break; + } + case MessageTarget::TYPE_USER: { - details.echo_original = true; - return MOD_RES_DENY; + if (is_ctcp) + flag = SilenceEntry::SF_CTCP_USER; + else if (details.type == MSG_NOTICE) + flag = SilenceEntry::SF_NOTICE_USER; + else if (details.type == MSG_PRIVMSG) + flag = SilenceEntry::SF_PRIVMSG_USER; + + if (!CanReceiveMessage(user, target.Get(), flag)) + { + details.echo_original = true; + return MOD_RES_DENY; + } + break; } + case MessageTarget::TYPE_SERVER: + break; } return MOD_RES_PASSTHRU; @@ -431,7 +437,7 @@ class ModuleSilence Version GetVersion() CXX11_OVERRIDE { - return Version("Provides support for blocking users with the /SILENCE command", VF_OPTCOMMON | VF_VENDOR); + return Version("Provides support for blocking users with the SILENCE command", VF_OPTCOMMON | VF_VENDOR); } };