summaryrefslogtreecommitdiff
path: root/modules/pseudoclients
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pseudoclients')
-rw-r--r--modules/pseudoclients/botserv.cpp6
-rw-r--r--modules/pseudoclients/chanserv.cpp24
-rw-r--r--modules/pseudoclients/global.cpp12
-rw-r--r--modules/pseudoclients/global.h2
-rw-r--r--modules/pseudoclients/hostserv.cpp6
-rw-r--r--modules/pseudoclients/memoserv.cpp46
-rw-r--r--modules/pseudoclients/nickserv.cpp37
-rw-r--r--modules/pseudoclients/operserv.cpp31
8 files changed, 81 insertions, 83 deletions
diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp
index 6b8c91d4e..8c7b08ae4 100644
--- a/modules/pseudoclients/botserv.cpp
+++ b/modules/pseudoclients/botserv.cpp
@@ -21,7 +21,7 @@ class BotServCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *BotServ = findbot(Config->BotServ);
+ const BotInfo *BotServ = findbot(Config->BotServ);
if (BotServ == NULL)
throw ModuleException("No bot named " + Config->BotServ);
@@ -160,7 +160,7 @@ class BotServCore : public Module
if (c->HasFlag(CH_INHABIT))
return;
- if (c->ci && c->ci->bi && u != c->ci->bi && c->users.size() - 1 <= Config->BSMinUsers && c->FindUser(c->ci->bi))
+ if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->BSMinUsers && c->FindUser(c->ci->bi))
{
bool persist = c->HasFlag(CH_PERSIST);
c->SetFlag(CH_PERSIST);
@@ -203,7 +203,7 @@ class BotServCore : public Module
{
if (Config->BSSmartJoin && Name == CMODE_BAN && c->ci && c->ci->bi && c->FindUser(c->ci->bi))
{
- BotInfo *bi = c->ci->bi;
+ const BotInfo *bi = c->ci->bi;
Entry ban(CMODE_BAN, param);
if (ban.Matches(bi))
diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp
index f1ad3ec6a..408815afc 100644
--- a/modules/pseudoclients/chanserv.cpp
+++ b/modules/pseudoclients/chanserv.cpp
@@ -23,7 +23,7 @@ class ExpireCallback : public CallBack
if (!Config->CSExpire || noexpire || readonly)
return;
- for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; )
+ for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; )
{
ChannelInfo *ci = it->second;
++it;
@@ -46,7 +46,7 @@ class ExpireCallback : public CallBack
Log(LOG_NORMAL, "chanserv/expire") << "Expiring " << extra << "channel " << ci->name << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << ")";
FOREACH_MOD(I_OnChanExpire, OnChanExpire(ci));
- delete ci;
+ ci->destroy();
}
}
}
@@ -61,7 +61,7 @@ class ChanServCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *ChanServ = findbot(Config->ChanServ);
+ const BotInfo *ChanServ = findbot(Config->ChanServ);
if (ChanServ == NULL)
throw ModuleException("No bot named " + Config->ChanServ);
@@ -83,7 +83,7 @@ class ChanServCore : public Module
void OnDelCore(NickCore *nc) anope_override
{
// XXX this is slightly inefficient
- for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end;)
+ for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end;)
{
ChannelInfo *ci = it->second;
++it;
@@ -95,11 +95,11 @@ class ChanServCore : public Module
newowner = ci->successor;
else
{
- ChanAccess *highest = NULL;
+ const ChanAccess *highest = NULL;
for (unsigned j = 0; j < ci->GetAccessCount(); ++j)
{
- ChanAccess *ca = ci->GetAccess(j);
- NickCore *anc = findcore(ca->mask);
+ const ChanAccess *ca = ci->GetAccess(j);
+ const NickCore *anc = findcore(ca->mask);
if (!anc || (!anc->IsServicesOper() && Config->CSMaxReg && anc->channelcount >= Config->CSMaxReg) || (anc == nc))
continue;
@@ -120,7 +120,7 @@ class ChanServCore : public Module
{
Log(LOG_NORMAL, "chanserv/expire") << "Deleting channel " << ci->name << " owned by deleted nick " << nc->display;
- delete ci;
+ ci->destroy();
continue;
}
}
@@ -130,8 +130,8 @@ class ChanServCore : public Module
for (unsigned j = 0; j < ci->GetAccessCount(); ++j)
{
- ChanAccess *ca = ci->GetAccess(j);
- NickCore *anc = findcore(ca->mask);
+ const ChanAccess *ca = ci->GetAccess(j);
+ const NickCore *anc = findcore(ca->mask);
if (anc && anc == nc)
{
@@ -142,7 +142,7 @@ class ChanServCore : public Module
for (unsigned j = ci->GetAkickCount(); j > 0; --j)
{
- AutoKick *akick = ci->GetAkick(j - 1);
+ const AutoKick *akick = ci->GetAkick(j - 1);
if (akick->HasFlag(AK_ISNICK) && akick->nc == nc)
ci->EraseAkick(j - 1);
}
@@ -183,10 +183,12 @@ class ChanServCore : public Module
EventReturn OnCheckModes(Channel *c) anope_override
{
if (!Config->CSRequire.empty())
+ {
if (c->ci)
c->SetModes(NULL, false, "+%s", Config->CSRequire.c_str());
else
c->SetModes(NULL, false, "-%s", Config->CSRequire.c_str());
+ }
return EVENT_CONTINUE;
}
diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp
index 363c29a1e..3fdfbf4e0 100644
--- a/modules/pseudoclients/global.cpp
+++ b/modules/pseudoclients/global.cpp
@@ -16,18 +16,18 @@
class MyGlobalService : public GlobalService
{
- void ServerGlobal(Server *s, const Anope::string &message)
+ void ServerGlobal(const BotInfo *sender, Server *s, const Anope::string &message)
{
if (s != Me && !s->HasFlag(SERVER_JUPED))
- s->Notice(findbot(Config->Global), message);
+ s->Notice(sender, message);
for (unsigned i = 0, j = s->GetLinks().size(); i < j; ++i)
- this->ServerGlobal(s->GetLinks()[i], message);
+ this->ServerGlobal(sender, s->GetLinks()[i], message);
}
public:
MyGlobalService(Module *m) : GlobalService(m) { }
- void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) anope_override
+ void SendGlobal(const BotInfo *sender, const Anope::string &source, const Anope::string &message) anope_override
{
if (Me->GetLinks().empty())
return;
@@ -39,7 +39,7 @@ class MyGlobalService : public GlobalService
else
rmessage = message;
- this->ServerGlobal(Me->GetLinks().front(), rmessage);
+ this->ServerGlobal(sender, Me->GetLinks().front(), rmessage);
}
};
@@ -53,7 +53,7 @@ class GlobalCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *Global = findbot(Config->Global);
+ const BotInfo *Global = findbot(Config->Global);
if (Global == NULL)
throw ModuleException("No bot named " + Config->Global);
diff --git a/modules/pseudoclients/global.h b/modules/pseudoclients/global.h
index 8aaa26a37..75d783399 100644
--- a/modules/pseudoclients/global.h
+++ b/modules/pseudoclients/global.h
@@ -11,7 +11,7 @@ class GlobalService : public Service
* @param source The sender of the global
* @param message The message
*/
- virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
+ virtual void SendGlobal(const BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
};
static service_reference<GlobalService> global("GlobalService", "Global");
diff --git a/modules/pseudoclients/hostserv.cpp b/modules/pseudoclients/hostserv.cpp
index 0e7699c5f..c350903d0 100644
--- a/modules/pseudoclients/hostserv.cpp
+++ b/modules/pseudoclients/hostserv.cpp
@@ -23,7 +23,7 @@ class HostServCore : public Module
if (!ircd || !ircd->vhost)
throw ModuleException("Your IRCd does not suppor vhosts");
- BotInfo *HostServ = findbot(Config->HostServ);
+ const BotInfo *HostServ = findbot(Config->HostServ);
if (HostServ == NULL)
throw ModuleException("No bot named " + Config->HostServ);
@@ -33,7 +33,7 @@ class HostServCore : public Module
void OnNickIdentify(User *u) anope_override
{
- NickAlias *na = findnick(u->nick);
+ const NickAlias *na = findnick(u->nick);
if (!na || !na->HasVhost())
na = findnick(u->Account()->display);
if (!na || !na->HasVhost())
@@ -50,7 +50,7 @@ class HostServCore : public Module
if (ircd->vident && !na->GetVhostIdent().empty())
u->SetVIdent(na->GetVhostIdent());
- BotInfo *bi = findbot(Config->HostServ);
+ const BotInfo *bi = findbot(Config->HostServ);
if (bi)
{
if (!na->GetVhostIdent().empty())
diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp
index 32eaa9f3f..f24b69edf 100644
--- a/modules/pseudoclients/memoserv.cpp
+++ b/modules/pseudoclients/memoserv.cpp
@@ -14,8 +14,6 @@
#include "module.h"
#include "memoserv.h"
-static BotInfo *MemoServ;
-
static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m)
{
Anope::string subject = translate(nc, Config->MailMemoSubject.c_str());
@@ -74,7 +72,7 @@ class MyMemoServService : public MemoServService
return MEMO_TOO_FAST;
else if (!mi->memomax)
return MEMO_TARGET_FULL;
- else if (mi->memomax > 0 && mi->memos.size() >= mi->memomax)
+ else if (mi->memomax > 0 && mi->memos->size() >= mi->memomax)
return MEMO_TARGET_FULL;
else if (mi->HasIgnore(sender))
return MEMO_SUCCESS;
@@ -84,7 +82,7 @@ class MyMemoServService : public MemoServService
sender->lastmemosend = Anope::CurTime;
Memo *m = new Memo();
- mi->memos.push_back(m);
+ mi->memos->push_back(m);
m->owner = target;
m->sender = source;
m->time = Anope::CurTime;
@@ -106,7 +104,7 @@ class MyMemoServService : public MemoServService
if (ci->AccessFor(cu->user).HasPriv("MEMO"))
{
if (cu->user->Account() && cu->user->Account()->HasFlag(NI_MEMO_RECEIVE))
- cu->user->SendMessage(MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), ci->name.c_str(), mi->memos.size());
+ cu->user->SendMessage(findbot(Config->MemoServ), MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), ci->name.c_str(), mi->memos->size());
}
}
}
@@ -117,12 +115,14 @@ class MyMemoServService : public MemoServService
if (nc->HasFlag(NI_MEMO_RECEIVE))
{
- for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it)
+ for (std::list<serialize_obj<NickAlias> >::const_iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;)
{
- NickAlias *na = *it;
+ const NickAlias *na = *it++;
+ if (!na)
+ continue;
User *user = finduser(na->nick);
if (user && user->IsIdentified())
- user->SendMessage(MemoServ, MEMO_NEW_MEMO_ARRIVED, source.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), mi->memos.size());
+ user->SendMessage(findbot(Config->MemoServ), MEMO_NEW_MEMO_ARRIVED, source.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), mi->memos->size());
}
}
@@ -136,24 +136,23 @@ class MyMemoServService : public MemoServService
void Check(User *u)
{
- NickCore *nc = u->Account();
+ const NickCore *nc = u->Account();
if (!nc)
return;
+ const BotInfo *ms = findbot(Config->MemoServ);
- unsigned i = 0, end = nc->memos.memos.size(), newcnt = 0;
+ unsigned i = 0, end = nc->memos.memos->size(), newcnt = 0;
for (; i < end; ++i)
- {
- if (nc->memos.memos[i]->HasFlag(MF_UNREAD))
+ if (nc->memos.GetMemo(i)->HasFlag(MF_UNREAD))
++newcnt;
- }
if (newcnt > 0)
- u->SendMessage(MemoServ, newcnt == 1 ? _("You have 1 new memo.") : _("You have %d new memos."), newcnt);
- if (nc->memos.memomax > 0 && nc->memos.memos.size() >= nc->memos.memomax)
+ u->SendMessage(ms, newcnt == 1 ? _("You have 1 new memo.") : _("You have %d new memos."), newcnt);
+ if (nc->memos.memomax > 0 && nc->memos.memos->size() >= nc->memos.memomax)
{
- if (nc->memos.memos.size() > nc->memos.memomax)
- u->SendMessage(MemoServ, _("You are over your maximum number of memos (%d). You will be unable to receive any new memos until you delete some of your current ones."), nc->memos.memomax);
+ if (nc->memos.memos->size() > nc->memos.memomax)
+ u->SendMessage(ms, _("You are over your maximum number of memos (%d). You will be unable to receive any new memos until you delete some of your current ones."), nc->memos.memomax);
else
- u->SendMessage(MemoServ, _("You have reached your maximum number of memos (%d). You will be unable to receive any new memos until you delete some of your current ones."), nc->memos.memomax);
+ u->SendMessage(ms, _("You have reached your maximum number of memos (%d). You will be unable to receive any new memos until you delete some of your current ones."), nc->memos.memomax);
}
}
};
@@ -167,8 +166,7 @@ class MemoServCore : public Module
{
this->SetAuthor("Anope");
- MemoServ = findbot(Config->MemoServ);
- if (MemoServ == NULL)
+ if (!findbot(Config->MemoServ))
throw ModuleException("No bot named " + Config->MemoServ);
Implementation i[] = { I_OnNickIdentify, I_OnJoinChannel, I_OnUserAway, I_OnNickUpdate, I_OnPreHelp, I_OnPostHelp };
@@ -182,12 +180,12 @@ 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->AccessFor(u).HasPriv("MEMO") && c->ci->memos.memos->size() > 0)
{
- 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());
+ if (c->ci->memos.memos->size() == 1)
+ u->SendMessage(findbot(Config->MemoServ), _("There is \002%d\002 memo on channel %s."), c->ci->memos.memos->size(), c->ci->name.c_str());
else
- u->SendMessage(MemoServ, _("There are \002%d\002 memos on channel %s."), c->ci->memos.memos.size(), c->ci->name.c_str());
+ u->SendMessage(findbot(Config->MemoServ), _("There are \002%d\002 memos 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 9dc517fd1..dd0501cd4 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -14,8 +14,6 @@
#include "module.h"
#include "nickserv.h"
-static BotInfo *NickServ;
-
class NickServCollide;
class NickServRelease;
@@ -80,6 +78,7 @@ class MyNickServService : public NickServService
NickAlias *na = findnick(u->nick);
if (!na)
return;
+ const BotInfo *NickServ = findbot(Config->NickServ);
if (na->nc->HasFlag(NI_SUSPENDED))
{
@@ -148,7 +147,7 @@ class ExpireCallback : public CallBack
if (noexpire || readonly)
return;
- for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; )
+ for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; )
{
NickAlias *na = it->second;
++it;
@@ -176,7 +175,7 @@ class ExpireCallback : public CallBack
extra = "suspended ";
Log(LOG_NORMAL, "expire") << "Expiring " << extra << "nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
FOREACH_MOD(I_OnNickExpire, OnNickExpire(na));
- delete na;
+ na->destroy();
}
}
}
@@ -192,8 +191,7 @@ class NickServCore : public Module
{
this->SetAuthor("Anope");
- NickServ = findbot(Config->NickServ);
- if (NickServ == NULL)
+ if (!findbot(Config->NickServ))
throw ModuleException("No bot named " + Config->NickServ);
Implementation i[] = { I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickIdentify, I_OnNickGroup,
@@ -207,14 +205,14 @@ class NickServCore : public Module
if (u && u->Account() == na->nc)
{
ircdproto->SendLogout(u);
- u->RemoveMode(NickServ, UMODE_REGISTERED);
+ u->RemoveMode(findbot(Config->NickServ), UMODE_REGISTERED);
u->Logout();
}
}
void OnDelCore(NickCore *nc) anope_override
{
- Log(NickServ, "nick") << "deleting nickname group " << nc->display;
+ Log(findbot(Config->NickServ), "nick") << "deleting nickname group " << nc->display;
/* Clean up this nick core from any users online using it
* (ones that /nick but remain unidentified)
@@ -223,7 +221,7 @@ class NickServCore : public Module
{
User *user = *it++;
ircdproto->SendLogout(user);
- user->RemoveMode(NickServ, UMODE_REGISTERED);
+ user->RemoveMode(findbot(Config->NickServ), UMODE_REGISTERED);
user->Logout();
FOREACH_MOD(I_OnNickLogout, OnNickLogout(user));
}
@@ -232,14 +230,16 @@ class NickServCore : public Module
void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) anope_override
{
- Log(LOG_NORMAL, "nick", NickServ) << "Changing " << nc->display << " nickname group display to " << newdisplay;
+ Log(LOG_NORMAL, "nick", findbot(Config->NickServ)) << "Changing " << nc->display << " nickname group display to " << newdisplay;
}
void OnNickIdentify(User *u) anope_override
{
+ const BotInfo *NickServ = findbot(Config->NickServ);
+
if (!Config->NoNicknameOwnership)
{
- NickAlias *this_na = findnick(u->nick);
+ const NickAlias *this_na = findnick(u->nick);
if (this_na && this_na->nc == u->Account() && u->Account()->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(NickServ, UMODE_REGISTERED);
}
@@ -266,7 +266,7 @@ class NickServCore : public Module
if (u->Account()->HasFlag(NI_UNCONFIRMED))
{
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you when you registered."));
- NickAlias *this_na = findnick(u->Account()->display);
+ const NickAlias *this_na = findnick(u->Account()->display);
time_t time_registered = Anope::CurTime - this_na->time_registered;
if (Config->NSUnconfirmedExpire > time_registered)
u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s"), duration(Config->NSUnconfirmedExpire - time_registered).c_str());
@@ -276,7 +276,7 @@ class NickServCore : public Module
void OnNickGroup(User *u, NickAlias *target) anope_override
{
if (target->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
void OnNickUpdate(User *u) anope_override
@@ -292,7 +292,8 @@ class NickServCore : public Module
void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override
{
- NickAlias *na = findnick(u->nick);
+ const NickAlias *na = findnick(u->nick);
+ const BotInfo *NickServ = findbot(Config->NickServ);
/* If the new nick isnt registerd or its registerd and not yours */
if (!na || na->nc != u->Account())
{
@@ -305,7 +306,7 @@ class NickServCore : public Module
{
ircdproto->SendLogin(u);
if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
+ u->SetMode(NickServ, UMODE_REGISTERED);
Log(NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display;
}
}
@@ -313,7 +314,7 @@ class NickServCore : public Module
void OnUserModeSet(User *u, UserModeName Name) anope_override
{
if (Name == UMODE_REGISTERED && !u->IsIdentified())
- u->RemoveMode(NickServ, Name);
+ u->RemoveMode(findbot(Config->NickServ), Name);
}
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -353,8 +354,8 @@ class NickServCore : public Module
void OnUserConnect(dynamic_reference<User> &u, bool &exempt) anope_override
{
- if (!Config->NoNicknameOwnership && !Config->NSUnregisteredNotice.empty() && u && findnick(u->nick) == NULL)
- u->SendMessage(NickServ, Config->NSUnregisteredNotice);
+ if (!Config->NoNicknameOwnership && !Config->NSUnregisteredNotice.empty() && u && !findnick(u->nick))
+ u->SendMessage(findbot(Config->NickServ), Config->NSUnregisteredNotice);
}
};
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index 8b969489e..d9fa44597 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -13,8 +13,6 @@
#include "module.h"
-static BotInfo *OperServ;
-
class SGLineManager : public XLineManager
{
public:
@@ -25,9 +23,9 @@ class SGLineManager : public XLineManager
this->Send(u, x);
}
- void OnExpire(XLine *x) anope_override
+ void OnExpire(const XLine *x) anope_override
{
- Log(OperServ, "expire/akill") << "AKILL on \2" << x->Mask << "\2 has expired";
+ Log(findbot(Config->OperServ), "expire/akill") << "AKILL on \2" << x->Mask << "\2 has expired";
}
void Send(User *u, XLine *x) anope_override
@@ -52,7 +50,7 @@ class SGLineManager : public XLineManager
}
}
- bool Check(User *u, XLine *x) anope_override
+ bool Check(User *u, const XLine *x) anope_override
{
if (x->regex)
{
@@ -101,9 +99,9 @@ class SQLineManager : public XLineManager
this->Send(u, x);
}
- void OnExpire(XLine *x) anope_override
+ void OnExpire(const XLine *x) anope_override
{
- Log(OperServ, "expire/sqline") << "SQLINE on \2" << x->Mask << "\2 has expired";
+ Log(findbot(Config->OperServ), "expire/sqline") << "SQLINE on \2" << x->Mask << "\2 has expired";
}
void Send(User *u, XLine *x) anope_override
@@ -116,7 +114,7 @@ class SQLineManager : public XLineManager
ircdproto->SendSQLineDel(x);
}
- bool Check(User *u, XLine *x) anope_override
+ bool Check(User *u, const XLine *x) anope_override
{
if (x->regex)
return x->regex->Matches(u->nick);
@@ -142,9 +140,9 @@ class SNLineManager : public XLineManager
this->Send(u, x);
}
- void OnExpire(XLine *x) anope_override
+ void OnExpire(const XLine *x) anope_override
{
- Log(OperServ, "expire/snline") << "SNLINE on \2" << x->Mask << "\2 has expired";
+ Log(findbot(Config->OperServ), "expire/snline") << "SNLINE on \2" << x->Mask << "\2 has expired";
}
void Send(User *u, XLine *x) anope_override
@@ -157,7 +155,7 @@ class SNLineManager : public XLineManager
ircdproto->SendSGLineDel(x);
}
- bool Check(User *u, XLine *x) anope_override
+ bool Check(User *u, const XLine *x) anope_override
{
if (x->regex)
return x->regex->Matches(u->realname);
@@ -177,8 +175,7 @@ class OperServCore : public Module
{
this->SetAuthor("Anope");
- OperServ = findbot(Config->OperServ);
- if (OperServ == NULL)
+ if (!findbot(Config->OperServ))
throw ModuleException("No bot named " + Config->OperServ);
Implementation i[] = { I_OnBotPrivmsg, I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect, I_OnUserNickChange, I_OnPreHelp };
@@ -206,7 +203,7 @@ class OperServCore : public Module
if (Config->OSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->OperServ)
{
u->SendMessage(bi, ACCESS_DENIED);
- Log(OperServ, "bados") << "Denied access to " << Config->OperServ << " from " << u->GetMask() << " (non-oper)";
+ Log(findbot(Config->OperServ), "bados") << "Denied access to " << Config->OperServ << " from " << u->GetMask() << " (non-oper)";
return EVENT_STOP;
}
@@ -216,19 +213,19 @@ class OperServCore : public Module
void OnServerQuit(Server *server) anope_override
{
if (server->HasFlag(SERVER_JUPED))
- Log(server, "squit", OperServ) << "Received SQUIT for juped server " << server->GetName();
+ Log(server, "squit", findbot(Config->OperServ)) << "Received SQUIT for juped server " << server->GetName();
}
void OnUserModeSet(User *u, UserModeName Name) anope_override
{
if (Name == UMODE_OPER)
- Log(u, "oper", OperServ) << "is now an IRC operator.";
+ Log(u, "oper", findbot(Config->OperServ)) << "is now an IRC operator.";
}
void OnUserModeUnset(User *u, UserModeName Name) anope_override
{
if (Name == UMODE_OPER)
- Log(u, "oper", OperServ) << "is no longer an IRC operator";
+ Log(u, "oper", findbot(Config->OperServ)) << "is no longer an IRC operator";
}
void OnUserConnect(dynamic_reference<User> &u, bool &exempt) anope_override