mirror of
https://github.com/anope/anope.git
synced 2026-06-29 08:16:39 +02:00
Handle nick collisions somewhat instead of blindly overwriting the nicks
in memory, which does weird things. For fun different ircds implement this differently (Unreal compares timestamps, TS6 compares timestamps and user username/host), and whether or not we get a kill for our user also varies, so just kill everyone. This can't really happen anyway with properly set qlines, only if services haven't yet set the qlines, or possibly in a bot add/nick user introduce race, or with enforcers, which not many ircds require.
This commit is contained in:
+18
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user