diff options
author | Timo Sirainen <cras@irssi.org> | 2001-12-07 23:41:45 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-12-07 23:41:45 +0000 |
commit | ec79871a7acbc71dc6be274a96ccfea79b2d1673 (patch) | |
tree | 78b97d8a07e9dd26d4c991773d387dd6d6ec3159 /src/irc | |
parent | 54a933f29c15abb2d0681d4bc490f4cdf7af0f2d (diff) | |
download | irssi-ec79871a7acbc71dc6be274a96ccfea79b2d1673.zip |
server_redirect_peek_signal() now contains int *redirected parameter which
indicates if event belongs to redirection even while it didn't have any
redirection signal. Proxy uses this to figure out if the event should be
sent to clients or not (/WHOIS in proxy sent 3 middle lines to all clients
before this).
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2221 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/core/servers-redirect.c | 11 | ||||
-rw-r--r-- | src/irc/core/servers-redirect.h | 7 | ||||
-rw-r--r-- | src/irc/proxy/listen.c | 16 |
3 files changed, 22 insertions, 12 deletions
diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 6f1ec454..b4e6b433 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -507,6 +507,7 @@ server_redirect_get(IRC_SERVER_REC *server, const char *event, if (strncmp(event, "event ", 6) == 0 && isdigit(event[6])) { signal = (*redirect)->default_signal; + *match = MATCH_START; } else { /* not a numeric, so we've lost the stop event.. */ @@ -554,12 +555,16 @@ const char *server_redirect_get_signal(IRC_SERVER_REC *server, const char *server_redirect_peek_signal(IRC_SERVER_REC *server, const char *event, - const char *args) + const char *args, + int *redirected) { - REDIRECT_REC *redirect; + REDIRECT_REC *redirect; + const char *signal; int match; - return server_redirect_get(server, event, args, &redirect, &match); + signal = server_redirect_get(server, event, args, &redirect, &match); + *redirected = match != MATCH_NONE; + return signal; } static void sig_disconnected(IRC_SERVER_REC *server) diff --git a/src/irc/core/servers-redirect.h b/src/irc/core/servers-redirect.h index d477fe93..c9be1613 100644 --- a/src/irc/core/servers-redirect.h +++ b/src/irc/core/servers-redirect.h @@ -68,10 +68,13 @@ const char *server_redirect_get_signal(IRC_SERVER_REC *server, const char *args); /* Returns the redirection signal for specified event. Doesn't change the server state in any way, so if you really wish to - use the signal, call server_redirect_get_signal() after this. */ + use the signal, call server_redirect_get_signal() after this. + `redirected' is set to TRUE, if this event belongs to redirection even + while there might be no redirection signal. */ const char *server_redirect_peek_signal(IRC_SERVER_REC *server, const char *event, - const char *args); + const char *args, + int *redirected); /* Destroy redirection record */ void server_redirect_destroy(REDIRECT_REC *rec); diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index c3d5a0b6..fac0cc01 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -309,6 +309,7 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line, void *client; const char *signal; char *event, *args; + int redirected; g_return_if_fail(line != NULL); if (!IS_IRC_SERVER(server)) @@ -321,15 +322,16 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line, while (*args == ' ') args++; g_strdown(event); - signal = server_redirect_peek_signal(server, event, args); - if (signal != NULL) { + signal = server_redirect_peek_signal(server, event, args, &redirected); + if ((signal != NULL && strncmp(signal, "proxy ", 6) != 0) || + (signal == NULL && redirected)) { /* we want to send this to one client (or proxy itself) only */ - if (strncmp(signal, "proxy ", 6) != 0) { - /* proxy only */ - g_free(event); - return; - } + /* proxy only */ + g_free(event); + return; + } + if (signal != NULL) { server_redirect_get_signal(server, event, args); if (sscanf(signal+6, "%p", &client) == 1) { /* send it to specific client only */ |