From 978b723252152a11f1f6ec984aa80bd829237616 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sun, 6 Mar 2016 23:21:08 -0600 Subject: [PATCH] modules: show module provenance in modlist --- include/messages.h | 2 +- ircd/modules.c | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/include/messages.h b/include/messages.h index fa3ff1c33..d656f8dcd 100644 --- a/include/messages.h +++ b/include/messages.h @@ -202,7 +202,7 @@ #define NUMERIC_STR_670 ":STARTTLS successful, proceed with TLS handshake" #define NUMERIC_STR_671 "%s :%s" #define NUMERIC_STR_691 ":%s" -#define NUMERIC_STR_702 ":%s 702 %s %s 0x%lx :[Version %s] [Description: %s]%s" +#define NUMERIC_STR_702 ":%s 702 %s %s 0x%lx %s%s :[Version %s] [Description: %s]" #define NUMERIC_STR_703 ":%s 703 %s :End of /MODLIST." #define NUMERIC_STR_704 ":%s 704 %s %s :%s" #define NUMERIC_STR_705 ":%s 705 %s %s :%s" diff --git a/ircd/modules.c b/ircd/modules.c index a1fe94707..4bd88d464 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -559,6 +559,20 @@ do_modlist(struct Client *source_p, const char *pattern) for (i = 0; i < num_mods; i++) { + const char *origin; + switch (modlist[i]->origin) + { + case MAPI_ORIGIN_EXTENSION: + origin = "extension"; + break; + case MAPI_ORIGIN_CORE: + origin = "builtin"; + break; + default: + origin = "unknown"; + break; + } + if(pattern) { if(match(pattern, modlist[i]->name)) @@ -566,16 +580,16 @@ do_modlist(struct Client *source_p, const char *pattern) sendto_one(source_p, form_str(RPL_MODLIST), me.name, source_p->name, modlist[i]->name, - (unsigned long)(uintptr_t)modlist[i]->address, - modlist[i]->version, modlist[i]->description, modlist[i]->core ? " (core)" : ""); + (unsigned long)(uintptr_t)modlist[i]->address, origin, + modlist[i]->core ? " (core)" : "", modlist[i]->version, modlist[i]->description); } } else { sendto_one(source_p, form_str(RPL_MODLIST), me.name, source_p->name, modlist[i]->name, - (unsigned long)(uintptr_t)modlist[i]->address, - modlist[i]->version, modlist[i]->description, modlist[i]->core ? " (core)" : ""); + (unsigned long)(uintptr_t)modlist[i]->address, origin, + modlist[i]->core ? " (core)" : "", modlist[i]->version, modlist[i]->description); } } @@ -732,7 +746,7 @@ unload_one_module(const char *name, int warn) { struct CapabilityIndex *idx; - switch(m->cap_index) + switch (m->cap_index) { case MAPI_CAP_CLIENT: idx = cli_capindex; @@ -924,7 +938,7 @@ load_a_module(const char *path, int warn, int origin, int core) struct CapabilityIndex *idx; int result; - switch(m->cap_index) + switch (m->cap_index) { case MAPI_CAP_CLIENT: idx = cli_capindex; @@ -984,7 +998,7 @@ load_a_module(const char *path, int warn, int origin, int core) { const char *o; - switch(origin) + switch (origin) { case MAPI_ORIGIN_EXTENSION: o = "extension";