summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/bots.h4
-rw-r--r--include/module.h4
-rw-r--r--modules/pseudoclients/botserv.cpp16
-rw-r--r--modules/pseudoclients/botserv.h6
-rw-r--r--modules/pseudoclients/chanserv.cpp16
-rw-r--r--modules/pseudoclients/chanserv.h6
-rw-r--r--modules/pseudoclients/global.cpp16
-rw-r--r--modules/pseudoclients/global.h1
-rw-r--r--modules/pseudoclients/hostserv.cpp16
-rw-r--r--modules/pseudoclients/hostserv.h6
-rw-r--r--modules/pseudoclients/memoserv.cpp16
-rw-r--r--modules/pseudoclients/memoserv.h1
-rw-r--r--modules/pseudoclients/nickserv.cpp18
-rw-r--r--modules/pseudoclients/nickserv.h1
-rw-r--r--modules/pseudoclients/operserv.cpp16
-rw-r--r--modules/pseudoclients/operserv.h6
-rw-r--r--src/bots.cpp4
-rw-r--r--src/channels.cpp1
-rw-r--r--src/logger.cpp2
-rw-r--r--src/protocol.cpp1
-rw-r--r--src/regchannel.cpp1
-rw-r--r--src/users.cpp1
22 files changed, 77 insertions, 82 deletions
diff --git a/include/bots.h b/include/bots.h
index 01c752124..fa3e64974 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -35,7 +35,7 @@ enum BotFlag
};
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
-class CoreExport BotInfo : public User, public Flags<BotFlag>, public Serializable, public Service
+class CoreExport BotInfo : public User, public Flags<BotFlag>, public Serializable
{
public:
time_t created;
@@ -139,4 +139,6 @@ class CoreExport BotInfo : public User, public Flags<BotFlag>, public Serializab
static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
};
+extern CoreExport BotInfo *BotServ, *ChanServ, *Global, *HostServ, *MemoServ, *NickServ, *OperServ;
+
#endif // BOTS_H
diff --git a/include/module.h b/include/module.h
index e2fc18eaf..eba4384d6 100644
--- a/include/module.h
+++ b/include/module.h
@@ -47,12 +47,8 @@
#include "users.h"
#include "xline.h"
-#include "chanserv.h"
-#include "botserv.h"
#include "global.h"
-#include "hostserv.h"
#include "memoserv.h"
#include "nickserv.h"
-#include "operserv.h"
#endif // MODULE_H
diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp
index addb39e0c..6f9046957 100644
--- a/modules/pseudoclients/botserv.cpp
+++ b/modules/pseudoclients/botserv.cpp
@@ -20,20 +20,24 @@ class BotServCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *bi = BotInfo::Find(Config->BotServ);
- if (!bi)
+ BotServ = BotInfo::Find(Config->BotServ);
+ if (!BotServ)
throw ModuleException("No bot named " + Config->BotServ);
- Implementation i[] = { I_OnPrivmsg, I_OnJoinChannel, I_OnLeaveChannel,
+ Implementation i[] = { I_OnBotDelete, I_OnPrivmsg, I_OnJoinChannel, I_OnLeaveChannel,
I_OnPreHelp, I_OnPostHelp, I_OnChannelModeSet };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Service::AddAlias("BotInfo", "BotServ", bi->nick);
}
~BotServCore()
{
- Service::DelAlias("BotInfo", "BotServ");
+ BotServ = NULL;
+ }
+
+ void OnBotDelete(BotInfo *bi) anope_override
+ {
+ if (bi == BotServ)
+ BotServ = NULL;
}
void OnPrivmsg(User *u, Channel *c, Anope::string &msg) anope_override
diff --git a/modules/pseudoclients/botserv.h b/modules/pseudoclients/botserv.h
deleted file mode 100644
index 362b15c23..000000000
--- a/modules/pseudoclients/botserv.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef BOTSERV_H
-#define BOTSERV_H
-
-static ServiceReference<BotInfo> BotServ("BotInfo", "BotServ");
-
-#endif // BOTSERV_H
diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp
index 6f5cda048..8af5f1b3f 100644
--- a/modules/pseudoclients/chanserv.cpp
+++ b/modules/pseudoclients/chanserv.cpp
@@ -61,19 +61,23 @@ class ChanServCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *bi = BotInfo::Find(Config->ChanServ);
- if (!bi)
+ ChanServ = BotInfo::Find(Config->ChanServ);
+ if (!ChanServ)
throw ModuleException("No bot named " + Config->ChanServ);
- Implementation i[] = { I_OnBotPrivmsg, I_OnDelCore, I_OnPreHelp, I_OnPostHelp, I_OnCheckModes };
+ Implementation i[] = { I_OnBotDelete, I_OnBotPrivmsg, I_OnDelCore, I_OnPreHelp, I_OnPostHelp, I_OnCheckModes };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Service::AddAlias("BotInfo", "ChanServ", bi->nick);
}
~ChanServCore()
{
- Service::DelAlias("BotInfo", "ChanServ");
+ ChanServ = NULL;
+ }
+
+ void OnBotDelete(BotInfo *bi) anope_override
+ {
+ if (bi == ChanServ)
+ ChanServ = NULL;
}
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override
diff --git a/modules/pseudoclients/chanserv.h b/modules/pseudoclients/chanserv.h
deleted file mode 100644
index 62ea86b22..000000000
--- a/modules/pseudoclients/chanserv.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef CHANSERV_H
-#define CHANSERV_H
-
-static ServiceReference<BotInfo> ChanServ("BotInfo", "ChanServ");
-
-#endif // CHANSERV_H
diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp
index 3fca89039..228da91a5 100644
--- a/modules/pseudoclients/global.cpp
+++ b/modules/pseudoclients/global.cpp
@@ -53,19 +53,23 @@ class GlobalCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *bi = BotInfo::Find(Config->Global);
- if (!bi)
+ Global = BotInfo::Find(Config->Global);
+ if (!Global)
throw ModuleException("No bot named " + Config->Global);
- Implementation i[] = { I_OnRestart, I_OnShutdown, I_OnNewServer, I_OnPreHelp };
+ Implementation i[] = { I_OnBotDelete, I_OnRestart, I_OnShutdown, I_OnNewServer, I_OnPreHelp };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Service::AddAlias("BotInfo", "Global", bi->nick);
}
~GlobalCore()
{
- Service::DelAlias("BotInfo", "Global");
+ Global = NULL;
+ }
+
+ void OnBotDelete(BotInfo *bi) anope_override
+ {
+ if (bi == Global)
+ Global = NULL;
}
void OnRestart() anope_override
diff --git a/modules/pseudoclients/global.h b/modules/pseudoclients/global.h
index f776e73e3..7a2dc1830 100644
--- a/modules/pseudoclients/global.h
+++ b/modules/pseudoclients/global.h
@@ -15,7 +15,6 @@ class GlobalService : public Service
};
static ServiceReference<GlobalService> GlobalService("GlobalService", "Global");
-static ServiceReference<BotInfo> Global("BotInfo", "Global");
#endif // GLOBAL_H
diff --git a/modules/pseudoclients/hostserv.cpp b/modules/pseudoclients/hostserv.cpp
index 6f101720b..f46f3d86f 100644
--- a/modules/pseudoclients/hostserv.cpp
+++ b/modules/pseudoclients/hostserv.cpp
@@ -23,19 +23,23 @@ class HostServCore : public Module
if (!IRCD || !IRCD->CanSetVHost)
throw ModuleException("Your IRCd does not support vhosts");
- BotInfo *bi = BotInfo::Find(Config->HostServ);
- if (!bi)
+ HostServ = BotInfo::Find(Config->HostServ);
+ if (!HostServ)
throw ModuleException("No bot named " + Config->HostServ);
- Implementation i[] = { I_OnNickIdentify, I_OnNickUpdate, I_OnPreHelp };
+ Implementation i[] = { I_OnBotDelete, I_OnNickIdentify, I_OnNickUpdate, I_OnPreHelp };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Service::AddAlias("BotInfo", "HostServ", bi->nick);
}
~HostServCore()
{
- Service::DelAlias("BotInfo", "HostServ");
+ HostServ = NULL;
+ }
+
+ void OnBotDelete(BotInfo *bi) anope_override
+ {
+ if (bi == HostServ)
+ HostServ = NULL;
}
void OnNickIdentify(User *u) anope_override
diff --git a/modules/pseudoclients/hostserv.h b/modules/pseudoclients/hostserv.h
deleted file mode 100644
index cfadca806..000000000
--- a/modules/pseudoclients/hostserv.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef HOSTSERV_H
-#define HOSTSERV_H
-
-static ServiceReference<BotInfo> HostServ("BotInfo", "HostServ");
-
-#endif // HOSTSERV_H
diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp
index ff8d11602..e1565ab67 100644
--- a/modules/pseudoclients/memoserv.cpp
+++ b/modules/pseudoclients/memoserv.cpp
@@ -165,19 +165,23 @@ class MemoServCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *bi = BotInfo::Find(Config->MemoServ);
- if (!bi)
+ MemoServ = BotInfo::Find(Config->MemoServ);
+ if (!MemoServ)
throw ModuleException("No bot named " + Config->MemoServ);
- Implementation i[] = { I_OnNickIdentify, I_OnJoinChannel, I_OnUserAway, I_OnNickUpdate, I_OnPreHelp, I_OnPostHelp };
+ Implementation i[] = { I_OnBotDelete, I_OnNickIdentify, I_OnJoinChannel, I_OnUserAway, I_OnNickUpdate, I_OnPreHelp, I_OnPostHelp };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Service::AddAlias("BotInfo", "MemoServ", bi->nick);
}
~MemoServCore()
{
- Service::DelAlias("BotInfo", "MemoServ");
+ MemoServ = NULL;
+ }
+
+ void OnBotDelete(BotInfo *bi) anope_override
+ {
+ if (bi == MemoServ)
+ MemoServ = NULL;
}
void OnNickIdentify(User *u) anope_override
diff --git a/modules/pseudoclients/memoserv.h b/modules/pseudoclients/memoserv.h
index bd88fffd4..35a187d53 100644
--- a/modules/pseudoclients/memoserv.h
+++ b/modules/pseudoclients/memoserv.h
@@ -36,7 +36,6 @@ class MemoServService : public Service
};
static ServiceReference<MemoServService> MemoServService("MemoServService", "MemoServ");
-static ServiceReference<BotInfo> MemoServ("BotInfo", "MemoServ");
#endif // MEMOSERV_H
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index 0efb1d261..744339f7d 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -185,20 +185,24 @@ class NickServCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *bi = BotInfo::Find(Config->NickServ);
- if (!bi)
+ NickServ = BotInfo::Find(Config->NickServ);
+ if (!NickServ)
throw ModuleException("No bot named " + Config->NickServ);
- Implementation i[] = { I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickIdentify, I_OnNickGroup,
- I_OnNickUpdate, I_OnUserNickChange, I_OnPreHelp, I_OnPostHelp, I_OnUserConnect };
+ Implementation i[] = { I_OnBotDelete, I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickIdentify, I_OnNickGroup,
+ I_OnNickUpdate, I_OnUserNickChange, I_OnPreHelp, I_OnPostHelp, I_OnUserConnect };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Service::AddAlias("BotInfo", "NickServ", bi->nick);
}
~NickServCore()
{
- Service::DelAlias("BotInfo", "NickServ");
+ NickServ = NULL;
+ }
+
+ void OnBotDelete(BotInfo *bi) anope_override
+ {
+ if (bi == NickServ)
+ NickServ = NULL;
}
void OnDelNick(NickAlias *na) anope_override
diff --git a/modules/pseudoclients/nickserv.h b/modules/pseudoclients/nickserv.h
index 3115ebc79..702922379 100644
--- a/modules/pseudoclients/nickserv.h
+++ b/modules/pseudoclients/nickserv.h
@@ -10,7 +10,6 @@ class NickServService : public Service
};
static ServiceReference<NickServService> NickServService("NickServService", "NickServ");
-static ServiceReference<BotInfo> NickServ("BotInfo", "NickServ");
#endif // NICKSERV_H
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index 5b61c3df9..02ec216f4 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -175,24 +175,22 @@ class OperServCore : public Module
{
this->SetAuthor("Anope");
- BotInfo *bi = BotInfo::Find(Config->OperServ);
- if (!bi)
+ OperServ = BotInfo::Find(Config->OperServ);
+ if (!OperServ)
throw ModuleException("No bot named " + Config->OperServ);
- Implementation i[] = { I_OnBotPrivmsg, I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect, I_OnUserNickChange, I_OnPreHelp };
+ Implementation i[] = { I_OnBotDelete, I_OnBotPrivmsg, I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect, I_OnUserNickChange, I_OnPreHelp };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
/* Yes, these are in this order for a reason. Most violent->least violent. */
XLineManager::RegisterXLineManager(&sglines);
XLineManager::RegisterXLineManager(&sqlines);
XLineManager::RegisterXLineManager(&snlines);
-
- Service::AddAlias("BotInfo", "OperServ", bi->nick);
}
~OperServCore()
{
- Service::DelAlias("BotInfo", "OperServ");
+ OperServ = NULL;
this->sglines.Clear();
this->sqlines.Clear();
@@ -203,6 +201,12 @@ class OperServCore : public Module
XLineManager::UnregisterXLineManager(&snlines);
}
+ void OnBotDelete(BotInfo *bi) anope_override
+ {
+ if (bi == OperServ)
+ OperServ = NULL;
+ }
+
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override
{
if (Config->OSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->OperServ)
diff --git a/modules/pseudoclients/operserv.h b/modules/pseudoclients/operserv.h
deleted file mode 100644
index e1577db1d..000000000
--- a/modules/pseudoclients/operserv.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef OPERSERV_H
-#define OPERSERV_H
-
-static ServiceReference<BotInfo> OperServ("BotInfo", "OperServ");
-
-#endif // OPERSERV_H
diff --git a/src/bots.cpp b/src/bots.cpp
index da5fe7574..c484ec5d4 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -32,7 +32,9 @@ static const Anope::string BotServFlagStrings[] = {
};
template<> const Anope::string* Flags<BotServFlag>::flags_strings = BotServFlagStrings;
-BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, "", "", Me, nreal, Anope::CurTime, "", Servers::TS6_UID_Retrieve()), Serializable("BotInfo"), Service(NULL, "BotInfo", nnick), botmodes(bmodes)
+BotInfo *BotServ = NULL, *ChanServ = NULL, *Global = NULL, *HostServ = NULL, *MemoServ = NULL, *NickServ = NULL, *OperServ = NULL;
+
+BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, "", "", Me, nreal, Anope::CurTime, "", Servers::TS6_UID_Retrieve()), Serializable("BotInfo"), botmodes(bmodes)
{
this->lastmsg = this->created = Anope::CurTime;
this->introduced = false;
diff --git a/src/channels.cpp b/src/channels.cpp
index 41755b9c8..f6d44e9f8 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -23,7 +23,6 @@
#include "config.h"
#include "access.h"
#include "sockets.h"
-#include "chanserv.h"
channel_map ChannelList;
diff --git a/src/logger.cpp b/src/logger.cpp
index f6058ab42..6341effd1 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -22,8 +22,6 @@
#include "uplink.h"
#include "protocol.h"
#include "global.h"
-#include "operserv.h"
-#include "chanserv.h"
#ifndef _WIN32
#include <sys/time.h>
diff --git a/src/protocol.cpp b/src/protocol.cpp
index de2013cc6..44b7770da 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -19,7 +19,6 @@
#include "uplink.h"
#include "bots.h"
#include "channels.h"
-#include "operserv.h"
IRCDProto *IRCD = NULL;
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index 43c51d783..28c247cd9 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -20,7 +20,6 @@
#include "bots.h"
#include "language.h"
#include "servers.h"
-#include "chanserv.h"
Serialize::Checker<registered_channel_map> RegisteredChannelList("ChannelInfo");
diff --git a/src/users.cpp b/src/users.cpp
index 628b0c464..3bbc0d7fd 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -22,7 +22,6 @@
#include "config.h"
#include "opertype.h"
#include "nickserv.h"
-#include "operserv.h"
#include "language.h"
user_map UserListByNick, UserListByUID;