diff options
Diffstat (limited to 'src/bots.cpp')
-rw-r--r-- | src/bots.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/bots.cpp b/src/bots.cpp index feedacc63..77b7d1c35 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -108,14 +108,31 @@ Serializable* BotInfo::Unserialize(Serializable *obj, Serialize::Data &data) void BotInfo::GenerateUID() { + if (this->introduced) + throw CoreException("Changing bot UID when it is introduced?"); + if (!this->uid.empty()) - throw CoreException("Bot already has a uid?"); + { + BotListByUID->erase(this->uid); + UserListByUID.erase(this->uid); + } this->uid = Servers::TS6_UID_Retrieve(); (*BotListByUID)[this->uid] = this; UserListByUID[this->uid] = this; } +void BotInfo::OnKill() +{ + this->introduced = false; + this->GenerateUID(); + IRCD->SendClientIntroduction(this); + this->introduced = true; + + for (User::ChanUserList::const_iterator cit = this->chans.begin(), cit_end = this->chans.end(); cit != cit_end; ++cit) + IRCD->SendJoin(this, cit->second->chan, &cit->second->status); +} + void BotInfo::SetNewNick(const Anope::string &newnick) { UserListByNick.erase(this->nick); |