From 277f735505ccb16d6fcc15ad21af4325e58f3615 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 5 Oct 2013 01:07:51 -0400 Subject: Hide expires in /cs info if the channel is actively in use as it confuses people --- modules/commands/cs_info.cpp | 2 +- modules/commands/cs_set.cpp | 4 ---- modules/pseudoclients/chanserv.cpp | 10 ++++++++++ 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/commands/cs_info.cpp b/modules/commands/cs_info.cpp index a52c43d87..e3a9dc743 100644 --- a/modules/commands/cs_info.cpp +++ b/modules/commands/cs_info.cpp @@ -37,7 +37,7 @@ class CommandCSInfo : public Command bool show_all = false; /* Should we show all fields? Only for sadmins and identified users */ - if (has_auspex || source.AccessFor(ci).HasPriv("INFO")) + if (source.AccessFor(ci).HasPriv("INFO") || has_auspex) show_all = true; InfoFormatter info(nc); diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 75c9348fe..782e1d6a0 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -1331,10 +1331,6 @@ class CSSet : public Module info.AddOption(_("Keep modes")); if (noautoop.HasExt(ci)) info.AddOption(_("No auto-op")); - - time_t chanserv_expire = Config->GetModule("chanserv")->Get("expire", "14d"); - if (!noexpire.HasExt(ci) && chanserv_expire && !Anope::NoExpire) - info[_("Expires")] = Anope::strftime(ci->last_used + chanserv_expire, source.GetAccount()); } }; diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp index 9f8cdc52e..5a70aefd3 100644 --- a/modules/pseudoclients/chanserv.cpp +++ b/modules/pseudoclients/chanserv.cpp @@ -460,6 +460,16 @@ class ChanServCore : public Module, public ChanServService return EVENT_CONTINUE; } + + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override + { + if (!show_all) + return; + + time_t chanserv_expire = Config->GetModule(this)->Get("expire", "14d"); + if (!ci->HasExt("CS_NO_EXPIRE") && chanserv_expire && !Anope::NoExpire && ci->last_used != Anope::CurTime) + info[_("Expires")] = Anope::strftime(ci->last_used + chanserv_expire, source.GetAccount()); + } }; MODULE_INIT(ChanServCore) -- cgit