summaryrefslogtreecommitdiff
path: root/src/bots.cpp
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 18:45:11 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 18:45:11 +0000
commitc4d520b465f8aa7f5924b17b697fa760b6ead409 (patch)
tree96f6c2164077f7319bc6be855ce250e23ec9f07d /src/bots.cpp
parent76cc8d0462422eed9d7af255b152c24697821309 (diff)
Move some stuff to BotInfo methods.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1232 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/bots.cpp')
-rw-r--r--src/bots.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index 487cc6dc7..29f51f0e0 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -45,3 +45,32 @@ void BotInfo::RejoinAll()
if (ci->bi == this && ci->c && (ci->c->usercount >= BSMinUsers))
bot_join(ci);
}
+
+void BotInfo::Assign(User *u, ChannelInfo *ci)
+{
+ if (ci->bi)
+ {
+ if (u)
+ ci->bi->UnAssign(u, ci);
+ else
+ ci->bi->UnAssign(NULL, ci);
+ }
+
+ ci->bi = this;
+ this->chancount++;
+ if (ci->c && ci->c->usercount >= BSMinUsers)
+ bot_join(ci);
+}
+
+void BotInfo::UnAssign(User *u, ChannelInfo *ci)
+{
+ send_event(EVENT_BOT_UNASSIGN, 2, ci->name, ci->bi->nick);
+
+ if (u && ci->c && ci->c->usercount >= BSMinUsers)
+ anope_cmd_part(ci->bi->nick, ci->name, "UNASSIGN from %s", u->nick);
+
+ ci->bi->chancount--;
+ ci->bi = NULL;
+}
+
+