0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 13:18:58 +02:00

modules: show module provenance in modlist

This commit is contained in:
Elizabeth Myers 2016-03-06 23:21:08 -06:00
parent 216d70e91d
commit 978b723252
2 changed files with 22 additions and 8 deletions

View file

@ -202,7 +202,7 @@
#define NUMERIC_STR_670 ":STARTTLS successful, proceed with TLS handshake" #define NUMERIC_STR_670 ":STARTTLS successful, proceed with TLS handshake"
#define NUMERIC_STR_671 "%s :%s" #define NUMERIC_STR_671 "%s :%s"
#define NUMERIC_STR_691 ":%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_703 ":%s 703 %s :End of /MODLIST."
#define NUMERIC_STR_704 ":%s 704 %s %s :%s" #define NUMERIC_STR_704 ":%s 704 %s %s :%s"
#define NUMERIC_STR_705 ":%s 705 %s %s :%s" #define NUMERIC_STR_705 ":%s 705 %s %s :%s"

View file

@ -559,6 +559,20 @@ do_modlist(struct Client *source_p, const char *pattern)
for (i = 0; i < num_mods; i++) 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(pattern)
{ {
if(match(pattern, modlist[i]->name)) 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), sendto_one(source_p, form_str(RPL_MODLIST),
me.name, source_p->name, me.name, source_p->name,
modlist[i]->name, modlist[i]->name,
(unsigned long)(uintptr_t)modlist[i]->address, (unsigned long)(uintptr_t)modlist[i]->address, origin,
modlist[i]->version, modlist[i]->description, modlist[i]->core ? " (core)" : ""); modlist[i]->core ? " (core)" : "", modlist[i]->version, modlist[i]->description);
} }
} }
else else
{ {
sendto_one(source_p, form_str(RPL_MODLIST), sendto_one(source_p, form_str(RPL_MODLIST),
me.name, source_p->name, modlist[i]->name, me.name, source_p->name, modlist[i]->name,
(unsigned long)(uintptr_t)modlist[i]->address, (unsigned long)(uintptr_t)modlist[i]->address, origin,
modlist[i]->version, modlist[i]->description, modlist[i]->core ? " (core)" : ""); 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; struct CapabilityIndex *idx;
switch(m->cap_index) switch (m->cap_index)
{ {
case MAPI_CAP_CLIENT: case MAPI_CAP_CLIENT:
idx = cli_capindex; idx = cli_capindex;
@ -924,7 +938,7 @@ load_a_module(const char *path, int warn, int origin, int core)
struct CapabilityIndex *idx; struct CapabilityIndex *idx;
int result; int result;
switch(m->cap_index) switch (m->cap_index)
{ {
case MAPI_CAP_CLIENT: case MAPI_CAP_CLIENT:
idx = cli_capindex; idx = cli_capindex;
@ -984,7 +998,7 @@ load_a_module(const char *path, int warn, int origin, int core)
{ {
const char *o; const char *o;
switch(origin) switch (origin)
{ {
case MAPI_ORIGIN_EXTENSION: case MAPI_ORIGIN_EXTENSION:
o = "extension"; o = "extension";