summaryrefslogtreecommitdiff
path: root/src/modules/m_banexception.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-07-11 21:34:45 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-07-11 21:34:45 +0000
commit328b3ef85647685811c680e67005ec82a0c66c11 (patch)
tree2b16eb1c3e78c7fce41a67b7e8ced02906246969 /src/modules/m_banexception.cpp
parentbd2782b9e80f10f91810fcc819bd6d77f1c991a0 (diff)
Extended ban exceptions (untested, probably will explode as I'm tired..)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9958 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_banexception.cpp')
-rw-r--r--src/modules/m_banexception.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index 2a0bafc25..3cb2d264c 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 };
- Me->Modules->Attach(list, this, 4);
+ Implementation list[] = { I_OnRehash, I_OnRequest, I_On005Numeric, I_OnCheckBan, I_OnCheckExtBan };
+ Me->Modules->Attach(list, this, 5);
}
@@ -60,6 +60,35 @@ public:
output.append(" EXCEPTS=e");
}
+ virtual int OnCheckExtBan(User *user, Channel *chan, char type)
+ {
+ if (chan != NULL)
+ {
+ modelist *list;
+ chan->GetExt(be->GetInfoKey(), list);
+
+ if (!list)
+ return 0;
+
+ std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString();
+ 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(user->GetFullRealHost(), maskptr) || match(user->GetFullHost(), maskptr) || (match(mask, maskptr, true)))
+ {
+ // They match an entry on the list, so let them pass this.
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+ }
+
virtual int OnCheckBan(User* user, Channel* chan)
{
if (chan != NULL)