From 0af3064ecc785cc8f341f9322c2047201687d86b Mon Sep 17 00:00:00 2001 From: Entrope Date: Thu, 4 Mar 2004 04:48:35 +0000 Subject: [PATCH] Bug fixes and cleanups * Remove unused src/expnhelp.c file. * Do not call mod_chanmode_announce() if we give a user neither voice nor ops (it causes an assertion failure). * Make switch() on mod_chanmode argument modes a little clearer. * Add OSMSG_NICK_UNRESERVED format string. * Translate weekly statistics report headers for HelpServ. git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-23 --- src/chanserv.c | 5 ++- src/expnhelp.c | 84 ---------------------------------------------- src/mod-helpserv.c | 14 +++++--- src/opserv.c | 1 + 4 files changed, 15 insertions(+), 89 deletions(-) delete mode 100644 src/expnhelp.c diff --git a/src/chanserv.c b/src/chanserv.c index 8edf117..dcdb631 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -5913,8 +5913,11 @@ handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle)) change.args[0].mode = MODE_CHANOP; else if(channel->access >= cn->channel_info->lvlOpts[lvlGiveVoice]) change.args[0].mode = MODE_VOICE; + else + change.args[0].mode = 0; change.args[0].member = mn; - mod_chanmode_announce(chanserv, cn, &change); + if(change.args[0].mode) + mod_chanmode_announce(chanserv, cn, &change); } channel->seen = now; diff --git a/src/expnhelp.c b/src/expnhelp.c deleted file mode 100644 index 8e01716..0000000 --- a/src/expnhelp.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "log.h" -#include "recdb.h" - -/* because recdb likes to log stuff.. */ -struct log_type *MAIN_LOG; -void log_module(UNUSED_ARG(struct log_type *lt), UNUSED_ARG(enum log_severity ls), const char *format, ...) -{ - va_list va; - va_start(va, format); - vfprintf(stderr, format, va); - va_end(va); - fflush(stderr); -} - -struct string_list *new_argv; -const char *hidden_host_suffix; - -struct cfg_scan { - struct cfg_scan *parent; - char *path; -}; - -int -scan_db(const char *key, void *data, void *extra) -{ - struct record_data *rd = data; - struct cfg_scan child, *self = extra; - - child.parent = extra; - - switch (rd->type) { - case RECDB_QSTRING: - if ((irccasestr(key, "enable") - || (irccasestr(key, "disable")) - || (irccasestr(key, "require"))) - && enabled_string(rd->d.qstring)) { - char *new_arg; - new_arg = malloc(strlen(self->path)+strlen(key)+4); - sprintf(new_arg, "-D%s/%s", self->path, key); - string_list_append(new_argv, new_arg); - } - break; - case RECDB_OBJECT: - child.path = malloc(strlen(self->path) + strlen(key) + 2); - sprintf(child.path, "%s/%s", self->path, key); - dict_foreach(rd->d.object, scan_db, &child); - free(child.path); - break; - default: /* ignore */ break; - } - return 0; -} - -int -main(int argc, char *argv[]) -{ - const char *cfg_file; - struct cfg_scan scanner; - dict_t cfg_db; - - tools_init(); - new_argv = alloc_string_list(4); - string_list_append(new_argv, strdup("m4")); - - if (argc > 1) { - cfg_file = argv[1]; - } else { - cfg_file = "srvx.conf"; - } - - if (!(cfg_db = parse_database(cfg_file))) { - fprintf(stderr, "Unable to parse config file %s; you will get a 'default' expansion.\n", cfg_file); - } else { - scanner.parent = NULL; - scanner.path = ""; - dict_foreach(cfg_db, scan_db, &scanner); - } - - string_list_append(new_argv, NULL); - execvp("m4", new_argv->list); - fprintf(stderr, "Error in exec: %s (%d)\n", strerror(errno), errno); - fprintf(stderr, "Maybe you do not have the 'm4' program installed?\n"); - return 1; -} diff --git a/src/mod-helpserv.c b/src/mod-helpserv.c index 145acd2..3b3f402 100644 --- a/src/mod-helpserv.c +++ b/src/mod-helpserv.c @@ -287,6 +287,12 @@ static const struct message_entry msgtab[] = { { "HSMSG_STATS_TIME", "$uTime spent helping in %s:$u" }, { "HSMSG_STATS_REQS", "$uRequest activity statistics:$u" }, +/* Status report headers */ + { "HSMSG_STATS_REPORT_0", "Stats report for current week" }, + { "HSMSG_STATS_REPORT_1", "Stats report for one week ago" }, + { "HSMSG_STATS_REPORT_2", "Stats report for two weeks ago" }, + { "HSMSG_STATS_REPORT_3", "Stats report for three weeks ago" }, + /* Responses to user commands */ { "HSMSG_YOU_BEING_HELPED", "You are already being helped." }, { "HSMSG_YOU_BEING_HELPED_BY", "You are already being helped by $b%s$b." }, @@ -457,10 +463,10 @@ static const char *weekday_names[] = { }; static const char *statsreport_week[] = { - "Stats report for current week", - "Stats report for one week ago", - "Stats report for two weeks ago", - "Stats report for three weeks ago" + "HSMSG_STATS_REPORT_0", + "HSMSG_STATS_REPORT_1", + "HSMSG_STATS_REPORT_2", + "HSMSG_STATS_REPORT_3" }; static struct { diff --git a/src/opserv.c b/src/opserv.c index ed09ccb..22f6d86 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -160,6 +160,7 @@ static const struct message_entry msgtab[] = { { "OSMSG_RAW_PARSE_ERROR", "Error parsing raw line (not dumping to uplink)." }, { "OSMSG_COLLIDED_NICK", "Now temporarily holding nick $b%s$b." }, { "OSMSG_RESERVED_NICK", "Now reserving nick $b%s$b." }, + { "OSMSG_NICK_UNRESERVED", "Nick $b%s$b is no longer reserve." }, { "OSMSG_NOT_RESERVED", "Nick $b%s$b is not reserved." }, { "OSMSG_ILLEGAL_REASON", "This channel is illegal." }, { "OSMSG_ILLEGAL_KILL_REASON", "Joined an illegal modeless channel - do not repeat." }, -- 2.20.1