diff options
author | Adam <Adam@anope.org> | 2010-12-22 18:28:22 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-22 18:28:22 -0500 |
commit | 2783c82685c5d04eec942cc21ed43b9b773330fb (patch) | |
tree | 492ebb9ba430324dcaedb4e536ff90d652501163 /src | |
parent | 18377ac9fd36065bfd791b5cea51de9ae1d2b11d (diff) |
Removed match_usermask
Diffstat (limited to 'src')
-rw-r--r-- | src/process.cpp | 5 | ||||
-rw-r--r-- | src/regchannel.cpp | 11 | ||||
-rw-r--r-- | src/users.cpp | 30 |
3 files changed, 13 insertions, 33 deletions
diff --git a/src/process.cpp b/src/process.cpp index 4a7811c69..0f714e9f0 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -104,8 +104,11 @@ IgnoreData *get_ignore(const Anope::string &nick) if (u->HasMode(UMODE_OPER)) return NULL; for (; ign != ign_end; ++ign) - if (match_usermask((*ign)->mask, u)) + { + Entry ignore_mask((*ign)->mask); + if (ignore_mask.Matches(u)) break; + } } else { diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 1932da4e8..62dc94b3d 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -748,7 +748,15 @@ bool ChannelInfo::CheckKick(User *user) { AutoKick *autokick = this->GetAkick(j); - if ((autokick->HasFlag(AK_ISNICK) && autokick->nc == nc) || (!autokick->HasFlag(AK_ISNICK) && match_usermask(autokick->mask, user))) + if (autokick->HasFlag(AK_ISNICK) && autokick->nc == nc) + do_kick = true; + else + { + Entry akick_mask(autokick->mask); + if (akick_mask.Matches(user)) + do_kick = true; + } + if (do_kick) { Log(LOG_DEBUG_2) << user->nick << " matched akick " << (autokick->HasFlag(AK_ISNICK) ? autokick->nc->display : autokick->mask); autokick->last_used = Anope::CurTime; @@ -757,7 +765,6 @@ bool ChannelInfo::CheckKick(User *user) else mask = autokick->mask; reason = autokick->reason.empty() ? Config->CSAutokickReason : autokick->reason; - do_kick = true; break; } } diff --git a/src/users.cpp b/src/users.cpp index 0290e9efb..235270070 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -914,36 +914,6 @@ bool is_excepted_mask(ChannelInfo *ci, const Anope::string &mask) /*************************************************************************/ -/* Does the user's usermask match the given mask (either nick!user@host or - * just user@host)? - */ - -bool match_usermask(const Anope::string &mask, User *user) -{ - if (mask.empty()) - return false; - - Anope::string mask2 = mask, nick, username, host; - size_t ex = mask2.find('!'); - if (ex != Anope::string::npos) - { - nick = mask2.substr(0, ex); - mask2 = mask2.substr(ex + 1); - } - size_t at = mask2.find('@'); - if (at != Anope::string::npos) - { - username = mask2.substr(0, at); - host = mask2.substr(at + 1); - } - if (username.empty() || host.empty()) - return 0; - - return (nick.empty() ? true : Anope::Match(user->nick, nick)) && Anope::Match(user->GetIdent(), username) && (Anope::Match(user->host, host) || Anope::Match(user->GetDisplayedHost(), host)); -} - -/*************************************************************************/ - /* Given a user, return a mask that will most likely match any address the * user will have from that location. For IP addresses, wildcards the * appropriate subnet mask (e.g. 35.1.1.1 -> 35.*; 128.2.1.1 -> 128.2.*); |