changed spamserv,chanserv and watchdog messages to privmsgs
[srvx.git] / src / mod-watchdog.c
index 26bee0434ea06bcbeb4c491d8dbdca3e0e93e73e..0866b0076d37be6081c3bc0feafee95c78be78a0 100644 (file)
@@ -49,6 +49,7 @@
 
 static const struct message_entry msgtab[] = {
     { "WDMSG_REGISTER_SUCCESS", "$b%s$b is now registered with %s." },
+    { "WDMSG_UNREG_SUCCESS", "$b%s$b is now unregistered." },
     { "WDMSG_NOT_REGISTERED", "$b%s$b is not registered with %s." },
     { "WDMSG_ALREADY_ADDED", "$b%s$b is already added. (ID: %s)" },
     { "WDMSG_BADWORD_ADDED", "added '$b%s$b' to the badword list with ID %s." },
@@ -92,6 +93,7 @@ static struct {
     unsigned long ban_duration;
     unsigned long gline_duration;
     struct chanNode *alert_channel;
+    struct chanNode *oper_channel;
 } watchdog_conf;
 
 const char *watchdog_module_deps[] = { NULL };
@@ -107,6 +109,7 @@ static struct watchdog_channel *add_channel(const char *name);
 static struct badword *add_badword(const char *badword_mask, unsigned int triggered, unsigned int action, unsigned int alert, const char *id);
 #define watchdog_notice(target, format...) send_message(target , watchdog , ## format)
 #define watchdog_debug(format...) do { if(watchdog_conf.alert_channel) send_channel_message(watchdog_conf.alert_channel , watchdog , ## format); } while(0)
+#define watchdog_oper_message(format...) do { if(watchdog_conf.oper_channel) send_channel_message(watchdog_conf.oper_channel , watchdog , ## format); } while(0)
 
 static MODCMD_FUNC(cmd_addbad)
 {
@@ -353,6 +356,7 @@ static MODCMD_FUNC(cmd_register)
 
     add_channel(channel->name);
     reply("WDMSG_REGISTER_SUCCESS", channel->name, watchdog->nick);
+    watchdog_oper_message("WDMSG_REGISTER_SUCCESS", channel->name, watchdog->nick);
     return 1;
 }
 
@@ -374,6 +378,7 @@ static MODCMD_FUNC(cmd_unregister)
         DelChannelUser(watchdog, channel, reason, 0);
         dict_remove(chanlist, channel->name);
         reply("CSMSG_UNREG_SUCCESS", channel->name);
+        watchdog_oper_message("CSMSG_UNREG_SUCCESS", channel->name);
         return 1;
     } else {
         reply("WDMSG_NOT_REGISTERED", channel->name, watchdog->nick);
@@ -546,6 +551,15 @@ watchdog_conf_read(void)
                watchdog_conf.alert_channel = NULL;
        }
     
+       str = database_get_data(conf_node, "oper_chan", RECDB_QSTRING);
+       if(str)
+       {
+               watchdog_conf.oper_channel = AddChannel(str, now, "+tinms", NULL);
+       }
+       else
+       {
+               watchdog_conf.oper_channel = NULL;
+       }
 }
 
 static int