summaryrefslogtreecommitdiff
path: root/modules/pseudoclients
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-04-07 23:46:44 -0500
committerAdam <Adam@anope.org>2013-04-07 23:46:44 -0500
commitfb7fef7a849342ab8463743497e781c5c3e6ae88 (patch)
tree5d230a68b6eed70c7b4f718410dd62fea779654c /modules/pseudoclients
parent36602224b8b1a11326a224779d16bcb12f0ed532 (diff)
Optimizations of much of the more commonly used code
Diffstat (limited to 'modules/pseudoclients')
-rw-r--r--modules/pseudoclients/chanserv.cpp4
-rw-r--r--modules/pseudoclients/memoserv.cpp4
-rw-r--r--modules/pseudoclients/nickserv.cpp4
-rw-r--r--modules/pseudoclients/operserv.cpp18
4 files changed, 9 insertions, 21 deletions
diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp
index 7b59c0597..21a2f75f7 100644
--- a/modules/pseudoclients/chanserv.cpp
+++ b/modules/pseudoclients/chanserv.cpp
@@ -35,8 +35,8 @@ class ExpireCallback : public Timer
if (ci->c)
{
time_t last_used = ci->last_used;
- for (User::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end && last_used == ci->last_used; ++cit)
- ci->AccessFor((*cit)->user);
+ for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end && last_used == ci->last_used; ++cit)
+ ci->AccessFor(cit->second->user);
expire = last_used == ci->last_used;
}
else
diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp
index 73dd48b94..d28774e34 100644
--- a/modules/pseudoclients/memoserv.cpp
+++ b/modules/pseudoclients/memoserv.cpp
@@ -81,7 +81,7 @@ class MyMemoServService : public MemoServService
{
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
{
- ChanUserContainer *cu = *it;
+ ChanUserContainer *cu = it->second;
if (ci->AccessFor(cu->user).HasPriv("MEMO"))
{
@@ -171,7 +171,7 @@ class MemoServCore : public Module
void OnJoinChannel(User *u, Channel *c) anope_override
{
- if (c->ci && c->ci->AccessFor(u).HasPriv("MEMO") && c->ci->memos.memos->size() > 0)
+ if (c->ci && !c->ci->memos.memos->empty() && c->ci->AccessFor(u).HasPriv("MEMO"))
{
if (c->ci->memos.memos->size() == 1)
u->SendMessage(MemoServ, _("There is \002%d\002 memo on channel %s."), c->ci->memos.memos->size(), c->ci->name.c_str());
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index e221c19c0..35319e552 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -257,7 +257,7 @@ class NickServCore : public Module
if (Config->NSModeOnID)
for (User::ChanUserList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it)
{
- ChanUserContainer *cc = *it;
+ ChanUserContainer *cc = it->second;
Channel *c = cc->chan;
if (c)
c->SetCorrectModes(u, true, true);
@@ -296,7 +296,7 @@ class NickServCore : public Module
{
for (User::ChanUserList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it)
{
- ChanUserContainer *cc = *it;
+ ChanUserContainer *cc = it->second;
Channel *c = cc->chan;
if (c)
c->SetCorrectModes(u, true, true);
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index 10908ef03..b2463dc4f 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -35,19 +35,7 @@ class SGLineManager : public XLineManager
void SendDel(XLine *x) anope_override
{
- try
- {
- if (!IRCD->CanSZLine)
- throw SocketException("SZLine is not supported");
- else if (x->GetUser() != "*")
- throw SocketException("Can not ZLine a username");
- sockaddrs(x->GetHost());
- IRCD->SendSZLineDel(x);
- }
- catch (const SocketException &)
- {
- IRCD->SendAkillDel(x);
- }
+ IRCD->SendAkillDel(x);
}
bool Check(User *u, const XLine *x) anope_override
@@ -70,7 +58,7 @@ class SGLineManager : public XLineManager
if (!x->GetReal().empty() && !Anope::Match(u->realname, x->GetReal()))
return false;
- if (!x->GetHost().empty())
+ if (x->GetHost().find('/') != Anope::string::npos)
{
try
{
@@ -82,7 +70,7 @@ class SGLineManager : public XLineManager
catch (const SocketException &) { }
}
- if (x->GetHost().empty() || Anope::Match(u->host, x->GetHost()))
+ if (x->GetHost().empty() || Anope::Match(u->host, x->GetHost()) || Anope::Match(u->ip, x->GetHost()))
return true;
return false;