From 29fd51d6f76a639fbd909e7bf7489eb92e9f90db Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 2 Sep 2006 14:09:45 +0000 Subject: Add chanrec::IsBanned() so that we dont have to keep walking the banlist in various modules and using match() git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5099 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_override.cpp | 13 ++++--------- src/modules/m_timedbans.cpp | 9 +++------ 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 342e42829..7dd58d8c2 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -231,17 +231,12 @@ class ModuleOverride : public Module if (CanOverride(user,"BANWALK")) { - for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++) + if (chan->IsBanned(user)) { - char mask[MAXBUF]; - sprintf(mask,"%s!%s@%s",user->nick, user->ident, user->GetIPString()); - if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true))) + if (NoisyOverride) { - if (NoisyOverride) - { - chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass channel bans on %s", cname, user->nick,i->data); - ServerInstance->SNO->WriteToSnoMask('O',"%s used oper-override to bypass channel bans on %s", cname, user->nick, i->data); - } + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass channel ban", cname, user->nick); + ServerInstance->SNO->WriteToSnoMask('O',"%s used oper-override to bypass channel ban", cname, user->nick); } } return -1; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 8639aa7df..08da114a6 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -64,13 +64,10 @@ class cmd_tban : public command_t user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban mask"); return; } - for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++) + if (channel->IsBanned(user)) { - if (!strcasecmp(i->data,parameters[2])) - { - user->WriteServ("NOTICE "+std::string(user->nick)+" :The ban "+std::string(parameters[2])+" is already on the banlist of "+std::string(parameters[0])); - return; - } + user->WriteServ("NOTICE "+std::string(user->nick)+" :The ban "+std::string(parameters[2])+" is already on the banlist of "+std::string(parameters[0])); + return; } TimedBan T; std::string channelname = parameters[0]; -- cgit v1.2.3