summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irc/core/servers-redirect.c11
-rw-r--r--src/irc/core/servers-redirect.h7
-rw-r--r--src/irc/proxy/listen.c16
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 */