diff options
author | Adam <Adam@anope.org> | 2013-05-08 11:13:48 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-05-08 11:13:48 -0400 |
commit | f843e7bd9032923bd231bc83536a89d32e59d857 (patch) | |
tree | 8897524a20e2a0d48fa8b38414a8d912ce7e3aae /modules/commands/ns_suspend.cpp | |
parent | d7e2ab688b73a9316a75fd8cd39dc676a6e39a7f (diff) |
Fix suspend info output in info and improved it
Diffstat (limited to 'modules/commands/ns_suspend.cpp')
-rw-r--r-- | modules/commands/ns_suspend.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp index e0bb6bf93..5ca9ca81d 100644 --- a/modules/commands/ns_suspend.cpp +++ b/modules/commands/ns_suspend.cpp @@ -73,7 +73,7 @@ class CommandNSSuspend : public Command nc->ExtendMetadata("suspend:reason", reason); if (expiry_secs > 0) nc->ExtendMetadata("suspend:expire", stringify(Anope::CurTime + expiry_secs)); - + nc->ExtendMetadata("suspend:time", stringify(Anope::CurTime)); for (unsigned i = 0; i < nc->aliases->size(); ++i) { @@ -148,6 +148,7 @@ class CommandNSUnSuspend : public Command na->nc->Shrink("suspend:expire"); na->nc->Shrink("suspend:by"); na->nc->Shrink("suspend:reason"); + na->nc->Shrink("suspend:time"); Log(LOG_ADMIN, source, this) << "for " << na->nick; source.Reply(_("Nick %s is now released."), nick.c_str()); @@ -175,10 +176,25 @@ class NSSuspend : public Module NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnssuspend(this), commandnsunsuspend(this) { - Implementation i[] = { I_OnPreNickExpire }; + Implementation i[] = { I_OnPreNickExpire, I_OnNickInfo }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + { + if (na->nc->HasExt("SUSPENDED")) + { + Anope::string *by = na->nc->GetExt<ExtensibleItemClass<Anope::string> *>("suspend:by"), *reason = na->nc->GetExt<ExtensibleItemClass<Anope::string> *>("suspend:reason"), *t = na->nc->GetExt<ExtensibleItemClass<Anope::string> *>("suspend:time"); + info["Suspended"] = "This nickname is \2suspended\2."; + if (by) + info["Suspended by"] = *by; + if (reason) + info["Suspend reason"] = *reason; + if (t) + info["Suspended on"] = Anope::strftime(convertTo<time_t>(*t), source.GetAccount(), true); + } + } + void OnPreNickExpire(NickAlias *na, bool &expire) anope_override { if (!na->nc->HasExt("SUSPENDED")) @@ -200,6 +216,7 @@ class NSSuspend : public Module na->nc->Shrink("suspend:expire"); na->nc->Shrink("suspend:by"); na->nc->Shrink("suspend:reason"); + na->nc->Shrink("suspend:time"); Log(LOG_NORMAL, "expire", NickServ) << "Expiring suspend for " << na->nick; } |