summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-14 23:23:00 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-14 23:23:00 +0000
commit3101437f75f7175bebadf041b59f18636ddd559b (patch)
treeaa20ac1911b93b48148d8b6ab0239e07ce99da8b /src
parentc0bf62ba44b3dd189768f459be93c7747fe1c118 (diff)
downloadirssi-3101437f75f7175bebadf041b59f18636ddd559b.zip
Report failed redirections in rawlog.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2008 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/irc/core/servers-redirect.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c
index a00651d6..0f9096ba 100644
--- a/src/irc/core/servers-redirect.c
+++ b/src/irc/core/servers-redirect.c
@@ -21,6 +21,7 @@
#include "module.h"
#include "signals.h"
#include "misc.h"
+#include "rawlog.h"
#include "irc-servers.h"
#include "servers-redirect.h"
@@ -28,6 +29,7 @@
#define DEFAULT_REDIRECT_TIMEOUT 60
typedef struct {
+ char *name;
int refcount;
int remote;
@@ -77,7 +79,8 @@ static void redirect_cmd_destroy(REDIRECT_CMD_REC *rec)
g_free(tmp->data);
g_slist_free(rec->start);
g_slist_free(rec->stop);
- g_free(rec);
+ g_free(rec->name);
+ g_free(rec);
}
static void redirect_cmd_ref(REDIRECT_CMD_REC *rec)
@@ -148,16 +151,16 @@ void server_redirect_register_list(const char *command,
the old one */
g_hash_table_remove(command_redirects, command);
redirect_cmd_unref(value);
- g_free(key);
}
rec = g_new0(REDIRECT_CMD_REC, 1);
redirect_cmd_ref(rec);
+ rec->name = g_strdup(command);
rec->remote = remote;
rec->timeout = timeout > 0 ? timeout : DEFAULT_REDIRECT_TIMEOUT;
rec->start = start;
rec->stop = stop;
- g_hash_table_insert(command_redirects, g_strdup(command), rec);
+ g_hash_table_insert(command_redirects, rec->name, rec);
}
void server_redirect_event(IRC_SERVER_REC *server, const char *command,
@@ -360,6 +363,7 @@ 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;
@@ -392,6 +396,11 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event,
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);
@@ -487,7 +496,6 @@ static void sig_disconnected(IRC_SERVER_REC *server)
static void cmd_redirect_destroy(char *key, REDIRECT_CMD_REC *cmd)
{
- g_free(key);
redirect_cmd_unref(cmd);
}