summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-03-30 23:38:42 +0100
committerSadie Powell <sadie@witchery.services>2020-03-30 23:38:42 +0100
commit25052ccef3c47cc43af9b900a658e5c09e8bec2e (patch)
tree268768ec0359380c6d5014cad1ae1a58a94fee6e /src
parent9ebda853f5bc470858501897442610699a5fd5de (diff)
Make showing the channel modes in /LIST configurable.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_list.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/coremods/core_list.cpp b/src/coremods/core_list.cpp
index d925e7c82..68a41e9ea 100644
--- a/src/coremods/core_list.cpp
+++ b/src/coremods/core_list.cpp
@@ -47,8 +47,9 @@ class CommandList : public Command
}
public:
- /** Constructor for list.
- */
+ // Whether to show modes in the LIST response.
+ bool showmodes;
+
CommandList(Module* parent)
: Command(parent,"LIST", 0, 0)
, secretmode(creator, "secret")
@@ -185,11 +186,16 @@ CmdResult CommandList::Handle(User* user, const Params& parameters)
// Channel is private (+p) and user is outside/not privileged
user->WriteNumeric(RPL_LIST, '*', users, "");
}
- else
+ else if (showmodes)
{
- /* User is in the channel/privileged, channel is not +s */
+ // Show the list response with the modes and topic.
user->WriteNumeric(RPL_LIST, chan->name, users, InspIRCd::Format("[+%s] %s", chan->ChanModes(n), chan->topic.c_str()));
}
+ else
+ {
+ // Show the list response with just the modes.
+ user->WriteNumeric(RPL_LIST, chan->name, users, chan->topic);
+ }
}
}
user->WriteNumeric(RPL_LISTEND, "End of channel list.");
@@ -208,6 +214,12 @@ class CoreModList : public Module
{
}
+ void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
+ {
+ ConfigTag* tag = ServerInstance->Config->ConfValue("options");
+ cmd.showmodes = tag->getBool("modesinlist", true);
+ }
+
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["ELIST"] = "CMNTU";