#include "modcmd.h"
#include "saxdb.h"
#include "timeq.h"
+#include "gline.h"
#define KEY_BADWORDS "badwords"
#define KEY_BADWORD_MASK "mask"
{
char *hostmask;
char *reason = watchdog_conf.punishment_reason;
+ char mask[IRC_NTOP_MAX_SIZE+3] = { '*', '@', '\0' };
switch(badword->action) {
case BADACTION_BAN:
hostmask = generate_hostmask(user, GENMASK_STRICT_HOST | GENMASK_ANY_IDENT);
//registered channel
add_channel_ban(chan->channel_info, hostmask, watchdog->nick, now, now, now + watchdog_conf.ban_duration, reason);
}
+ struct mod_chanmode change;
mod_chanmode_init(&change);
change.argc = 1;
change.args[0].mode = MODE_BAN;
DelUser(user, watchdog, 1, reason);
break;
case BADACTION_GLINE:
- int size = strlen(user->hostname) + 3;
- hostmask = alloca(size);
- snprintf(hostmask, size, "*@%s", user->hostname);
- gline_add(watchdog->nick, hostmask, watchdog_conf.gline_duration, reason, now, now, 0, 1);
+ irc_ntop(mask + 2, sizeof(mask) - 2, &user->ip);
+ gline_add(watchdog->nick, mask, watchdog_conf.gline_duration, reason, now, now, 0, 1);
break;
default:
//error?
- }
+ break;
+ }
}
static void
struct record_data *rd = data;
if (rd->type == RECDB_OBJECT) {
- dict_t obj = GET_RECORD_OBJECT(rd);
+ //dict_t obj = GET_RECORD_OBJECT(rd);
/* nothing in here, yet */
add_channel(name);
static int
watchdog_saxdb_write(struct saxdb_context *ctx)
{
- char str[10];
dict_iterator_t it;
saxdb_write_int(ctx, KEY_BADWORDID, last_badword_id);