diff options
author | Adam <Adam@drink-coca-cola.info> | 2010-05-13 14:56:13 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-06-18 21:01:17 -0400 |
commit | 81a45520a773732c9f46785f27aa1956150775d7 (patch) | |
tree | b37c2ad0d77e3ba1b4c7c6e09fa07812eb03add5 | |
parent | e6263dba84b80f03d02c379ace081e602f8ef199 (diff) |
Added some global variables for the core pseudo clients, keeps us from having to call findbot() everywhere
-rw-r--r-- | include/extern.h | 8 | ||||
-rw-r--r-- | src/bots.cpp | 15 | ||||
-rw-r--r-- | src/core/db_plain.cpp | 3 |
3 files changed, 25 insertions, 1 deletions
diff --git a/include/extern.h b/include/extern.h index ed3323c3b..67364c0f5 100644 --- a/include/extern.h +++ b/include/extern.h @@ -36,6 +36,14 @@ E bool bad_password(User *u); E void sqline(const std::string &mask, const std::string &reason); E void common_unban(ChannelInfo *ci, const std::string &nick); +E BotInfo *BotServ; +E BotInfo *ChanServ; +E BotInfo *Global; +E BotInfo *HostServ; +E BotInfo *MemoServ; +E BotInfo *NickServ; +E BotInfo *OperServ; + /**** botserv.c ****/ E BotInfo *botlists[256]; diff --git a/src/bots.cpp b/src/bots.cpp index f65f2a35e..6f544a64a 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -12,6 +12,14 @@ #include "modules.h" #include "commands.h" +BotInfo *BotServ = NULL; +BotInfo *ChanServ = NULL; +BotInfo *Global = NULL; +BotInfo *HostServ = NULL; +BotInfo *MemoServ = NULL; +BotInfo *NickServ = NULL; +BotInfo *OperServ = NULL; + BotInfo::BotInfo(const std::string &nnick, const std::string &nuser, const std::string &nhost, const std::string &nreal) { this->nick = nnick; @@ -27,36 +35,43 @@ BotInfo::BotInfo(const std::string &nnick, const std::string &nuser, const std:: ci::string ci_nick(nnick.c_str()); if (Config.s_ChanServ && ci_nick == Config.s_ChanServ) { + ChanServ = this; this->cmdTable = CHANSERV; this->SetFlag(BI_CHANSERV); } else if (Config.s_BotServ && ci_nick == Config.s_BotServ) { + BotServ = this; this->cmdTable = BOTSERV; this->SetFlag(BI_BOTSERV); } else if (Config.s_HostServ && ci_nick == Config.s_HostServ) { + HostServ = this; this->cmdTable = HOSTSERV; this->SetFlag(BI_HOSTSERV); } else if (Config.s_OperServ && ci_nick == Config.s_OperServ) { + OperServ = this; this->cmdTable = OPERSERV; this->SetFlag(BI_OPERSERV); } else if (Config.s_MemoServ && ci_nick == Config.s_MemoServ) { + MemoServ = this; this->cmdTable = MEMOSERV; this->SetFlag(BI_MEMOSERV); } else if (Config.s_NickServ && ci_nick == Config.s_NickServ) { + NickServ = this; this->cmdTable = NICKSERV; this->SetFlag(BI_NICKSERV); } else if (Config.s_GlobalNoticer && ci_nick == Config.s_GlobalNoticer) { + Global = this; this->SetFlag(BI_GLOBAL); } diff --git a/src/core/db_plain.cpp b/src/core/db_plain.cpp index fba374667..24b494d82 100644 --- a/src/core/db_plain.cpp +++ b/src/core/db_plain.cpp @@ -53,6 +53,7 @@ static void ReadDatabase(Module *m = NULL) NickCore *nc = NULL; NickAlias *na = NULL; + NickRequest *nr = NULL; BotInfo *bi = NULL; ChannelInfo *ci = NULL; @@ -550,7 +551,7 @@ class DBPlain : public Module snprintf(newname, DatabaseFile.length() + 30, "backups/%s.%d%d%d", DatabaseFile.c_str(), tm->tm_year, tm->tm_mon, tm->tm_mday); /* Backup already exists */ - if (!stat(newname, &DBInfo)) + if (IsFile(newname)) { delete [] newname; return; |