]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Make showing the channel modes in /LIST configurable.
authorSadie Powell <sadie@witchery.services>
Mon, 30 Mar 2020 22:38:42 +0000 (23:38 +0100)
committerSadie Powell <sadie@witchery.services>
Mon, 30 Mar 2020 22:38:42 +0000 (23:38 +0100)
docs/conf/inspircd.conf.example
src/coremods/core_list.cpp

index 4c56db448b3cd6db3dda49a7b8fa1ba3b927175d..c9691b8571062baf10691730a53c74366978653c 100644 (file)
          # link with servers running 2.0. Defaults to yes.
          allowzerolimit="no"
 
+         # modesinlist: If enabled then the current channel modes will be shown
+         # in the /LIST response. Defaults to yes.
+         modesinlist="no"
+
          # exemptchanops: Allows users with with a status mode to be exempt
          # from various channel restrictions. Possible restrictions are:
          #  - anticaps        Channel mode +B - blocks messages with too many capital
index d925e7c8249de607009974cfb5f83d9e45ed1e7d..68a41e9ea6cf0da5a79d56bb2bf8e7a921ce1896 100644 (file)
@@ -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";