diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-18 15:07:03 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-18 15:07:03 +0000 |
commit | 034e75ee196393338adf26936f7c3c80ad6d6fac (patch) | |
tree | 12ab4dcadc9e3899b595623a594c44a78c988080 | |
parent | a1197a5c082e9d5a7695f225179e23fb17961dac (diff) | |
download | irssi-034e75ee196393338adf26936f7c3c80ad6d6fac.zip |
Stop the redirection if we receive unknown event and it's not numeric.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2052 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/irc/core/servers-redirect.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 39c5650e..229e4f99 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -45,12 +45,14 @@ typedef struct { struct _REDIRECT_REC { REDIRECT_CMD_REC *cmd; time_t created; - int failures; - int destroyed; + int failures; + + unsigned int destroyed:1; + unsigned int aborted:1; + unsigned int remote:1; char *arg; int count; - int remote; char *failure_signal, *default_signal; GSList *signals; /* event, signal, ... */ }; @@ -388,7 +390,7 @@ static void redirect_abort(IRC_SERVER_REC *server, REDIRECT_REC *rec) server->redirects = g_slist_remove(server->redirects, rec); - if (!rec->destroyed) { + if (rec->aborted || !rec->destroyed) { /* emit the failure signal */ str = g_strdup_printf(rec->failure_signal != NULL ? "FAILED %s: %s" : "FAILED %s", @@ -435,7 +437,8 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event, if (rec->destroyed || (rec->remote && (now-rec->created) > rec->cmd->timeout) || (!rec->remote && redirect != NULL)) { - if (rec->remote || ++rec->failures >= MAX_FAILURE_COUNT) + if (rec->aborted || rec->remote || + ++rec->failures >= MAX_FAILURE_COUNT) redirect_abort(server, rec); } } @@ -465,13 +468,16 @@ server_redirect_get(IRC_SERVER_REC *server, const char *event, *redirect = server->redirect_continue; signal = redirect_match(*redirect, event, NULL, match_stop); if (signal == NULL) { - /* unknown event - redirect to the default signal. - FIXME: if stop event isn't properly got, this - could break everything. Add some checks that if - we get eg. 10 different unknown events after this, - or if one of them matches to another redirection, - abort this. */ - signal = (*redirect)->default_signal; + /* unknown event - redirect to the default signal. */ + if (strncmp(event, "event ", 6) == 0 && + isdigit(event[6])) { + signal = (*redirect)->default_signal; + } else { + /* not a numeric, so we've lost the + stop event.. */ + (*redirect)->destroyed = TRUE; + (*redirect)->aborted = TRUE; + } } } |