diff options
author | DukePyrolator <DukePyrolator@anope.org> | 2010-12-14 08:13:09 +0100 |
---|---|---|
committer | DukePyrolator <DukePyrolator@anope.org> | 2010-12-14 08:13:09 +0100 |
commit | 02476332ea2f5ab3fd766e0ca9d83d67a9a9f122 (patch) | |
tree | 4e75a625d87bea08faf16619fb27ff75f83d8c19 /src | |
parent | 6a43886807c74503dd89ad6bae0e5605a3e21210 (diff) | |
parent | 49d3c97b677f319460146803004066dfd3d19089 (diff) |
Merge branch '1.9' of ssh://anope.git.sourceforge.net/gitroot/anope/anope into 1.9
Diffstat (limited to 'src')
-rw-r--r-- | src/actions.cpp | 20 | ||||
-rw-r--r-- | src/channels.cpp | 37 | ||||
-rw-r--r-- | src/dns.cpp | 1 | ||||
-rw-r--r-- | src/language.cpp | 4 |
4 files changed, 35 insertions, 27 deletions
diff --git a/src/actions.cpp b/src/actions.cpp index b583cafae..6df607460 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -67,25 +67,21 @@ void kill_user(const Anope::string &source, User *user, const Anope::string &rea * Unban the user from a channel * @param ci channel info for the channel * @param u The user to unban + * @param full True to match against the users real host and IP * @return void */ -void common_unban(ChannelInfo *ci, User *u) +void common_unban(ChannelInfo *ci, User *u, bool full) { if (!u || !ci || !ci->c || !ci->c->HasMode(CMODE_BAN)) return; - if (ircd->svsmode_unban) - ircdproto->SendBanDel(ci->c, u->nick); - else + std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> bans = ci->c->GetModeList(CMODE_BAN); + for (; bans.first != bans.second;) { - std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> bans = ci->c->GetModeList(CMODE_BAN); - for (; bans.first != bans.second;) - { - Entry ban(bans.first->second); - ++bans.first; - if (ban.Matches(u)) - ci->c->RemoveMode(NULL, CMODE_BAN, ban.GetMask()); - } + Entry ban(bans.first->second); + ++bans.first; + if (ban.Matches(u, full)) + ci->c->RemoveMode(NULL, CMODE_BAN, ban.GetMask()); } } diff --git a/src/channels.cpp b/src/channels.cpp index f146c17dd..c8c52f188 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -294,7 +294,10 @@ size_t Channel::HasMode(ChannelModeName Name, const Anope::string ¶m) */ std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> Channel::GetModeList(ChannelModeName Name) { - return std::make_pair(this->modes.find(Name), this->modes.upper_bound(Name)); + Channel::ModeList::iterator it = this->modes.find(Name), it_end = it; + if (it != this->modes.end()) + it_end = this->modes.upper_bound(Name); + return std::make_pair(it, it_end); } /** Set a mode internally on a channel, this is not sent out to the IRCd @@ -1327,17 +1330,14 @@ const Anope::string Entry::GetMask() /** Check if this entry matches a user * @param u The user + * @param full True to match against a users real host and IP * @return true on match */ -bool Entry::Matches(User *u) const +bool Entry::Matches(User *u, bool full) const { if (!this->FlagCount()) - return 0; + return false; - Anope::string _nick = u->nick; - Anope::string _user = u->GetVIdent(); - Anope::string _host = u->GetDisplayedHost(); - if (this->HasFlag(ENTRYTYPE_CIDR)) { try @@ -1347,23 +1347,34 @@ bool Entry::Matches(User *u) const { return false; } + /* If we're not matching fully and their displayed host isnt their IP */ + else if (!full && u->ip.addr() != u->GetDisplayedHost()) + { + return false; + } } catch (const SocketException &) { return false; } } - if (this->HasFlag(ENTRYTYPE_NICK) && (_nick.empty() || !this->nick.equals_ci(_nick))) + if (this->HasFlag(ENTRYTYPE_NICK) && !this->nick.equals_ci(u->nick)) return false; - if (this->HasFlag(ENTRYTYPE_USER) && (_user.empty() || !this->user.equals_ci(_user))) + if (this->HasFlag(ENTRYTYPE_USER) && !this->user.equals_ci(u->GetVIdent()) && (!full || + !this->user.equals_ci(u->GetIdent()))) return false; - if (this->HasFlag(ENTRYTYPE_HOST) && (_host.empty() || !this->host.equals_ci(_host))) + if (this->HasFlag(ENTRYTYPE_HOST) && !this->host.equals_ci(u->GetDisplayedHost()) && (!full || + (!this->host.equals_ci(u->host) && !this->host.equals_ci(u->chost) && !this->host.equals_ci(u->vhost) && + (!u->ip() || !this->host.equals_ci(u->ip.addr()))))) return false; - if (this->HasFlag(ENTRYTYPE_NICK_WILD) && !Anope::Match(_nick, this->nick)) + if (this->HasFlag(ENTRYTYPE_NICK_WILD) && !Anope::Match(u->nick, this->nick)) return false; - if (this->HasFlag(ENTRYTYPE_USER_WILD) && !Anope::Match(_user, this->user)) + if (this->HasFlag(ENTRYTYPE_USER_WILD) && !Anope::Match(u->GetVIdent(), this->user) && (!full || + !Anope::Match(u->GetIdent(), this->user))) return false; - if (this->HasFlag(ENTRYTYPE_HOST_WILD) && !Anope::Match(_host, this->host)) + if (this->HasFlag(ENTRYTYPE_HOST_WILD) && !Anope::Match(u->GetDisplayedHost(), this->host) && (!full || + (!Anope::Match(u->host, this->host) && !Anope::Match(u->chost, this->host) && + !Anope::Match(u->vhost, this->host) && (!u->ip() || !Anope::Match(u->ip.addr(), this->host))))) return false; return true; diff --git a/src/dns.cpp b/src/dns.cpp index 5bdd2a4eb..b37a0bde6 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -559,7 +559,6 @@ void DNSManager::Tick(time_t now) for (std::multimap<Anope::string, DNSRecord *>::iterator it = this->cache.begin(), it_next; it != this->cache.end(); it = it_next) { - Anope::string host = it->first; DNSRecord *req = it->second; it_next = it; ++it_next; diff --git a/src/language.cpp b/src/language.cpp index 3e7a3e2f7..13e1675f5 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -4856,7 +4856,9 @@ const char *const language_strings[LANG_STRING_COUNT] = { "%S HELP command."), /* BOT_HELP_FOOTER */ _("Bot will join a channel whenever there is at least\n" - "%d user(s) on it."), + "%d user(s) on it. Additionally, all %s commands\n" + "can be used if fantasy is enabled by prefixing the command\n" + "name with a %c."), /* BOT_HELP_BOTLIST */ _("Syntax: BOTLIST\n" " \n" |