diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-15 16:29:25 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-15 16:29:25 +0000 |
commit | 0b4db7b17acc53913f10ceabced2c21c1d96f5e7 (patch) | |
tree | adbf50e6453aa0c73cf29fcbebb8b527c2d84341 /src | |
parent | a110b05a0c7f2b194c05ac20fef0d54f80a40d69 (diff) | |
download | irssi-0b4db7b17acc53913f10ceabced2c21c1d96f5e7.zip |
print failed redirections to rawlog even if there's no failure signal.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2019 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/core/servers-redirect.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 0f9096ba..9acba866 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -356,6 +356,27 @@ static const char *redirect_match(REDIRECT_REC *redirect, const char *event, return signal != NULL ? signal : redirect->default_signal; } +static void redirect_abort(IRC_SERVER_REC *server, REDIRECT_REC *rec) +{ + char *str; + + server->redirects = + g_slist_remove(server->redirects, rec); + + if (!rec->destroyed) { + /* emit the failure signal */ + str = g_strdup_printf(rec->failure_signal != NULL ? + "FAILED %s: %s" : "FAILED %s", + rec->cmd->name, rec->failure_signal); + rawlog_redirect(server->rawlog, str); + g_free(str); + + if (rec->failure_signal != NULL) + signal_emit(rec->failure_signal, 1, server); + } + server_redirect_destroy(rec); +} + static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event, const char *args, const char **signal, int *match_stop) @@ -363,7 +384,6 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event, REDIRECT_REC *redirect; GSList *tmp, *next; time_t now; - char *str; /* find the redirection */ *signal = NULL; redirect = NULL; @@ -391,20 +411,8 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event, next = tmp->next; if (rec->destroyed || (rec->remote && (now-rec->created) > rec->cmd->timeout) || - (!rec->remote && redirect != NULL)) { - server->redirects = - g_slist_remove(server->redirects, rec); - if (!rec->destroyed && rec->failure_signal != NULL) { - /* emit the failure signal */ - str = g_strdup_printf("FAILED %s: %s", - rec->cmd->name, - rec->failure_signal); - rawlog_redirect(server->rawlog, str); - g_free(str); - signal_emit(rec->failure_signal, 1, server); - } - server_redirect_destroy(rec); - } + (!rec->remote && redirect != NULL)) + redirect_abort(server, rec); } return redirect; |