X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Firssi%2Fsrc%2Ffe-common%2Fcore%2Ffe-ignore.c;h=d2f48f20d0e520e6dcc931bd58f2246cd02dec16;hb=63ca577177f9f5db8e553372a9793b0c85f10715;hp=4621ab2628ece9ede9a6a2e85e560434238eb403;hpb=60c165f23f8d5553bd8b4fd43366fbf5f24c2832;p=silc.git diff --git a/apps/irssi/src/fe-common/core/fe-ignore.c b/apps/irssi/src/fe-common/core/fe-ignore.c index 4621ab26..d2f48f20 100644 --- a/apps/irssi/src/fe-common/core/fe-ignore.c +++ b/apps/irssi/src/fe-common/core/fe-ignore.c @@ -63,6 +63,8 @@ static void ignore_print(int index, IGNORE_REC *rec) } if (rec->fullword) g_string_append(options, "-full "); if (rec->replies) g_string_append(options, "-replies "); + if (rec->servertag != NULL) + g_string_sprintfa(options, "-network %s ", rec->servertag); if (rec->pattern != NULL) g_string_sprintfa(options, "-pattern %s ", rec->pattern); @@ -105,17 +107,18 @@ static void cmd_ignore_show(void) } /* SYNTAX: IGNORE [-regexp | -full] [-pattern ] [-except] [-replies] - [-channels ] [-time ] [] + [-network ] [-channels ] [-time ] [] IGNORE [-regexp | -full] [-pattern ] [-except] [-replies] - [-time ] [] */ + [-network ] [-time ] [] */ +/* NOTE: -network replaces the old -ircnet flag. */ static void cmd_ignore(const char *data) { GHashTable *optlist; IGNORE_REC *rec; - char *patternarg, *chanarg, *mask, *levels, *timestr; + char *patternarg, *chanarg, *mask, *levels, *timestr, *servertag; char **channels; void *free_arg; - int new_ignore; + int new_ignore, msecs; if (*data == '\0') { cmd_ignore_show(); @@ -128,10 +131,21 @@ static void cmd_ignore(const char *data) patternarg = g_hash_table_lookup(optlist, "pattern"); chanarg = g_hash_table_lookup(optlist, "channels"); - + servertag = g_hash_table_lookup(optlist, "network"); + /* Allow -ircnet for backwards compatibility */ + if (!servertag) + servertag = g_hash_table_lookup(optlist, "ircnet"); + 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_param_error(CMDERR_INVALID_TIME); + } + if (active_win->active_server != NULL && server_ischannel(active_win->active_server, mask)) { chanarg = mask; @@ -166,16 +180,16 @@ static void cmd_ignore(const char *data) cmd_params_free(free_arg); return; } - + rec->servertag = (servertag == NULL || *servertag == '\0') ? + NULL : g_strdup(servertag); rec->pattern = (patternarg == NULL || *patternarg == '\0') ? NULL : g_strdup(patternarg); rec->exception = g_hash_table_lookup(optlist, "except") != NULL; 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); @@ -197,7 +211,7 @@ static void cmd_unignore(const char *data) return; if (*mask == '\0') - cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS); + cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); if (is_numeric(mask, ' ')) { /* with index number */ @@ -248,7 +262,7 @@ void fe_ignore_init(void) signal_add("ignore created", (SIGNAL_FUNC) sig_ignore_created); signal_add("ignore changed", (SIGNAL_FUNC) sig_ignore_created); - command_set_options("ignore", "regexp full except replies -time -pattern -channels"); + command_set_options("ignore", "regexp full except replies -network -ircnet -time -pattern -channels"); } void fe_ignore_deinit(void)