1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Timo Sirainen 2001-12-07 23:41:45 +00:00 committed by cras
parent 54a933f29c
commit ec79871a7a
3 changed files with 22 additions and 12 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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 */