From 4490e273b1dc62fae144daa3b3cf655156fd1ef0 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 26 Nov 2006 19:00:43 +0000 Subject: [PATCH] SILENCE_CNOTICE, flag 't'. Needs testing, peavey should probably review to check it fits in with what he was doing :p git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5810 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_silence_ext.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/modules/m_silence_ext.cpp b/src/modules/m_silence_ext.cpp index a9878f963..e3f8826e9 100644 --- a/src/modules/m_silence_ext.cpp +++ b/src/modules/m_silence_ext.cpp @@ -59,8 +59,9 @@ static int SILENCE_PRIVATE = 0x0001; /* p private messages */ static int SILENCE_CHANNEL = 0x0002; /* c channel messages */ static int SILENCE_INVITE = 0x0004; /* i invites */ static int SILENCE_NOTICE = 0x0008; /* n notices */ -static int SILENCE_ALL = 0x0010; /* a all, (pcin) */ -static int SILENCE_EXCLUDE = 0x0020; /* x exclude this pattern */ +static int SILENCE_CNOTICE = 0x0010; /* t channel notices */ +static int SILENCE_ALL = 0x0020; /* a all, (pcint) */ +static int SILENCE_EXCLUDE = 0x0040; /* x exclude this pattern */ class cmd_silence : public command_t @@ -69,7 +70,7 @@ class cmd_silence : public command_t cmd_silence (InspIRCd* Instance) : command_t(Instance,"SILENCE", 0, 0) { this->source = "m_silence_ext.so"; - syntax = "{[+|-] }"; + syntax = "{[+|-] }"; } CmdResult Handle (const char** parameters, int pcnt, userrec *user) @@ -183,9 +184,9 @@ class cmd_silence : public command_t int CompilePattern(const char* pattern) { int p = 0; - for (uint n = 0; n < strlen(pattern); n++) + for (const char* n = pattern; *n; n++) { - switch (pattern[n]) + switch (*n) { case 'p': p |= SILENCE_PRIVATE; @@ -199,6 +200,9 @@ class cmd_silence : public command_t case 'n': p |= SILENCE_NOTICE; break; + case 't': + p |= SILENCE_CNOTICE; + break; case 'a': p |= SILENCE_ALL; break; @@ -217,13 +221,15 @@ class cmd_silence : public command_t { std::string out = ""; if ((pattern & SILENCE_PRIVATE) > 0) - out += ",private"; + out += ",privatemessages"; if ((pattern & SILENCE_CHANNEL) > 0) - out += ",channel"; + out += ",channelmessages"; if ((pattern & SILENCE_INVITE) > 0) out += ",invites"; if ((pattern & SILENCE_NOTICE) > 0) - out += ",notices"; + out += ",privatenotices"; + if ((pattern & SILENCE_CNOTICE) > 0) + out += ",channelnotices"; if ((pattern & SILENCE_ALL) > 0) out = ",all"; if ((pattern & SILENCE_EXCLUDE) > 0) @@ -303,7 +309,7 @@ class ModuleSilence : public Module { if ((IS_LOCAL(i->second)) && (user != i->second)) { - if (MatchPattern(i->second, user, SILENCE_CHANNEL) == 1) + if (MatchPattern(i->second, user, silence_type == SILENCE_PRIVATE ? SILENCE_CHANNEL : SILENCE_CNOTICE) == 1) { exempt_list[i->second] = i->second; } -- 2.39.5