summaryrefslogtreecommitdiff
path: root/src/fe-common/core/fe-ignore.c
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/fe-common/core/fe-ignore.c
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/fe-common/core/fe-ignore.c')
-rw-r--r--src/fe-common/core/fe-ignore.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c
index 4621ab26..83bc1584 100644
--- a/src/fe-common/core/fe-ignore.c
+++ b/src/fe-common/core/fe-ignore.c
@@ -115,7 +115,7 @@ static void cmd_ignore(const char *data)
char *patternarg, *chanarg, *mask, *levels, *timestr;
char **channels;
void *free_arg;
- int new_ignore;
+ int new_ignore, msecs;
if (*data == '\0') {
cmd_ignore_show();
@@ -132,6 +132,13 @@ static void cmd_ignore(const char *data)
if (*mask == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*levels == '\0') levels = "ALL";
+ msecs = 0;
+ timestr = g_hash_table_lookup(optlist, "time");
+ if (timestr != NULL) {
+ if (!parse_time_interval(timestr, &msecs))
+ cmd_return_error(CMDERR_INVALID_TIME);
+ }
+
if (active_win->active_server != NULL &&
server_ischannel(active_win->active_server, mask)) {
chanarg = mask;
@@ -173,9 +180,8 @@ static void cmd_ignore(const char *data)
rec->regexp = g_hash_table_lookup(optlist, "regexp") != NULL;
rec->fullword = g_hash_table_lookup(optlist, "full") != NULL;
rec->replies = g_hash_table_lookup(optlist, "replies") != NULL;
- timestr = g_hash_table_lookup(optlist, "time");
- if (timestr != NULL)
- rec->unignore_time = time(NULL)+atoi(timestr);
+ if (msecs != 0)
+ rec->unignore_time = time(NULL)+msecs/1000;
if (new_ignore)
ignore_add_rec(rec);