0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 08:21:09 +01: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);
} }
} }