1
#ifndef __SERVERS_REDIRECT_H
2
#define __SERVERS_REDIRECT_H
4
/* Register new redirection command.
6
remote - Specifies if the command is by default a remote command
7
(eg. sent to another server). server_redirect_event() may override this.
9
timeout - If remote is TRUE, specifies how many seconds to wait for
10
reply before aborting.
12
... - char *start, int argpos, char *start, int argpos, ..., NULL,
13
char *stop, int argpos, char *stop, int argpos, ..., NULL,
14
char *optional, int argpos, ..., NULL
15
List of events that start and stop this redirection.
16
Start event list may be just NULL, but there must be at least one
17
stop event. Optional events are checked only if they are received
18
immediately after one of the stop-events. `argpos' specifies the
19
word number in event string which is compared to wanted argument,
20
-1 = don't compare, TRUE always. */
21
void server_redirect_register(const char *command,
22
int remote, int timeout, ...);
23
/* start/stop/opt lists shouldn't be free'd after, and their strings
24
should be dynamically allocated */
25
void server_redirect_register_list(const char *command,
26
int remote, int timeout,
27
GSList *start, GSList *stop, GSList *opt);
29
/* Specify that the next command sent to server will be redirected.
30
NOTE: This command MUST be called before irc_send_cmd().
32
command - Specifies the registered command that should be used for this
35
count - How many times to execute the redirection. Some commands may send
36
multiple stop events, like MODE #a,#b.
38
arg - The argument to be compared in event strings. You can give multiple
39
arguments separated with space.
41
remote - Specifies if the command is a remote command, -1 = use default.
43
failure_signal - If irssi can't find the stop signal for the redirection,
44
this signal is called.
46
... - char *event, char *redirect_signal, ..., NULL
47
If the `event' is "", all the events belonging to the redirection but not
48
specified here, will be sent there. */
49
void server_redirect_event(IRC_SERVER_REC *server, const char *command,
50
int count, const char *arg, int remote,
51
const char *failure_signal, ...);
52
/* Signals list shouldn't be free'd after, and it's strings should be
53
dynamically allocated */
54
void server_redirect_event_list(IRC_SERVER_REC *server, const char *command,
55
int count, const char *arg, int remote,
56
const char *failure_signal, GSList *signals);
60
/* irc_send_cmd() calls this to make sure redirecting knows
61
what's sent to server */
62
void server_redirect_command(IRC_SERVER_REC *server, const char *command,
63
REDIRECT_REC *redirect);
64
/* Returns the redirection signal for specified event.
65
This is the function that contains the real redirecting logic. */
66
const char *server_redirect_get_signal(IRC_SERVER_REC *server,
69
/* Returns the redirection signal for specified event.
70
Doesn't change the server state in any way, so if you really wish to
71
use the signal, call server_redirect_get_signal() after this.
72
`redirected' is set to TRUE, if this event belongs to redirection even
73
while there might be no redirection signal. */
74
const char *server_redirect_peek_signal(IRC_SERVER_REC *server,
79
/* Destroy redirection record */
80
void server_redirect_destroy(REDIRECT_REC *rec);
82
void servers_redirect_init(void);
83
void servers_redirect_deinit(void);