summaryrefslogtreecommitdiff
path: root/src/irc/flood
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-03-03 23:27:07 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-03-03 23:27:07 +0000
commitc5cccfcdaa3e75c378b14086679e54a781b5b8c6 (patch)
tree3e06e98f93cd86ce555960fee312817cb0a67501 /src/irc/flood
parent6ae8ab57666e7969f8a10ca13edaa7933fe0cb3a (diff)
downloadirssi-c5cccfcdaa3e75c378b14086679e54a781b5b8c6.zip
fe-common/irc/flood removed. Some autoignore / ignore -time updates.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1330 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/flood')
-rw-r--r--src/irc/flood/Makefile.am2
-rw-r--r--src/irc/flood/autoignore.c29
-rw-r--r--src/irc/flood/flood.c4
3 files changed, 15 insertions, 20 deletions
diff --git a/src/irc/flood/Makefile.am b/src/irc/flood/Makefile.am
index fc80df47..1424380d 100644
--- a/src/irc/flood/Makefile.am
+++ b/src/irc/flood/Makefile.am
@@ -11,6 +11,4 @@ libirc_flood_la_SOURCES = \
flood.c
noinst_HEADERS = \
- autoignore.h \
- flood.h \
module.h
diff --git a/src/irc/flood/autoignore.c b/src/irc/flood/autoignore.c
index 470eacb4..7d409b6c 100644
--- a/src/irc/flood/autoignore.c
+++ b/src/irc/flood/autoignore.c
@@ -1,7 +1,7 @@
/*
autoignore.c : irssi
- Copyright (C) 1999-2000 Timo Sirainen
+ Copyright (C) 1999-2001 Timo Sirainen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,12 +29,10 @@
#include "irc-servers.h"
#include "ignore.h"
-#include "autoignore.h"
-
void autoignore_update(IGNORE_REC *rec, int level)
{
rec->level |= level;
- rec->time = settings_get_int("autoignore_time");
+ rec->unignore_time = time(NULL)+settings_get_int("autoignore_time");
ignore_update_rec(rec);
}
@@ -44,38 +42,35 @@ void autoignore_add(IRC_SERVER_REC *server, char *mask, int level)
IGNORE_REC *rec;
rec = g_new0(IGNORE_REC, 1);
-
- rec->mask = mask;
+
+ rec->mask = g_strdup(mask);
rec->servertag = g_strdup(server->tag);
rec->level = level;
- rec->time = settings_get_int("autoignore_time");
- rec->autoignore = 1;
-
+ rec->unignore_time = time(NULL)+settings_get_int("autoignore_time");
+
ignore_add_rec(rec);
}
static void sig_flood(IRC_SERVER_REC *server, const char *nick, const char *host, gpointer levelp)
{
- int level, check_level;
- GString *mask;
IGNORE_REC *rec;
+ char *mask;
+ int level, check_level;
g_return_if_fail(IS_IRC_SERVER(server));
level = GPOINTER_TO_INT(levelp);
check_level = level2bits(settings_get_str("autoignore_level"));
- mask = g_string_new(nick);
- mask = g_string_append_c(mask, '!');
- mask = g_string_append(mask, host);
+ mask = g_strdup_printf("%s!%s", nick, host);
if (level & check_level) {
- rec = ignore_find(server->tag, mask->str, NULL);
+ rec = ignore_find(server->tag, mask, NULL);
if (rec == NULL)
- autoignore_add(server, mask->str, level);
+ autoignore_add(server, mask, level);
else
autoignore_update(rec, level);
}
- g_string_free(mask, TRUE);
+ g_free(mask);
}
void autoignore_init(void)
diff --git a/src/irc/flood/flood.c b/src/irc/flood/flood.c
index a1d4dd91..c3c47507 100644
--- a/src/irc/flood/flood.c
+++ b/src/irc/flood/flood.c
@@ -27,9 +27,11 @@
#include "irc.h"
#include "irc-servers.h"
-#include "autoignore.h"
#include "ignore.h"
+void autoignore_init(void);
+void autoignore_deinit(void);
+
typedef struct {
char *target;
int level;