diff options
| author | 2006-11-27 17:45:16 +0000 | |
|---|---|---|
| committer | 2006-11-27 17:45:16 +0000 | |
| commit | 9f34f8d94e6cbbd2656878b37c6bc3ffcca4b1f0 (patch) | |
| tree | c102d0139ecf32eee28be72d9923c5d43bfc9732 /src/modules/m_silence_ext.cpp | |
| parent | Add OnBuildExemptList, which is used to build an exempt list when passing a p... (diff) | |
BuildExemptList is becoming pretty ugly. grr.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5819 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_silence_ext.cpp')
| -rw-r--r-- | src/modules/m_silence_ext.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/modules/m_silence_ext.cpp b/src/modules/m_silence_ext.cpp index a6a7f60ca..19abc679f 100644 --- a/src/modules/m_silence_ext.cpp +++ b/src/modules/m_silence_ext.cpp @@ -255,7 +255,7 @@ class ModuleSilence : public Module void Implements(char* List) { - List[I_OnUserQuit] = List[I_On005Numeric] = List[I_OnUserPreNotice] = List[I_OnUserPreMessage] = List[I_OnUserPreInvite] = 1; + List[I_OnBuildExemptList] = List[I_OnUserQuit] = List[I_On005Numeric] = List[I_OnUserPreNotice] = List[I_OnUserPreMessage] = List[I_OnUserPreInvite] = 1; } virtual void OnUserQuit(userrec* user, const std::string &reason) @@ -276,6 +276,37 @@ class ModuleSilence : public Module output = output + " ESILENCE SILENCE=999"; } + virtual void OnBuildExemptList(MessageType message_type, chanrec* chan, userrec* sender, char status, CUList &exempt_list) + { + int public_silence = (message_type == MSG_PRIVMSG ? SILENCE_CHANNEL : SILENCE_CNOTICE); + CUList *ulist; + switch (status) + { + case '@': + ulist = chan->GetOppedUsers(); + break; + case '%': + ulist = chan->GetHalfoppedUsers(); + break; + case '+': + ulist = chan->GetVoicedUsers(); + break; + default: + ulist = chan->GetUsers(); + break; + } + + for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) + { + if (IS_LOCAL(i->second)) + { + if (MatchPattern(i->second, sender, public_silence) == 1) + { + exempt_list[i->second] = i->second; + } + } + } + } virtual int PreText(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list, int silence_type) { |
