summaryrefslogtreecommitdiff
path: root/src/modules/m_deaf.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-27 17:45:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-27 17:45:16 +0000
commit9f34f8d94e6cbbd2656878b37c6bc3ffcca4b1f0 (patch)
treec102d0139ecf32eee28be72d9923c5d43bfc9732 /src/modules/m_deaf.cpp
parent439cff2dc8683bbd4005c3456ee6c9f1f3236224 (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_deaf.cpp')
-rw-r--r--src/modules/m_deaf.cpp61
1 files changed, 33 insertions, 28 deletions
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 67c2b7210..6ec65437c 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -65,7 +65,7 @@ class ModuleDeaf : public Module
void Implements(char* List)
{
- List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
+ List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnBuildExemptList] = 1;
}
virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
@@ -78,6 +78,37 @@ class ModuleDeaf : public Module
return PreText(user, dest, target_type, text, status, exempt_list);
}
+ virtual void OnBuildExemptList(MessageType message_type, chanrec* chan, userrec* sender, char status, CUList &exempt_list)
+ {
+ 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 (i->second->IsModeSet('d'))
+ {
+ exempt_list[i->second] = i->second;
+ }
+ }
+ }
+ }
+
virtual int PreText(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
@@ -85,33 +116,7 @@ class ModuleDeaf : public Module
chanrec* chan = (chanrec*)dest;
if (chan)
{
- 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)) && (user != i->second))
- {
- if (i->second->IsModeSet('d'))
- {
- exempt_list[i->second] = i->second;
- }
- }
- }
+ this->OnBuildExemptList(chan, status, exempt_list);
}
}
return 0;