]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/main-common.c
Minor typo in previous commit where returning 0 when it should have been 1 from opser...
[irc/evilnet/x3.git] / src / main-common.c
index 67164aae71be4076896f90ff3b6308caa95481b9..1cd96dbbb414673c0957cc2f76ff3a8949c33531 100644 (file)
@@ -1,7 +1,10 @@
 extern FILE *replay_file;
 
-time_t boot_time, burst_begin, now;
-unsigned long burst_length;
+
+time_t boot_time;
+time_t burst_begin;
+time_t now;
+time_t burst_length;
 struct log_type *MAIN_LOG;
 
 int quit_services;
@@ -21,7 +24,6 @@ static const struct message_entry msgtab[] = {
     { "MSG_ON", "On" },
     { "MSG_OFF", "Off" },
     { "MSG_NEVER", "Never" },
-    { "MSG_BAR", "----------------------------------------" },
     { "MSG_SERVICE_IMMUNE", "$b%s$b may not be kicked, killed, banned, or deopped." },
     { "MSG_SERVICE_PRIVILEGED", "$b%s$b is a privileged service." },
     { "MSG_NOT_A_SERVICE", "$b%s$b is not a service bot." },
@@ -41,8 +43,8 @@ static const struct message_entry msgtab[] = {
     { "MSG_INVALID_GLINE", "Invalid G-line '%s'." },
     { "MSG_INVALID_DURATION", "Invalid time span '%s'." },
     { "MSG_NOT_TARGET_NAME", "You must provide the name of a channel or user." },
-    { "MSG_NOT_CHANNEL_NAME", "You must provide a valid channel name." },
-    { "MSG_INVALID_CHANNEL", "You must provide the name of a channel that exists." },
+    { "MSG_NOT_CHANNEL_NAME", "The channel name you specified is not a valid channel name." },
+    { "MSG_INVALID_CHANNEL", "The channel name you specified does not exist." },
     { "MSG_CHANNEL_ABSENT", "You aren't currently in $b%s$b." },
     { "MSG_CHANNEL_USER_ABSENT", "$b%s$b isn't currently in $b%s$b." },
     { "MSG_MISSING_PARAMS", "$b%s$b requires more parameters." },
@@ -52,7 +54,7 @@ static const struct message_entry msgtab[] = {
     { "MSG_STUPID_ACCESS_CHANGE", "Please ask someone $belse$b to demote you." },
     { "MSG_NO_SEARCH_ACCESS", "You do not have enough access to search based on $b%s$b." },
     { "MSG_INVALID_CRITERIA", "$b%s$b is an invalid search criteria." },
-    { "MSG_MATCH_COUNT", "-----------Found $b%3u$b Matches------------" },
+    { "MSG_MATCH_COUNT", "Found $b%u$b matches." },
     { "MSG_NO_MATCHES", "Nothing matched the criteria of your search." },
     { "MSG_TOPIC_UNKNOWN", "No help on that topic." },
     { "MSG_INVALID_BINARY", "$b%s$b is an invalid binary value." },
@@ -60,22 +62,25 @@ static const struct message_entry msgtab[] = {
     { "MSG_DB_UNKNOWN", "I do not know of a database named %s." },
     { "MSG_DB_IS_MONDO", "Database %s is in the \"mondo\" database and cannot be written separately." },
     { "MSG_DB_WRITE_ERROR", "Error while writing database %s." },
-    { "MSG_DB_WROTE_DB", "Wrote database %s (in "FMT_TIME_T".%06lu seconds)." },
-    { "MSG_DB_WROTE_ALL", "Wrote all databases (in "FMT_TIME_T".%06lu seconds)." },
-    { "MSG_AND", "and" },
+    { "MSG_DB_WROTE_DB", "Wrote database %s (in %lu.%06lu seconds)." },
+    { "MSG_DB_WROTE_ALL", "Wrote all databases (in %lu.%06lu seconds)." },
+    { "MSG_AND", "," },
     { "MSG_0_SECONDS", "0 seconds" },
-    { "MSG_YEAR", "year" },
-    { "MSG_YEARS", "years" },
-    { "MSG_WEEK", "week" },
-    { "MSG_WEEKS", "weeks" },
-    { "MSG_DAY", "day" },
-    { "MSG_DAYS", "days" },
-    { "MSG_HOUR", "hour" },
-    { "MSG_HOURS", "hours" },
-    { "MSG_MINUTE", "minute" },
-    { "MSG_MINUTES", "minutes" },
-    { "MSG_SECOND", "second" },
-    { "MSG_SECONDS", "seconds" },
+    { "MSG_YEAR", "y" },
+    { "MSG_YEARS", "y" },
+    { "MSG_WEEK", "w" },
+    { "MSG_WEEKS", "w" },
+    { "MSG_DAY", "d" },
+    { "MSG_DAYS", "d" },
+    { "MSG_HOUR", "h" },
+    { "MSG_HOURS", "h" },
+    { "MSG_MINUTE", "m" },
+    { "MSG_MINUTES", "m" },
+    { "MSG_SECOND", "s" },
+    { "MSG_SECONDS", "s" },
+    { "MSG_BAR", "----------------------------------------" },
+    { "MSG_INVALID_SHUN", "Invalid Shun '%s'." },
+    { "MSG_MATCH_COUNT", "-----------Found $b%3u$b Matches------------" },
     { NULL, NULL }
 };
 
@@ -376,20 +381,24 @@ received_ping(void)
 }
 
 static exit_func_t *ef_list;
+static void **ef_list_extra;
 static unsigned int ef_size = 0, ef_used = 0;
 
-void reg_exit_func(exit_func_t handler)
+void reg_exit_func(exit_func_t handler, void *extra)
 {
     if (ef_used == ef_size) {
         if (ef_size) {
             ef_size <<= 1;
             ef_list = realloc(ef_list, ef_size*sizeof(exit_func_t));
+            ef_list_extra = realloc(ef_list_extra, ef_size*sizeof(void*));
         } else {
             ef_size = 8;
             ef_list = malloc(ef_size*sizeof(exit_func_t));
+            ef_list_extra = malloc(ef_size*sizeof(void*));
         }
     }
-    ef_list[ef_used++] = handler;
+    ef_list[ef_used] = handler;
+    ef_list_extra[ef_used++] = extra;
 }
 
 void call_exit_funcs(void)
@@ -403,9 +412,11 @@ void call_exit_funcs(void)
      */
 
     while (n > 0) {
-        ef_list[--n]();
+        --n;
+        ef_list[n](ef_list_extra[n]);
     }
     free(ef_list);
+    free(ef_list_extra);
     ef_used = ef_size = 0;
 }
 
@@ -426,6 +437,11 @@ conf_globals(void)
     const char *info;
     dict_t dict;
 
+    info = conf_get_data("services/opserv/nick", RECDB_QSTRING);
+    if (info && (info[0] == '.'))
+        info = NULL;
+    init_opserv(info);
+
     info = conf_get_data("services/global/nick", RECDB_QSTRING);
     if (info && (info[0] == '.'))
         info = NULL;
@@ -463,10 +479,10 @@ conf_globals(void)
         policer_params_set(luser_policer_params, "drain-rate", "0.50");
     }
 
