mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
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
This commit is contained in:
parent
a1197a5c08
commit
034e75ee19
@ -46,11 +46,13 @@ struct _REDIRECT_REC {
|
|||||||
REDIRECT_CMD_REC *cmd;
|
REDIRECT_CMD_REC *cmd;
|
||||||
time_t created;
|
time_t created;
|
||||||
int failures;
|
int failures;
|
||||||
int destroyed;
|
|
||||||
|
unsigned int destroyed:1;
|
||||||
|
unsigned int aborted:1;
|
||||||
|
unsigned int remote:1;
|
||||||
|
|
||||||
char *arg;
|
char *arg;
|
||||||
int count;
|
int count;
|
||||||
int remote;
|
|
||||||
char *failure_signal, *default_signal;
|
char *failure_signal, *default_signal;
|
||||||
GSList *signals; /* event, signal, ... */
|
GSList *signals; /* event, signal, ... */
|
||||||
};
|
};
|
||||||
@ -388,7 +390,7 @@ static void redirect_abort(IRC_SERVER_REC *server, REDIRECT_REC *rec)
|
|||||||
server->redirects =
|
server->redirects =
|
||||||
g_slist_remove(server->redirects, rec);
|
g_slist_remove(server->redirects, rec);
|
||||||
|
|
||||||
if (!rec->destroyed) {
|
if (rec->aborted || !rec->destroyed) {
|
||||||
/* emit the failure signal */
|
/* emit the failure signal */
|
||||||
str = g_strdup_printf(rec->failure_signal != NULL ?
|
str = g_strdup_printf(rec->failure_signal != NULL ?
|
||||||
"FAILED %s: %s" : "FAILED %s",
|
"FAILED %s: %s" : "FAILED %s",
|
||||||
@ -435,7 +437,8 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event,
|
|||||||
if (rec->destroyed ||
|
if (rec->destroyed ||
|
||||||
(rec->remote && (now-rec->created) > rec->cmd->timeout) ||
|
(rec->remote && (now-rec->created) > rec->cmd->timeout) ||
|
||||||
(!rec->remote && redirect != NULL)) {
|
(!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);
|
redirect_abort(server, rec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -465,13 +468,16 @@ server_redirect_get(IRC_SERVER_REC *server, const char *event,
|
|||||||
*redirect = server->redirect_continue;
|
*redirect = server->redirect_continue;
|
||||||
signal = redirect_match(*redirect, event, NULL, match_stop);
|
signal = redirect_match(*redirect, event, NULL, match_stop);
|
||||||
if (signal == NULL) {
|
if (signal == NULL) {
|
||||||
/* unknown event - redirect to the default signal.
|
/* unknown event - redirect to the default signal. */
|
||||||
FIXME: if stop event isn't properly got, this
|
if (strncmp(event, "event ", 6) == 0 &&
|
||||||
could break everything. Add some checks that if
|
isdigit(event[6])) {
|
||||||
we get eg. 10 different unknown events after this,
|
|
||||||
or if one of them matches to another redirection,
|
|
||||||
abort this. */
|
|
||||||
signal = (*redirect)->default_signal;
|
signal = (*redirect)->default_signal;
|
||||||
|
} else {
|
||||||
|
/* not a numeric, so we've lost the
|
||||||
|
stop event.. */
|
||||||
|
(*redirect)->destroyed = TRUE;
|
||||||
|
(*redirect)->aborted = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user