diff options
-rw-r--r-- | include/bots.h | 1 | ||||
-rw-r--r-- | modules/core/db_plain.cpp | 5 | ||||
-rw-r--r-- | src/bots.cpp | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/include/bots.h b/include/bots.h index 7dc81d22d..7d2fa74f3 100644 --- a/include/bots.h +++ b/include/bots.h @@ -32,6 +32,7 @@ enum BotFlag class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END> { public: + uint32 chancount; time_t created; /* Birth date ;) */ time_t lastmsg; /* Last time we said something */ CommandMap Commands; /* Commands on this bot */ diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp index 87653ba59..4622963b7 100644 --- a/modules/core/db_plain.cpp +++ b/modules/core/db_plain.cpp @@ -413,8 +413,7 @@ static void LoadBotInfo(const std::vector<Anope::string> ¶ms) bi->SetIdent(params[1]); bi->host = params[2]; bi->created = params[3].is_number_only() ? convertTo<time_t>(params[3]) : 0; - //bi no longer has a chancount, use bi->chans.size() - //bi->chancount = atol(params[4].c_str()); + bi->chancount = params[4].is_number_only() ? convertTo<uint32>(params[4]) : 0; bi->realname = params[5]; Alog(LOG_DEBUG_2) << "[db_plain]: Loaded botinfo for " << bi->nick; @@ -964,7 +963,7 @@ class DBPlain : public Module { BotInfo *bi = it->second; - db << "BI " << bi->nick << " " << bi->GetIdent() << " " << bi->host << " " << bi->created << " " << bi->chans.size() << " :" << bi->realname << endl; + db << "BI " << bi->nick << " " << bi->GetIdent() << " " << bi->host << " " << bi->created << " " << bi->chancount << " :" << bi->realname << endl; if (bi->FlagCount()) { db << "MD FLAGS"; diff --git a/src/bots.cpp b/src/bots.cpp index a5536e510..c07b358da 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -27,6 +27,7 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A this->realname = nreal; this->server = Me; + this->chancount = 0; this->lastmsg = this->created = time(NULL); if (!Config.s_ChanServ.empty() && nnick.equals_ci(Config.s_ChanServ)) @@ -107,6 +108,8 @@ void BotInfo::Assign(User *u, ChannelInfo *ci) if (ci->bi) ci->bi->UnAssign(u, ci); + + ++this->chancount; ci->bi = this; if (ci->c && ci->c->users.size() >= Config.BSMinUsers) @@ -128,6 +131,8 @@ void BotInfo::UnAssign(User *u, ChannelInfo *ci) ci->bi->Part(ci->c); } + --this->chancount; + ci->bi = NULL; } |