X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fchannels.cpp;h=d917edb84b6bfd03f4a301594ba56ccd19091eb2;hb=12ffb909a66401f540234aecbeeee6f94ef2fc6d;hp=47dfd91b6b84cea07a6b846c7a51fa39026b082f;hpb=0b070b52bc8e8ceb52388e45cea90f4add119c4f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/channels.cpp b/src/channels.cpp index 47dfd91b6..d917edb84 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -453,26 +453,32 @@ bool Channel::IsBanned(User* user) bool Channel::IsExtBanned(User *user, char type) { - // XXX. do we need events? char mask[MAXBUF]; + int MOD_RESULT = 0; + FOREACH_RESULT(I_OnCheckExtBan,OnCheckExtBan(user, this, type)); - snprintf(mask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->GetIPString()); - - for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++) + if (MOD_RESULT == -1) + return true; + else if (MOD_RESULT == 0) { - if (i->data[0] != type || i->data[1] != ':') - continue; - - // Iterate past char and : to get to the mask without doing a data copy(!) - std::string maskptr = i->data.substr(2); + snprintf(mask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->GetIPString()); - /* This allows CIDR ban matching - * - * Full masked host Full unmasked host IP with/without CIDR - */ - if ((match(user->GetFullHost(), maskptr)) || (match(user->GetFullRealHost(), maskptr)) || (match(mask, maskptr, true))) + for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++) { - return true; + if (i->data[0] != type || i->data[1] != ':') + continue; + + // Iterate past char and : to get to the mask without doing a data copy(!) + std::string maskptr = i->data.substr(2); + + /* This allows CIDR ban matching + * + * Full masked host Full unmasked host IP with/without CIDR + */ + if ((match(user->GetFullHost(), maskptr)) || (match(user->GetFullRealHost(), maskptr)) || (match(mask, maskptr, true))) + { + return true; + } } }