]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/mod-memoserv.c
improve stats routing command
[irc/evilnet/x3.git] / src / mod-memoserv.c
index c800b3e00a0d9c8e38bd87b7bfb0c4a05af436cf..2ede913e5765f027ee1a2d30293c35fce9844100 100644 (file)
@@ -42,6 +42,7 @@
 #include "conf.h"
 #include "modcmd.h"
 #include "nickserv.h"
+#include "opserv.h"
 #include "saxdb.h"
 #include "timeq.h"
 
@@ -108,6 +109,8 @@ static const struct message_entry msgtab[] = {
     { "MSMSG_LIST_END",        "--------------End of Memos--------------" },
     { "MSMSG_BAR",             "----------------------------------------"},
 
+    { "MSMSG_DEFCON_NO_NEW_MEMOS", "You cannot send new memos at this time, please try again soon." },
+
     { NULL, NULL }
 };
 
@@ -401,6 +404,11 @@ static MODCMD_FUNC(cmd_send)
 
     MEMOSERV_MIN_PARAMS(3);
 
+    if (checkDefCon(DEFCON_NO_NEW_MEMOS) && !IsOper(user)) {
+        reply("MSMSG_DEFCON_NO_NEW_MEMOS");
+        return 0;
+    }
+
     if (!(hi = modcmd_get_handle_info(user, argv[1])))
         return 0;
 
@@ -1316,8 +1324,13 @@ memoserv_finalize(void) {
     str = database_get_data(conf_node, "bot", RECDB_QSTRING);
     if (str) {
         memoserv = memoserv_conf.bot;
-    } else
+        const char *modes = conf_get_data("modules/memoserv/modes", RECDB_QSTRING);
+        memoserv = AddService(str, modes ? modes : NULL, "User-User Memorandum Services", NULL);
+
+    } else {
         log_module(MS_LOG, LOG_ERROR, "database_get_data for memoserv_conf.bot failed!");
+        exit(1);
+    }
 
     if (autojoin_channels && memoserv) {
         for (i = 0; i < autojoin_channels->used; i++) {