summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-07-12 21:30:44 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-07-12 21:30:44 +0000
commitbb7d85d51e2d51ac13f335b13dfa1f8e8ba3e23b (patch)
treed4cec82b6cca61bc4cce6eb0ccf990a80dbfe034
parent4676743fac7383346b7768e7a98f25e16b68826f (diff)
Add support for ban exceptions on non-user extbans (e.g, +be r:*lol* r:lol?is?gay will now hopefully work)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9992 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_banexception.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index 3cb2d264c..e22ada43d 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -50,8 +50,8 @@ public:
ServerInstance->Modules->PublishInterface("ChannelBanList", this);
be->DoImplements(this);
- Implementation list[] = { I_OnRehash, I_OnRequest, I_On005Numeric, I_OnCheckBan, I_OnCheckExtBan };
- Me->Modules->Attach(list, this, 5);
+ Implementation list[] = { I_OnRehash, I_OnRequest, I_On005Numeric, I_OnCheckBan, I_OnCheckExtBan, I_OnCheckStringExtBan };
+ Me->Modules->Attach(list, this, 6);
}
@@ -89,6 +89,29 @@ public:
return 0;
}
+ virtual int OnCheckStringExtBan(const std::string &str, Channel *chan, char type)
+ {
+ if (chan != NULL)
+ {
+ modelist *list;
+ chan->GetExt(be->GetInfoKey(), list);
+
+ if (!list)
+ return 0;
+ for (modelist::iterator it = list->begin(); it != list->end(); it++)
+ {
+ if (it->mask[0] != type || it->mask[1] != ':')
+ continue;
+
+ std::string maskptr = it->mask.substr(2);
+ if (match(maskptr, str))
+ return 1; // matches
+ }
+ }
+
+ return 0;
+ }
+
virtual int OnCheckBan(User* user, Channel* chan)
{
if (chan != NULL)