From 3ca644dc9a2069a0d477bd479bc62b800e893308 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Mon, 4 Jan 2016 12:54:06 +0100 Subject: [PATCH] /MODULE will now only list 3rd party modules by default since that's what most people are interested in. You can still see the full list of loaded modules by using "/MODULE -all". Also fix /MODULE , this was broken in earlier versions by nen.... you know who. --- doc/conf/help/help.conf | 33 +++++++++++++++++---------------- src/modules.c | 27 ++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/doc/conf/help/help.conf b/doc/conf/help/help.conf index c0d157190..97c0f8d65 100644 --- a/doc/conf/help/help.conf +++ b/doc/conf/help/help.conf @@ -1042,22 +1042,23 @@ help Mkpasswd { }; help Module { - " This will give you a list of all modules loaded."; - " Depending on whether you are a normal user or an oper"; - " it will give different output."; - " -- normal user: --"; - " Syntax of command: MODULE"; - " Output of command: *** name - (description) [3RD]"; - " the [3RD] flag is present if it's an 3rd party module."; - " -- ircop: -- "; - " Syntax of command: MODULE [server]"; - " Output of command: *** name - version (description) [optional flags]"; - " flags can be:"; - " [PERM]: permanent module (not possible to unload/reload)"; - " [Unloading]: module is in the process of unloading"; - " [3RD] 3rd party module"; - " [OLD?] Lacking Mod_Version, forgot to recompile an old beta* module?"; - " Additionally you'll see a list of which hooks and command"; + " This will show the list of modules loaded on the server."; + " By default it will only list 3rd party modules, unless you use -all"; + " -"; + " Syntax: MODULE [-all] [server]"; + " Example: MODULE"; + " -"; + " The output depends on whether you are a normal user or IRCOp:"; + " -- Normal user --"; + " *** name - (description) [3RD]"; + " The [3RD] flag is present if it's a 3rd party module."; + " -- IRCOp -- "; + " *** name - version (description) [optional flags]"; + " The optional flags may contain:"; + " [PERM]: Permanent module, not possible to unload/reload."; + " [PERM-BUT-RELOADABLE]: Module can be reloaded but not unloaded."; + " [3RD] 3rd party module, module is not part of UnrealIRCd."; + " Additionally you will see a list of which hooks and command"; " overrides are present (the hook number can be looked up in"; " include/modules.h)."; }; diff --git a/src/modules.c b/src/modules.c index e448079d3..e6a60e60b 100644 --- a/src/modules.c +++ b/src/modules.c @@ -976,19 +976,38 @@ int Module_Depend_Resolve(Module *p, char *path) */ int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - Module *mi; + Module *mi; int i; char tmp[1024], *p; aCommand *mptr; + int all = 0; #ifdef DEBUGMODE Efunction *e; #endif - if ((parc > 1) && (hunt_server(cptr, sptr, ":%s MODULES :%s", 1, parc, parv) != HUNTED_ISME)) + if ((parc > 1) && !strcmp(parv[1], "-all")) + all = 1; + + if (MyClient(sptr) && !IsOper(sptr) && all) + sptr->local->since += 7; /* Lag them up. Big list. */ + + if ((parc > 2) && (hunt_server(cptr, sptr, ":%s MODULE %s :%s", 2, parc, parv) != HUNTED_ISME)) return 0; - + + if ((parc == 2) && (parv[1][0] != '-') && (hunt_server(cptr, sptr, ":%s MODULE :%s", 1, parc, parv) != HUNTED_ISME)) + return 0; + + if (all) + sendnotice(sptr, "Showing ALL loaded modules:"); + else + sendnotice(sptr, "Showing loaded 3rd party modules (use \"MODULE -all\" to show all modules):"); + for (mi = Modules; mi; mi = mi->next) { + /* Skip official modules unless "MODULE -all" */ + if (!all && (mi->options & MOD_OPT_OFFICIAL)) + continue; + tmp[0] = '\0'; if (mi->flags & MODFLAG_DELAYED) strncat(tmp, "[Unloading] ", sizeof(tmp)-strlen(tmp)-1); @@ -1007,6 +1026,8 @@ int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[]) mi->header->name, mi->header->version, mi->header->description, tmp); } + sendnotice(sptr, "End of module list"); + if (!ValidatePermissionsForPath("server:module",sptr,NULL,NULL,NULL)) return 0;