+int Channel::GetExtBanStatus(const std::string &str, char type)
+{
+ int result = 0;
+ FOREACH_RESULT_MAP(I_OnCheckStringExtBan, OnCheckStringExtBan(str, this, type),
+ result = banmatch_reduce(result, MOD_RESULT);
+ );
+
+ if (result)
+ return result;
+
+ // nobody decided for us, check the ban list
+ for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++)
+ {
+ if (i->data[0] != type || i->data[1] != ':')
+ continue;
+
+ std::string maskptr = i->data.substr(2);
+ ServerInstance->Logs->Log("EXTBANS", DEBUG, "Checking %s against %s, type is %c", str.c_str(), maskptr.c_str(), type);
+
+ if (InspIRCd::Match(str, maskptr, NULL))
+ return -1;
+ }
+
+ return 0;
+}
+
+int Channel::GetExtBanStatus(User *user, char type)
+{
+ int result = 0;
+ FOREACH_RESULT_MAP(I_OnCheckExtBan, OnCheckExtBan(user, this, type),
+ result = banmatch_reduce(result, MOD_RESULT);
+ );
+
+ if (result)
+ return result;
+
+ char mask[MAXBUF];
+ int rv = 0;
+ snprintf(mask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->GetIPString());
+
+ // XXX: we should probably hook cloaked hosts in here somehow too..
+ rv = banmatch_reduce(rv, this->GetExtBanStatus(mask, type));
+ rv = banmatch_reduce(rv, this->GetExtBanStatus(user->GetFullHost(), type));
+ rv = banmatch_reduce(rv, this->GetExtBanStatus(user->GetFullRealHost(), type));
+ return rv;
+}
+