1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 01:03:14 +02:00

Core prep for p10 stuff

This commit is contained in:
Adam
2014-05-21 08:50:40 -04:00
parent 5a1257b7f0
commit f627a3bacd
27 changed files with 166 additions and 138 deletions
+22 -16
View File
@@ -21,7 +21,7 @@
Serialize::Checker<botinfo_map> BotListByNick("BotInfo"), BotListByUID("BotInfo");
BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, "", "", Me, nreal, Anope::CurTime, "", Servers::TS6_UID_Retrieve(), NULL), Serializable("BotInfo"), channels("ChannelInfo"), botmodes(bmodes)
BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, "", "", Me, nreal, Anope::CurTime, "", IRCD ? IRCD->UID_Retrieve() : "", NULL), Serializable("BotInfo"), channels("ChannelInfo"), botmodes(bmodes)
{
this->lastmsg = this->created = Anope::CurTime;
this->introduced = false;
@@ -96,7 +96,7 @@ Serializable* BotInfo::Unserialize(Serializable *obj, Serialize::Data &data)
BotInfo *bi;
if (obj)
bi = anope_dynamic_static_cast<BotInfo *>(obj);
else if (!(bi = BotInfo::Find(nick)))
else if (!(bi = BotInfo::Find(nick, true)))
bi = new BotInfo(nick, user, host, realname);
data["created"] >> bi->created;
@@ -118,7 +118,7 @@ void BotInfo::GenerateUID()
UserListByUID.erase(this->uid);
}
this->uid = Servers::TS6_UID_Retrieve();
this->uid = IRCD->UID_Retrieve();
(*BotListByUID)[this->uid] = this;
UserListByUID[this->uid] = this;
}
@@ -215,9 +215,9 @@ void BotInfo::Part(Channel *c, const Anope::string &reason)
IRCD->SendPart(this, c, "%s", !reason.empty() ? reason.c_str() : "");
FOREACH_MOD(OnPartChannel, (this, c, c->name, reason));
c->DeleteUser(this);
FOREACH_MOD(OnPartChannel, (this, c, c->name, reason));
}
void BotInfo::OnMessage(User *u, const Anope::string &message)
@@ -248,22 +248,28 @@ CommandInfo *BotInfo::GetCommand(const Anope::string &cname)
BotInfo* BotInfo::Find(const Anope::string &nick, bool nick_only)
{
BotInfo *bi = NULL;
if (!nick_only && isdigit(nick[0]) && IRCD->RequiresID)
if (!nick_only && IRCD != NULL && IRCD->RequiresID)
{
botinfo_map::iterator it = BotListByUID->find(nick);
if (it != BotListByUID->end())
bi = it->second;
}
else
{
botinfo_map::iterator it = BotListByNick->find(nick);
if (it != BotListByNick->end())
bi = it->second;
{
BotInfo *bi = it->second;
bi->QueueUpdate();
return bi;
}
if (IRCD->AmbiguousID)
return NULL;
}
if (bi)
botinfo_map::iterator it = BotListByNick->find(nick);
if (it != BotListByNick->end())
{
BotInfo *bi = it->second;
bi->QueueUpdate();
return bi;
return bi;
}
return NULL;
}