summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bots.cpp30
-rw-r--r--src/botserv.c19
2 files changed, 49 insertions, 0 deletions
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);