Bug fixes and cleanups
authorEntrope <entrope@clan-dk.org>
Thu, 4 Mar 2004 04:48:35 +0000 (04:48 +0000)
committerEntrope <entrope@clan-dk.org>
Thu, 4 Mar 2004 04:48:35 +0000 (04:48 +0000)
* 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
src/expnhelp.c [deleted file]
src/mod-helpserv.c
src/opserv.c

index 8edf11750097f662429beb74e580a659ac760eb5..dcdb6316dfc414c3e767a66123013bba64d75df2 100644 (file)
@@ -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 (file)
index 8e01716..0000000
+++ /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;
-}
index 145acd2ac1586eb495365a26c400ae661574dcba..3b3f402326872d8443603d1fad1f73213d25bb44 100644 (file)
@@ -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 {
index ed09ccb33cfe5be631ed69b38d4ad346802dd4a5..22f6d8697049cd96113107691ce29a7a2a6e0528 100644 (file)
@@ -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." },