summaryrefslogtreecommitdiff
path: root/src/botserv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/botserv.c')
-rw-r--r--src/botserv.c120
1 files changed, 0 insertions, 120 deletions
diff --git a/src/botserv.c b/src/botserv.c
index ab20b0852..9a8229d6c 100644
--- a/src/botserv.c
+++ b/src/botserv.c
@@ -461,126 +461,6 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
/*************************************************************************/
-/* Load/save data files. */
-
-
-#define SAFE(x) do { \
- if ((x) < 0) { \
- if (!forceload) \
- fatal("Read error on %s", Config.BotDBName); \
- failed = 1; \
- break; \
- } \
-} while (0)
-
-void load_bs_dbase()
-{
- dbFILE *f;
- int c, ver;
- uint16 tmp16;
- uint32 tmp32;
- BotInfo *bi;
- int failed = 0;
-
- if (!(f = open_db(Config.s_BotServ, Config.BotDBName, "r", BOT_VERSION)))
- return;
-
- ver = get_file_version(f);
-
- while (!failed && (c = getc_db(f)) != 0) {
- char *s;
-
- if (c != 1)
- fatal("Invalid format in %s %d", Config.BotDBName, c);
-
- SAFE(read_string(&s, f));
- bi = new BotInfo(s);
- delete [] s;
- SAFE(read_string(&bi->user, f));
- SAFE(read_string(&bi->host, f));
- SAFE(read_string(&bi->real, f));
- if (ver >= 10) {
- SAFE(read_int16(&tmp16, f));
- //bi->flags |= tmp16;
- }
- SAFE(read_int32(&tmp32, f));
- 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 (Config.s_ChanServ && bi->HasFlag(BI_CHANSERV) && strcmp(bi->nick, Config.s_ChanServ))
- bi->ChangeNick(Config.s_ChanServ);
- else if (Config.s_BotServ && bi->HasFlag(BI_BOTSERV) && strcmp(bi->nick, Config.s_BotServ))
- bi->ChangeNick(Config.s_BotServ);
- else if (Config.s_HostServ && bi->HasFlag(BI_HOSTSERV) && strcmp(bi->nick, Config.s_HostServ))
- bi->ChangeNick(Config.s_HostServ);
- else if (Config.s_OperServ && bi->HasFlag(BI_OPERSERV) && strcmp(bi->nick, Config.s_OperServ))
- bi->ChangeNick(Config.s_OperServ);
- else if (Config.s_MemoServ && bi->HasFlag(BI_MEMOSERV) && strcmp(bi->nick, Config.s_MemoServ))
- bi->ChangeNick(Config.s_MemoServ);
- else if (Config.s_NickServ && bi->HasFlag(BI_NICKSERV) && strcmp(bi->nick, Config.s_NickServ))
- bi->ChangeNick(Config.s_NickServ);
- else if (Config.s_GlobalNoticer && bi->HasFlag(BI_GLOBAL) && strcmp(bi->nick, Config.s_GlobalNoticer))
- bi->ChangeNick(Config.s_GlobalNoticer);
- }
-
- close_db(f);
-}
-
-#undef SAFE
-
-/*************************************************************************/
-
-#define SAFE(x) do { \
- if ((x) < 0) { \
- restore_db(f); \
- log_perror("Write error on %s", Config.BotDBName); \
- if (time(NULL) - lastwarn > Config.WarningTimeout) { \
- ircdproto->SendGlobops(NULL, "Write error on %s: %s", Config.BotDBName, \
- strerror(errno)); \
- lastwarn = time(NULL); \
- } \
- return; \
- } \
-} while (0)
-
-void save_bs_dbase()
-{
- dbFILE *f;
- BotInfo *bi;
- static time_t lastwarn = 0;
- int i;
-
- if (!(f = open_db(Config.s_BotServ, Config.BotDBName, "w", BOT_VERSION)))
- return;
-
- for (i = 0; i < 256; i++) {
- for (bi = botlists[i]; bi; bi = bi->next) {
- SAFE(write_int8(1, f));
- SAFE(write_string(bi->nick, f));
- SAFE(write_string(bi->user, f));
- SAFE(write_string(bi->host, f));
- SAFE(write_string(bi->real, f));
- //SAFE(write_int16(bi->flags, f));
- SAFE(write_int16(0, f));
- SAFE(write_int32(bi->created, f));
- SAFE(write_int16(bi->chancount, f));
- }
- }
- SAFE(write_int8(0, f));
-
- close_db(f);
-
-}
-
-#undef SAFE
-
-/*************************************************************************/
-
/* Inserts a bot in the bot list. I can't be much explicit mh? */
void insert_bot(BotInfo * bi)