From: pk910 Date: Fri, 22 Jul 2011 00:47:29 +0000 (+0200) Subject: fixed some syntax errors & tidied up code a little bit X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=bff6cf147150876f31e25b51c8659324bbc0a1d2 fixed some syntax errors & tidied up code a little bit --- diff --git a/src/mod-watchdog.c b/src/mod-watchdog.c index c114366..e62bcd0 100644 --- a/src/mod-watchdog.c +++ b/src/mod-watchdog.c @@ -37,6 +37,7 @@ #include "modcmd.h" #include "saxdb.h" #include "timeq.h" +#include "gline.h" #define KEY_BADWORDS "badwords" #define KEY_BADWORD_MASK "mask" @@ -341,6 +342,7 @@ watchdog_detected_badword(struct userNode *user, struct chanNode *chan, struct b { 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); @@ -349,6 +351,7 @@ watchdog_detected_badword(struct userNode *user, struct chanNode *chan, struct b //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; @@ -363,14 +366,13 @@ watchdog_detected_badword(struct userNode *user, struct chanNode *chan, struct b 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 @@ -508,7 +510,7 @@ watchdog_saxdb_read_chanlist(const char *name, void *data, UNUSED_ARG(void *extr 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); @@ -536,7 +538,6 @@ watchdog_saxdb_read(struct dict *db) 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);