fixed compiler error
authorNurPech <nurpech@nurpech.de>
Sun, 19 May 2013 23:51:57 +0000 (01:51 +0200)
committerNurPech <nurpech@nurpech.de>
Mon, 20 May 2013 01:09:16 +0000 (03:09 +0200)
src/mod-watchdog.c
src/modcmd.c
src/spamserv.c
srvx.conf.example

index ba8bc5988f2ae9584550dc74ee7a8c0c33f90040..26bee0434ea06bcbeb4c491d8dbdca3e0e93e73e 100644 (file)
@@ -60,7 +60,7 @@ static const struct message_entry msgtab[] = {
     { "WDMSG_BADWORD_SET", "Settings for BadWord entry $b%s$b" },
     { "WDMSG_BADWORD_SET_MASK",   "$bMASK$b:   %s" },
     { "WDMSG_BADWORD_SET_ACTION", "$bACTION$b: %s" },
-    { "WDMSG_BADWORD_ALERT", "%s used badword '%s' in channel: %s" },
+    { "WDMSG_BADWORD_SET_ALERT",  "$bALERT$b:  %d" },
     { NULL, NULL }
 };
 
@@ -83,12 +83,15 @@ struct watchdog_channel {
 #define BADACTION_KILL   2
 #define BADACTION_GLINE  3
 
+#define WDMSG_BADWORD_ALERT "%s used badword '%s' in channel: %s"
+
 static struct {
     const char *nick;
     const char *modes;
     const char *punishment_reason;
     unsigned long ban_duration;
     unsigned long gline_duration;
+    struct chanNode *alert_channel;
 } watchdog_conf;
 
 const char *watchdog_module_deps[] = { NULL };
@@ -101,8 +104,9 @@ static struct log_type *MS_LOG;
 static unsigned int last_badword_id = 0;
 
 static struct watchdog_channel *add_channel(const char *name);
-static struct badword *add_badword(const char *badword_mask, unsigned int triggered, unsigned int action, const char *id);
+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)
 
 static MODCMD_FUNC(cmd_addbad)
 {
@@ -116,7 +120,7 @@ static MODCMD_FUNC(cmd_addbad)
         }
     }
 
-    struct badword *new_badword = add_badword(mask, 0, BADACTION_KICK, NULL);
+    struct badword *new_badword = add_badword(mask, 0, BADACTION_KICK, 0, NULL);
     for (it = dict_first(shitlist); it; it = iter_next(it)) {
         struct badword *badword = iter_data(it);
         if(match_ircglob(badword->badword_mask, new_badword->badword_mask) && badword != new_badword) {
@@ -182,8 +186,10 @@ static MODCMD_FUNC(cmd_setbad)
             else if(!strcmp("ALERT",setting)) {
                 if (!strcmp("0",value)) {
                        badword->alert = 0;
+                       reply("WDMSG_BADWORD_SET_DONE");
                 } else if (!strcmp("1",value)) {
                        badword->alert = 1;
+                       reply("WDMSG_BADWORD_SET_DONE");
                 } else {
                        reply("WDMSG_BADWORD_SET_INVALID", setting);
                 }
@@ -210,6 +216,7 @@ static MODCMD_FUNC(cmd_setbad)
                 default:
                   reply("WDMSG_BADWORD_SET_ACTION", "*undef*");
             }
+            reply("WDMSG_BADWORD_SET_ALERT", badword->alert);
         }
     } else {
         reply("WDMSG_BADWORD_NOT_FOUND", argv[1]);
@@ -383,7 +390,8 @@ watchdog_detected_badword(struct userNode *user, struct chanNode *chan, struct b
     char mask[IRC_NTOP_MAX_SIZE+3] = { '*', '@', '\0' };
     if(!IsOper(user)) {
        if(badword->alert == 1) {
-               log_module(MS_LOG, LOG_WARNING, "WDMSG_BADWORD_ALERT", user->nick, badword->badword_mask, channel->name);
+               log_module(MS_LOG, LOG_WARNING, "%s used badword '%s' in channel: %s", user->nick, badword->badword_mask, chan->name);
+               watchdog_debug(WDMSG_BADWORD_ALERT, user->nick, badword->badword_mask, chan->name);
        }
                switch(badword->action) {
                        case BADACTION_BAN:
@@ -527,6 +535,16 @@ watchdog_conf_read(void)
     
     str = database_get_data(conf_node, "punishment_reason", RECDB_QSTRING);
        watchdog_conf.punishment_reason = (str ? str : "Your message contained a forbidden word.");
+
+       str = database_get_data(conf_node, "alert_chan", RECDB_QSTRING);
+       if(str)
+       {
+               watchdog_conf.alert_channel = AddChannel(str, now, "+tinms", NULL);
+       }
+       else
+       {
+               watchdog_conf.alert_channel = NULL;
+       }
     
 }
 
@@ -535,7 +553,7 @@ watchdog_saxdb_read_shitlist(const char *name, void *data, UNUSED_ARG(void *extr
 {
     struct record_data *rd = data;
     char *badword;
-    char *triggered, *action;
+    char *triggered, *action, *alert;
 
      if (rd->type == RECDB_OBJECT) {
         dict_t obj = GET_RECORD_OBJECT(rd);
index bb3199fea23bba07c84938665c1f9db032406d7c..a8e123a63dd9e285a52d050337e92c7646a12615 100644 (file)
@@ -1942,7 +1942,7 @@ static MODCMD_FUNC(cmd_version) {
      * copyright information pertaining to changes you make to srvx.
      */
     send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"$b ("CODENAME"), GIT Revision: %s, Built: "__DATE__", "__TIME__".  Copyright 2000-2008 srvx Development Team.", git_version);
-    send_message_type(12, user, cmd->parent->bot, "The srvx Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others.\nThe srvx Development Team can be reached at http://sf.net/projects/srvx/ or in #srvx on irc.gamesurge.net.\nThis version has been modified by pk910 - visit #srvx @ irc.nextirc.net.\nThis version has been modified by Stricted - visit #dev @ irc.easy-scripting.net.");
+    send_message_type(12, user, cmd->parent->bot, "The srvx Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others.\nThe srvx Development Team can be reached at http://sf.net/projects/srvx/ or in #srvx on irc.gamesurge.net.\nThis version has been modified by pk910 - visit #srvx @ irc.nextirc.net.\nThis version has been modified by Stricted, NurPech - visit #dev @ irc.easy-scripting.net.");
     return 1;
 }
 
index 82eb0dcc2720a9e721789e133d8c2a7605caea93..aaf17b7178896829ee26038b11faab8f4d33edc8 100644 (file)
@@ -69,7 +69,7 @@ dict_t connected_users_dict;
 dict_t killed_users_dict;
 
 #define spamserv_notice(target, format...) send_message(target , spamserv , ## format)
-#define spamserv_debug(format...) do { if(spamserv_conf.debug_channel) send_channel_privmsg(spamserv_conf.debug_channel , spamserv , ## format); } while(0)
+#define spamserv_debug(format...) do { if(spamserv_conf.debug_channel) send_channel_message(spamserv_conf.debug_channel , spamserv , ## format); } while(0)
 #define ss_reply(format...)    send_message(user , spamserv , ## format)
 
 #define SET_SUBCMDS_SIZE 10
index f7b15f64a5e81187649ed032501c688d13244766..b3901c88736c238fdf77bd96d26b27c5c5302180 100644 (file)
         "ban_duration" "2h"; //only if the channel is registered with chanserv
         "gline_duration" "1h";
         "punishment_reason" "Your message contained a forbidden word.";
+        "alert_chan" "#opers";
     };
        
        "hostserv" {