-    info = conf_get_data("services/opserv/nick", RECDB_QSTRING);
+    info = conf_get_data("services/spamserv/nick", RECDB_QSTRING);
     if (info && (info[0] == '.'))
         info = NULL;
-    init_opserv(info);
+    init_spamserv(info);
 }
 
 #ifdef HAVE_SYS_RESOURCE_H
@@ -531,7 +547,7 @@ conf_rlimits(void)
 #endif
 
 static void
-usage(char *self)
+usage(char *exe_name)
 {
     /* We can assume we have getopt_long(). */
     printf("Usage: %s [-c config] [-r log] [-d] [-f] [-v|-h]\n"
@@ -542,16 +558,16 @@ usage(char *self)
            " -k, --check          checks the configuration file's syntax.\n"
            " -r, --replay         replay a log file (for debugging).\n"
            " -v, --version        prints this program's version.\n"
-           , self);
+           , exe_name);
 }
 
 static void
 version()
 {
     printf("    --------------------------------------------------\n"
-           "    - "PACKAGE_STRING" ("CODENAME"), Built: " __DATE__ ", " __TIME__".\n"
+           "    - "PACKAGE_STRING", Built: " __DATE__ ", " __TIME__".\n"
            "    - Copyright (C) 2000 - 2005, srvx Development Team\n"
-           "    - Copyright (C) 2004 - 2007, X3 Development Team\n"
+           "    - Copyright (C) 2004 - 2005, X3 Development Team\n"
            "    --------------------------------------------------\n");
 }
 
@@ -574,7 +590,7 @@ license()
            "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n");
 }
 
-void main_shutdown(void)
+void main_shutdown(UNUSED_ARG(void *extra))
 {
     struct uplinkNode *ul, *ul_next;
     ioset_cleanup();