mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Merge pull request #1283 from ailin-nemui/freenode
fail redirects on EFNet/freenode 263
This commit is contained in:
commit
9362c59cd2
@ -39,6 +39,7 @@ typedef struct {
|
||||
|
||||
int remote;
|
||||
int timeout;
|
||||
int pos;
|
||||
GSList *start, *stop, *opt; /* char *event, int argpos, ... */
|
||||
} REDIRECT_CMD_REC;
|
||||
|
||||
@ -151,13 +152,11 @@ void server_redirect_register(const char *command,
|
||||
|
||||
va_end(va);
|
||||
|
||||
server_redirect_register_list(command, remote, timeout,
|
||||
start, stop, opt);
|
||||
server_redirect_register_list(command, remote, timeout, start, stop, opt, 0);
|
||||
}
|
||||
|
||||
void server_redirect_register_list(const char *command,
|
||||
int remote, int timeout,
|
||||
GSList *start, GSList *stop, GSList *opt)
|
||||
void server_redirect_register_list(const char *command, int remote, int timeout, GSList *start,
|
||||
GSList *stop, GSList *opt, int pos)
|
||||
{
|
||||
REDIRECT_CMD_REC *rec;
|
||||
gpointer key, value;
|
||||
@ -181,7 +180,8 @@ void server_redirect_register_list(const char *command,
|
||||
rec->start = start;
|
||||
rec->stop = stop;
|
||||
rec->opt = opt;
|
||||
g_hash_table_insert(command_redirects, rec->name, rec);
|
||||
rec->pos = pos;
|
||||
g_hash_table_insert(command_redirects, rec->name, rec);
|
||||
}
|
||||
|
||||
void server_redirect_event(IRC_SERVER_REC *server, const char *command,
|
||||
@ -483,6 +483,32 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event,
|
||||
}
|
||||
}
|
||||
|
||||
if (g_strcmp0("event 263", event) == 0) { /* RPL_TRYAGAIN */
|
||||
char *params, *command;
|
||||
params = event_get_params(args, 3, NULL, &command, NULL);
|
||||
|
||||
for (tmp = server->redirects; tmp != NULL; tmp = next) {
|
||||
REDIRECT_REC *rec = tmp->data;
|
||||
|
||||
next = tmp->next;
|
||||
|
||||
if (rec == redirect)
|
||||
break;
|
||||
|
||||
if (g_slist_find(server->redirect_active, rec) != NULL)
|
||||
continue;
|
||||
|
||||
if (redirect_args_match(rec->cmd->name, command, rec->cmd->pos)) {
|
||||
/* the server crashed our command with RPL_TRYAGAIN, send the
|
||||
failure */
|
||||
rec->aborted = TRUE;
|
||||
redirect_abort(server, rec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
/* remove the destroyed, non-remote and timeouted remote
|
||||
redirections that should have happened before this redirection */
|
||||
now = time(NULL);
|
||||
|
@ -22,9 +22,8 @@ void server_redirect_register(const char *command,
|
||||
int remote, int timeout, ...);
|
||||
/* start/stop/opt lists shouldn't be free'd after, and their strings
|
||||
should be dynamically allocated */
|
||||
void server_redirect_register_list(const char *command,
|
||||
int remote, int timeout,
|
||||
GSList *start, GSList *stop, GSList *opt);
|
||||
void server_redirect_register_list(const char *command, int remote, int timeout, GSList *start,
|
||||
GSList *stop, GSList *opt, int pos);
|
||||
|
||||
/* Specify that the next command sent to server will be redirected.
|
||||
NOTE: This command MUST be called before irc_send_cmd().
|
||||
|
@ -97,10 +97,9 @@ server_redirect_register(command, remote, timeout, start, stop, opt)
|
||||
SV *stop
|
||||
SV *opt
|
||||
CODE:
|
||||
server_redirect_register_list(command, remote, timeout,
|
||||
register_hash2list(hvref(start)),
|
||||
register_hash2list(hvref(stop)),
|
||||
register_hash2list(hvref(opt)));
|
||||
server_redirect_register_list(command, remote, timeout, register_hash2list(hvref(start)),
|
||||
register_hash2list(hvref(stop)),
|
||||
register_hash2list(hvref(opt)), 1);
|
||||
|
||||
void
|
||||
server_redirect_event(server, command, count, arg, remote, failure_signal, signals)
|
||||
|
Loading…
Reference in New Issue
Block a user