diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-06-03 20:29:33 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-06-03 20:29:33 +0000 |
commit | 426f72117b4557b2d348eddcb2e89e90eff77270 (patch) | |
tree | 8a91b658d4313ead66e9d94f9297d5b2efb5fcb3 | |
parent | affc29aca56d8777966f0a5a3b3a01dd5d3dffb2 (diff) |
Fix bug #1080, changing core pseudo-client nicks in the config should register the change when the bots are brought back online, patch from Adam.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2310 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/services.h | 7 | ||||
-rw-r--r-- | src/bots.cpp | 30 | ||||
-rw-r--r-- | src/botserv.c | 19 |
3 files changed, 56 insertions, 0 deletions
diff --git a/include/services.h b/include/services.h index 13cb293c7..a2c9db2ab 100644 --- a/include/services.h +++ b/include/services.h @@ -1178,6 +1178,13 @@ typedef struct ircd_modes_ { #define DEF_LANGUAGE LANG_EN_US #define BI_PRIVATE 0x0001 +#define BI_CHANSERV 0x0002 +#define BI_BOTSERV 0x0004 +#define BI_HOSTSERV 0x0008 +#define BI_OPERSERV 0x0010 +#define BI_MEMOSERV 0x0020 +#define BI_NICKSERV 0x0040 +#define BI_GLOBAL 0x0080 #define CUS_OP 0x0001 #define CUS_VOICE 0x0002 diff --git a/src/bots.cpp b/src/bots.cpp index 095d16167..a46726122 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -20,6 +20,21 @@ BotInfo::BotInfo(const char *nnick) insert_bot(this); // XXX, this is ugly, but it needs to stay until hashing of bots is redone in STL. nbots++; this->cmdTable = NULL; + + if (s_ChanServ && !stricmp(s_ChanServ, nnick)) + this->flags |= BI_CHANSERV; + else if (s_BotServ && !stricmp(s_BotServ, nnick)) + this->flags |= BI_BOTSERV; + else if (s_HostServ && !stricmp(s_BotServ, nnick)) + this->flags |= BI_HOSTSERV; + else if (s_OperServ && !stricmp(s_OperServ, nnick)) + this->flags |= BI_OPERSERV; + else if (s_MemoServ && !stricmp(s_MemoServ, nnick)) + this->flags |= BI_MEMOSERV; + else if (s_NickServ && !stricmp(s_NickServ, nnick)) + this->flags |= BI_NICKSERV; + else if (s_GlobalNoticer && !stricmp(s_GlobalNoticer, nnick)) + this->flags |= BI_GLOBAL; } BotInfo::BotInfo(const char *nnick, const char *nuser, const char *nhost, const char *nreal) @@ -33,6 +48,21 @@ BotInfo::BotInfo(const char *nnick, const char *nuser, const char *nhost, const insert_bot(this); // XXX, this is ugly, but it needs to stay until hashing of bots is redone in STL. nbots++; this->cmdTable = NULL; + + if (s_ChanServ && !stricmp(s_ChanServ, nnick)) + this->flags |= BI_CHANSERV; + else if (s_BotServ && !stricmp(s_BotServ, nnick)) + this->flags |= BI_BOTSERV; + else if (s_HostServ && !stricmp(s_BotServ, nnick)) + this->flags |= BI_HOSTSERV; + else if (s_OperServ && !stricmp(s_OperServ, nnick)) + this->flags |= BI_OPERSERV; + else if (s_MemoServ && !stricmp(s_MemoServ, nnick)) + this->flags |= BI_MEMOSERV; + else if (s_NickServ && !stricmp(s_NickServ, nnick)) + this->flags |= BI_NICKSERV; + else if (s_GlobalNoticer && !stricmp(s_GlobalNoticer, nnick)) + this->flags |= BI_GLOBAL; } BotInfo::~BotInfo() diff --git a/src/botserv.c b/src/botserv.c index 617fc9039..654d9905f 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -493,6 +493,25 @@ void load_bs_dbase() bi->created = tmp32; SAFE(read_int16(&tmp16, f)); bi->chancount = tmp16; + + /* Fixes bug #1080, services bot names may have been + * changed in the config and different from database + * names + */ + if (s_ChanServ && bi->flags & BI_CHANSERV && strcmp(bi->nick, s_ChanServ)) + bi->ChangeNick(s_ChanServ); + else if (s_BotServ && bi->flags & BI_BOTSERV && strcmp(bi->nick, s_BotServ)) + bi->ChangeNick(s_BotServ); + else if (s_HostServ && bi->flags & BI_HOSTSERV && strcmp(bi->nick, s_HostServ)) + bi->ChangeNick(s_HostServ); + else if (s_OperServ && bi->flags & BI_OPERSERV && strcmp(bi->nick, s_OperServ)) + bi->ChangeNick(s_OperServ); + else if (s_MemoServ && bi->flags & BI_MEMOSERV && strcmp(bi->nick, s_MemoServ)) + bi->ChangeNick(s_MemoServ); + else if (s_NickServ && bi->flags & BI_NICKSERV && strcmp(bi->nick, s_NickServ)) + bi->ChangeNick(s_NickServ); + else if (s_GlobalNoticer && bi->flags & BI_GLOBAL && strcmp(bi->nick, s_GlobalNoticer)) + bi->ChangeNick(s_GlobalNoticer); } close_db(f); |