#define KEY_BADWORD_MASK "mask"
#define KEY_BADWORD_TRIGGERED "count"
#define KEY_BADWORD_ACTION "action"
+#define KEY_BADWOR_ALERT "alert"
#define KEY_CHANNELS "channel"
#define KEY_BADWORDID "badwordid"
{ "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" },
{ NULL, NULL }
};
char *badword_mask;
unsigned int triggered : 29;
unsigned int action : 3;
+ unsigned int alert;
};
struct watchdog_channel {
} else {
reply("WDMSG_BADWORD_SET_INVALID", setting);
}
+ }
+ else if(!strcmp("ALERT",setting)) {
+ if (!strcmp("0",value)) {
+ badword->alert = 0;
+ } else if (!strcmp("1",value)) {
+ badword->alert = 1;
+ } else {
+ reply("WDMSG_BADWORD_SET_INVALID", setting);
+ }
} else {
reply("WDMSG_BADWORD_SETTING_INVALID", setting);
}
count++;
}
tbl.length = count+1;
- tbl.width = 4;
+ tbl.width = 5;
tbl.flags = 0;
tbl.flags = TABLE_NO_FREE;
tbl.contents = malloc(tbl.length * sizeof(tbl.contents[0]));
tbl.contents[0][1] = "Badword";
tbl.contents[0][2] = "Action";
tbl.contents[0][3] = "(Triggered)";
+ tbl.contents[0][4] = "Alert";
if(!count)
{
table_send(cmd->parent->bot, user->nick, 0, NULL, tbl);
tbl.contents[ii][2] = "*undef*";
}
tbl.contents[ii][3] = strtab(bw->triggered);
+ tbl.contents[ii][4] = strtab(bw->alert);
}
table_send(cmd->parent->bot, user->nick, 0, NULL, tbl);
for(ii = 1; ii < tbl.length; ++ii)
char *reason = watchdog_conf.punishment_reason;
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);
+ }
switch(badword->action) {
case BADACTION_BAN:
hostmask = generate_hostmask(user, GENMASK_STRICT_HOST | GENMASK_ANY_IDENT);
}
static struct badword*
-add_badword(const char *badword_mask, unsigned int triggered, unsigned int action, const char *id)
+add_badword(const char *badword_mask, unsigned int triggered, unsigned int action, unsigned int alert, const char *id)
{
struct badword *badword;
badword->badword_mask = strdup(badword_mask);
badword->triggered = triggered;
badword->action = action;
+ badword->alert = alert;
dict_insert(shitlist, badword->id, badword);
return badword;
}
badword = database_get_data(obj, KEY_BADWORD_MASK, RECDB_QSTRING);
triggered = database_get_data(obj, KEY_BADWORD_TRIGGERED, RECDB_QSTRING);
action = database_get_data(obj, KEY_BADWORD_ACTION, RECDB_QSTRING);
+ alert = database_get_data(obj, KEY_BADWOR_ALERT, RECDB_QSTRING);
- add_badword(badword, strtoul(triggered, NULL, 0), strtoul(action, NULL, 0), name);
+ add_badword(badword, strtoul(triggered, NULL, 0), strtoul(action, NULL, 0), strtoul(alert, NULL, 0), name);
}
return 0;
}
saxdb_write_string(ctx, KEY_BADWORD_MASK, badword->badword_mask);
saxdb_write_int(ctx, KEY_BADWORD_TRIGGERED, badword->triggered);
saxdb_write_int(ctx, KEY_BADWORD_ACTION, badword->action);
+ saxdb_write_int(ctx, KEY_BADWOR_ALERT, badword->alert);
saxdb_end_record(ctx);
}