summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 22:38:19 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 22:38:19 +0000
commit4e7636c28e7b35df80555e9817b5415885604684 (patch)
tree6040ad7b56a8e229194256c80a7e790d81898dd3 /src
parentbbaba3e0032c2ef923ffdd6ce5d42a0045c787c0 (diff)
Merge delbot() and cs_remove_bot() into BotInfo's destructor.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1281 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/bots.cpp25
-rw-r--r--src/chanserv.c15
-rw-r--r--src/core/bs_bot.c26
3 files changed, 26 insertions, 40 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index f58858d48..fb77e0381 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -34,6 +34,31 @@ BotInfo::BotInfo(const char *nnick, const char *nuser, const char *nhost, const
nbots++;
}
+BotInfo::~BotInfo()
+{
+ int i;
+ ChannelInfo *ci;
+
+ for (i = 0; i < 256; i++)
+ for (ci = chanlists[i]; ci; ci = ci->next)
+ if (ci->bi == this)
+ ci->bi = NULL;
+
+ if (this->next)
+ this->next->prev = this->prev;
+ if (this->prev)
+ this->prev->next = this->next;
+ else
+ botlists[tolower(*this->nick)] = this->next;
+
+ nbots--;
+
+ free(this->nick);
+ free(this->user);
+ free(this->host);
+ free(this->real);
+}
+
void BotInfo::ChangeNick(const char *newnick)
{
diff --git a/src/chanserv.c b/src/chanserv.c
index 8e700077b..988e94021 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -1742,21 +1742,6 @@ void cs_remove_nick(const NickCore * nc)
/*************************************************************************/
-/* Removes any reference to a bot */
-
-void cs_remove_bot(const BotInfo * bi)
-{
- int i;
- ChannelInfo *ci;
-
- for (i = 0; i < 256; i++)
- for (ci = chanlists[i]; ci; ci = ci->next)
- if (ci->bi == bi)
- ci->bi = NULL;
-}
-
-/*************************************************************************/
-
/* Return the ChannelInfo structure for the given channel, or NULL if the
* channel isn't registered. */
diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c
index 3701bf662..54b51200c 100644
--- a/src/core/bs_bot.c
+++ b/src/core/bs_bot.c
@@ -16,7 +16,6 @@
#include "module.h"
int do_bot(User * u);
-int delbot(BotInfo * bi);
void myBotServHelp(User * u);
/**
@@ -327,7 +326,7 @@ int do_bot(User * u)
if (ircd->sqline) {
anope_cmd_unsqline(bi->nick);
}
- delbot(bi);
+ delete bi;
notice_lang(s_BotServ, u, BOT_BOT_DELETED, nick);
}
@@ -337,28 +336,5 @@ int do_bot(User * u)
return MOD_CONT;
}
-int delbot(BotInfo * bi)
-{
- cs_remove_bot(bi);
-
- if (bi->next)
- bi->next->prev = bi->prev;
- if (bi->prev)
- bi->prev->next = bi->next;
- else
- botlists[tolower(*bi->nick)] = bi->next;
-
- nbots--;
-
- free(bi->nick);
- free(bi->user);
- free(bi->host);
- free(bi->real);
-
- free(bi);
-
- return 1;
-}
-
MODULE_INIT("bs_bot")