diff --git a/src/modules/chanmodes/floodprot.c b/src/modules/chanmodes/floodprot.c index 19fffd920..fd504412b 100644 --- a/src/modules/chanmodes/floodprot.c +++ b/src/modules/chanmodes/floodprot.c @@ -1472,9 +1472,12 @@ void memberflood_free(ModData *md) int floodprot_stats(Client *client, char *flag) { + if (*flag != 'S') + return 0; + sendtxtnumeric(client, "modef-default-unsettime: %hd", (unsigned short)MODEF_DEFAULT_UNSETTIME); sendtxtnumeric(client, "modef-max-unsettime: %hd", (unsigned short)MODEF_MAX_UNSETTIME); - return 0; + return 1; } /** Admin unloading the floodprot module for good. Bad. */ diff --git a/src/modules/dccdeny.c b/src/modules/dccdeny.c index 43f70e870..e22e9da04 100644 --- a/src/modules/dccdeny.c +++ b/src/modules/dccdeny.c @@ -40,6 +40,7 @@ int dccdeny_configtest_deny_dcc(ConfigFile *cf, ConfigEntry *ce, int type, int * int dccdeny_configtest_allow_dcc(ConfigFile *cf, ConfigEntry *ce, int type, int *errs); int dccdeny_configrun_deny_dcc(ConfigFile *cf, ConfigEntry *ce, int type); int dccdeny_configrun_allow_dcc(ConfigFile *cf, ConfigEntry *ce, int type); +int dccdeny_stats(Client *client, char *para); CMD_FUNC(cmd_dccdeny); CMD_FUNC(cmd_undccdeny); CMD_FUNC(cmd_svsfline); @@ -75,6 +76,7 @@ MOD_INIT() CommandAdd(modinfo->handle, "DCCDENY", cmd_dccdeny, 2, CMD_USER); CommandAdd(modinfo->handle, "UNDCCDENY", cmd_undccdeny, MAXPARA, CMD_USER); CommandAdd(modinfo->handle, "SVSFLINE", cmd_svsfline, MAXPARA, CMD_SERVER); + HookAdd(modinfo->handle, HOOKTYPE_STATS, 0, dccdeny_stats); HookAdd(modinfo->handle, HOOKTYPE_CAN_SEND_TO_USER, 0, dccdeny_can_send_to_user); HookAdd(modinfo->handle, HOOKTYPE_CAN_SEND_TO_CHANNEL, 0, dccdeny_can_send_to_channel); HookAdd(modinfo->handle, HOOKTYPE_SERVER_SYNC, 0, dccdeny_server_sync); @@ -818,14 +820,17 @@ static void dcc_wipe_services(void) } -// FIXME: hook into HOOKTYPE_STATS -int stats_denydcc(Client *client, char *para) +int dccdeny_stats(Client *client, char *para) { ConfigItem_deny_dcc *denytmp; ConfigItem_allow_dcc *allowtmp; char *filemask, *reason; char a = 0; + /* '/STATS F' or '/STATS denydcc' is for us... */ + if (strcmp(para, "F") && strcasecmp(para, "denydcc")) + return 0; + for (denytmp = conf_deny_dcc; denytmp; denytmp = denytmp->next) { filemask = BadPtr(denytmp->filename) ? "" : denytmp->filename; @@ -853,8 +858,5 @@ int stats_denydcc(Client *client, char *para) sendtxtnumeric(client, "a %c %c %s", (allowtmp->flag.type == DCCDENY_SOFT) ? 's' : 'h', a, filemask); } - return 0; + return 1; } - -// { 'F', "denydcc", stats_denydcc, 0 }, - diff --git a/src/modules/staff.c b/src/modules/staff.c index 6f13ceffe..e9462be59 100644 --- a/src/modules/staff.c +++ b/src/modules/staff.c @@ -330,7 +330,10 @@ static int cb_conf(ConfigFile *cf, ConfigEntry *ce, int type) static int cb_stats(Client *client, char *flag) { if (*flag == 'S') + { sendtxtnumeric(client, "staff-file: %s", STAFF_FILE); + return 1; + } return 0; } diff --git a/src/modules/stats.c b/src/modules/stats.c index 530d81d19..9d109af18 100644 --- a/src/modules/stats.c +++ b/src/modules/stats.c @@ -292,6 +292,7 @@ static inline char *allow_user_stats_long_to_short() CMD_FUNC(cmd_stats) { struct statstab *stat; + char flags[2]; if (parc == 3 && parv[2][0] != '+' && parv[2][0] != '-') { @@ -334,11 +335,24 @@ CMD_FUNC(cmd_stats) if (!stat) { - stats_help(client); + /* Not found. Perhaps a module provides it? */ + Hook *h; + int found = 0, n; + for (h = Hooks[HOOKTYPE_STATS]; h; h = h->next) + { + n = (*(h->func.intfunc))(client, parv[1]); + if (n == 1) + found = 1; + } + if (!found) + stats_help(client); sendnumeric(client, RPL_ENDOFSTATS, '*'); return; } + flags[0] = stat->flag; + flags[1] = '\0'; + if (stat->options & FLAGS_AS_PARA) { if (parc > 2 && (parv[2][0] == '+' || parv[2][0] == '-')) @@ -362,7 +376,12 @@ CMD_FUNC(cmd_stats) } else stat->func(client, NULL); + + /* Modules can append data: */ + RunHook2(HOOKTYPE_STATS, client, flags); + sendnumeric(client, RPL_ENDOFSTATS, stat->flag); + if (!IsULine(client)) sendto_snomask(SNO_EYES, "Stats \'%c\' requested by %s (%s@%s)", stat->flag, client->name, client->user->username, GetHost(client));