summaryrefslogtreecommitdiff
path: root/src/irc/flood
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-12-28 17:54:13 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-12-28 17:54:13 +0000
commitbd6fe052bce57849a7a850c0c5bee0ad896b9460 (patch)
tree95f3cb743874913a6dc1ff1314264b88989a4b60 /src/irc/flood
parent9c18cb00e7d096e46f5853f802724da4c59c2857 (diff)
downloadirssi-bd6fe052bce57849a7a850c0c5bee0ad896b9460.zip
Added time, size and level setting types. Breaks some settings - I'll add
automatic converter to these settings later. Meanwhile you CVS users can fix your config files yourself :) Time settings allow using "days", "hours", "minutes", "seconds" and "milliseconds" or several of their abbreviations. For example "5d 4h 5msecs". Size settings allow using "gbytes", "mbytes", "kbytes" and "bytes" or their abbrevations. For example "5MB". Level settings are currently handled pretty much the way they were before. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3080 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/flood')
-rw-r--r--src/irc/flood/autoignore.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/irc/flood/autoignore.c b/src/irc/flood/autoignore.c
index 7d409b6c..f029a39f 100644
--- a/src/irc/flood/autoignore.c
+++ b/src/irc/flood/autoignore.c
@@ -32,7 +32,8 @@
void autoignore_update(IGNORE_REC *rec, int level)
{
rec->level |= level;
- rec->unignore_time = time(NULL)+settings_get_int("autoignore_time");
+ rec->unignore_time = time(NULL) +
+ settings_get_time("autoignore_time")/1000;
ignore_update_rec(rec);
}
@@ -46,7 +47,8 @@ void autoignore_add(IRC_SERVER_REC *server, char *mask, int level)
rec->mask = g_strdup(mask);
rec->servertag = g_strdup(server->tag);
rec->level = level;
- rec->unignore_time = time(NULL)+settings_get_int("autoignore_time");
+ rec->unignore_time = time(NULL) +
+ settings_get_time("autoignore_time")/1000;
ignore_add_rec(rec);
}
@@ -60,7 +62,7 @@ static void sig_flood(IRC_SERVER_REC *server, const char *nick, const char *host
g_return_if_fail(IS_IRC_SERVER(server));
level = GPOINTER_TO_INT(levelp);
- check_level = level2bits(settings_get_str("autoignore_level"));
+ check_level = settings_get_level("autoignore_level");
mask = g_strdup_printf("%s!%s", nick, host);
if (level & check_level) {
@@ -75,8 +77,8 @@ static void sig_flood(IRC_SERVER_REC *server, const char *nick, const char *host
void autoignore_init(void)
{
- settings_add_int("flood", "autoignore_time", 300);
- settings_add_str("flood", "autoignore_level", "");
+ settings_add_time("flood", "autoignore_time", "5min");
+ settings_add_level("flood", "autoignore_level", "");
signal_add("flood", (SIGNAL_FUNC) sig_flood);
}