diff options
Diffstat (limited to 'modules/commands/cs_seen.cpp')
-rw-r--r-- | modules/commands/cs_seen.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index 8f90e2f08..b7c821078 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -1,6 +1,6 @@ /* cs_seen: provides a seen command by tracking all users * - * (C) 2003-2012 Anope Team + * (C) 2003-2013 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. @@ -98,11 +98,11 @@ static bool ShouldHide(const Anope::string &channel, User *u) Channel *targetchan = Channel::Find(channel); const ChannelInfo *targetchan_ci = targetchan ? *targetchan->ci : ChannelInfo::Find(channel); - if (targetchan && targetchan->HasMode(CMODE_SECRET)) + if (targetchan && targetchan->HasMode("SECRET")) return true; - else if (targetchan_ci && targetchan_ci->HasFlag(CI_PRIVATE)) + else if (targetchan_ci && targetchan_ci->HasExt("PRIVATE")) return true; - else if (u && u->HasMode(UMODE_PRIV)) + else if (u && u->HasMode("PRIV")) return true; return false; } @@ -113,8 +113,8 @@ class CommandOSSeen : public Command CommandOSSeen(Module *creator) : Command(creator, "operserv/seen", 1, 2) { this->SetDesc(_("Statistics and maintenance for seen data")); - this->SetSyntax(_("\037STATS\037")); - this->SetSyntax(_("\037CLEAR\037 \037time\037")); + this->SetSyntax(_("STATS")); + this->SetSyntax(_("CLEAR \037time\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override @@ -132,7 +132,7 @@ class CommandOSSeen : public Command mem_counter += it->second->channel.capacity(); mem_counter += it->second->message.capacity(); } - source.Reply(_("%lu nicks are stored in the database, using %.2Lf kB of memory"), database.size(), static_cast<long double>(mem_counter) / 1024); + source.Reply(_("%lu nicks are stored in the database, using %.2Lf kB of memory."), database.size(), static_cast<long double>(mem_counter) / 1024); } else if (params[0].equals_ci("CLEAR")) { @@ -152,13 +152,13 @@ class CommandOSSeen : public Command if (time < buf->second->last) { Log(LOG_DEBUG) << buf->first << " was last seen " << Anope::strftime(buf->second->last) << ", deleting entry"; - buf->second->Destroy(); + delete buf->second; database.erase(buf); counter++; } } Log(LOG_ADMIN, source, this) << "CLEAR and removed " << counter << " nicks that were added after " << Anope::strftime(time, NULL, true); - source.Reply(_("Database cleared, removed %lu nicks that were added after %s"), counter, Anope::strftime(time, source.nc, true).c_str()); + source.Reply(_("Database cleared, removed %lu nicks that were added after %s."), counter, Anope::strftime(time, source.nc, true).c_str()); } else this->SendSyntax(source); @@ -173,8 +173,8 @@ class CommandOSSeen : public Command "entries from the database that were added within \037time\037.\n" " \n" "Example:\n" - "%s CLEAR 30m\n" - "will remove all entries that were added within the last 30 minutes."), source.command.c_str()); + " %s CLEAR 30m\n" + " Will remove all entries that were added within the last 30 minutes."), source.command.c_str()); return true; } }; @@ -184,7 +184,6 @@ class CommandSeen : public Command public: CommandSeen(Module *creator) : Command(creator, "chanserv/seen", 1, 2) { - this->SetFlag(CFLAG_STRIP_CHANNEL); this->SetDesc(_("Tells you about the last time a user was seen")); this->SetSyntax(_("\037nick\037")); } @@ -195,7 +194,7 @@ class CommandSeen : public Command if (target.length() > Config->NickLen) { - source.Reply(_("Nick too long, max length is %u chars"), Config->NickLen); + source.Reply(_("Nick too long, max length is %u characters."), Config->NickLen); return; } @@ -239,7 +238,7 @@ class CommandSeen : public Command if (u2) onlinestatus = Anope::printf( _(". %s is still online."), u2->nick.c_str()); else - onlinestatus = Anope::printf(_(", but %s mysteriously dematerialized"), info->nick2.c_str()); + onlinestatus = Anope::printf(_(", but %s mysteriously dematerialized."), info->nick2.c_str()); source.Reply(_("%s (%s) was last seen changing nick to %s %s ago%s"), target.c_str(), info->vhost.c_str(), info->nick2.c_str(), timebuf.c_str(), onlinestatus.c_str()); @@ -309,12 +308,12 @@ class DataBasePurger : public CallBack if ((Anope::CurTime - cur->second->last) > purgetime) { - Log(LOG_DEBUG) << cur->first << " was last seen " << Anope::strftime(cur->second->last) << ", purging entry"; - cur->second->Destroy(); + Log(LOG_DEBUG) << cur->first << " was last seen " << Anope::strftime(cur->second->last) << ", purging entries"; + delete cur->second; database.erase(cur); } } - Log(LOG_DEBUG) << "cs_seen: Purged Database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries."; + Log(LOG_DEBUG) << "cs_seen: Purged database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries."; } }; @@ -351,9 +350,9 @@ class CSSeen : public Module purger.SetSecs(expiretimeout); } - void OnUserConnect(Reference<User> &u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) anope_override { - if (u) + if (!u->Quitting()) UpdateUser(u, NEW, u->nick, "", "", ""); } |