summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@anope.org>2010-12-23 07:15:32 +0100
committerDukePyrolator <DukePyrolator@anope.org>2010-12-23 07:15:32 +0100
commita0ad3c4fef7e35c68dee128950ef95c0c56849fe (patch)
treea9096244ac74dc31d959e9b6426453de90c28d03
parent184e7b3f64beb104e2d676048fc5bf485c5ad743 (diff)
parent265006b69176e1d8130284c63bcb50a1b67a426f (diff)
Merge branch '1.9' of ssh://anope.git.sourceforge.net/gitroot/anope/anope into 1.9
-rw-r--r--include/extern.h1
-rw-r--r--include/operserv.h2
-rw-r--r--modules/core/cs_akick.cpp4
-rw-r--r--modules/core/os_sqline.cpp7
-rw-r--r--src/operserv.cpp5
-rw-r--r--src/process.cpp5
-rw-r--r--src/regchannel.cpp11
-rw-r--r--src/users.cpp30
8 files changed, 24 insertions, 41 deletions
diff --git a/include/extern.h b/include/extern.h
index 59d0c238e..7dc49e929 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -352,7 +352,6 @@ E void do_kill(User *user, const Anope::string &reason);
E bool is_excepted(ChannelInfo *ci, User *user);
E bool is_excepted_mask(ChannelInfo *ci, const Anope::string &mask);
-E bool match_usermask(const Anope::string &mask, User *user);
E Anope::string create_mask(User *u);
/******************************************************************************/
diff --git a/include/operserv.h b/include/operserv.h
index 8bac11e76..20d24ae5d 100644
--- a/include/operserv.h
+++ b/include/operserv.h
@@ -142,11 +142,13 @@ class CoreExport XLineManager
*/
virtual XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
+ private:
/** Delete an XLine, eg, remove it from the IRCd.
* @param x The xline
*/
virtual void Del(XLine *x);
+ public:
/** Checks if a mask can/should be added to the XLineManager
* @param mask The mask
* @param expires When the mask would expire
diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp
index 20ceb7c10..1e2d910b7 100644
--- a/modules/core/cs_akick.cpp
+++ b/modules/core/cs_akick.cpp
@@ -220,7 +220,9 @@ class CommandCSAKick : public Command
ChanAccess *u2_access = ci->GetAccess(nc), *u_access = ci->GetAccess(u);
int16 u2_level = u2_access ? u2_access->level : 0, u_level = u_access ? u_access->level : 0;
- if ((check_access(u2, ci, CA_FOUNDER) || u2_level >= u_level) && match_usermask(mask, u2))
+ Entry entry_mask(mask);
+
+ if ((check_access(u2, ci, CA_FOUNDER) || u2_level >= u_level) && entry_mask.Matches(u2))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/core/os_sqline.cpp b/modules/core/os_sqline.cpp
index d5184a8cc..3a49099cc 100644
--- a/modules/core/os_sqline.cpp
+++ b/modules/core/os_sqline.cpp
@@ -170,12 +170,9 @@ class CommandOSSQLine : public Command
reason += " " + params[3];
if (!mask.empty() && !reason.empty())
{
- User *user = finduser(mask);
- if (user)
- mask = "*@" + user->host;
unsigned int affected = 0;
for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
- if (Anope::Match((*it)->GetIdent() + "@" + (*it)->host, mask))
+ if (Anope::Match((*it)->nick, mask))
++affected;
float percent = static_cast<float>(affected) / static_cast<float>(UserListByNick.size()) * 100.0;
@@ -370,7 +367,7 @@ class CommandOSSQLine : public Command
{
User *u = source.u;
FOREACH_MOD(I_OnDelXLine, OnDelXLine(u, NULL, X_SQLINE));
- SGLine->Clear();
+ SQLine->Clear();
source.Reply(OPER_SQLINE_CLEAR);
return MOD_CONT;
diff --git a/src/operserv.cpp b/src/operserv.cpp
index 46b09980d..c76b34375 100644
--- a/src/operserv.cpp
+++ b/src/operserv.cpp
@@ -297,6 +297,8 @@ bool XLineManager::DelXLine(XLine *x)
if (it != this->XLines.end())
{
+ this->Del(x);
+
delete x;
this->XLines.erase(it);
@@ -427,7 +429,8 @@ XLine *XLineManager::Check(User *u)
if (x->Expires && x->Expires < Anope::CurTime)
{
- OnExpire(x);
+ this->OnExpire(x);
+ this->Del(x);
delete x;
this->XLines.erase(XLines.begin() + i - 1);
continue;
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.*);