mirror of
https://github.com/irssi/irssi.git
synced 2026-08-22 10:02:22 +02:00
Introduce send_data_func for interception my modules.
This is for the RobustIRC module we talked about in #231, which now lives at https://github.com/robustirc/irssi-robustirc
This commit is contained in:
parent
9ffe52ec5e
commit
3c1fcf1ad1
3 changed files with 11 additions and 4 deletions
|
|
@ -71,5 +71,6 @@ QUERY_REC *(*query_find_func)(SERVER_REC *server, const char *nick);
|
|||
int (*mask_match_func)(const char *mask, const char *data);
|
||||
/* returns true if `msg' was meant for `nick' */
|
||||
int (*nick_match_msg)(const char *nick, const char *msg);
|
||||
void (*send_data_func)(SERVER_REC *server, const char *data, int len);
|
||||
|
||||
#undef STRUCT_SERVER_CONNECT_REC
|
||||
|
|
|
|||
|
|
@ -484,6 +484,11 @@ void irc_server_send_away(IRC_SERVER_REC *server, const char *reason)
|
|||
|
||||
void irc_server_send_data(IRC_SERVER_REC *server, const char *data, int len)
|
||||
{
|
||||
if (server->send_data_func != NULL) {
|
||||
server->send_data_func(server, data, len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (net_sendbuffer_send(server->handle, data, len) == -1) {
|
||||
/* something bad happened */
|
||||
server->connection_lost = TRUE;
|
||||
|
|
|
|||
|
|
@ -398,10 +398,11 @@ static void irc_init_server(IRC_SERVER_REC *server)
|
|||
if (!IS_IRC_SERVER(server))
|
||||
return;
|
||||
|
||||
server->readtag =
|
||||
g_input_add(net_sendbuffer_handle(server->handle),
|
||||
G_INPUT_READ,
|
||||
(GInputFunction) irc_parse_incoming, server);
|
||||
if (server->handle)
|
||||
server->readtag =
|
||||
g_input_add(net_sendbuffer_handle(server->handle),
|
||||
G_INPUT_READ,
|
||||
(GInputFunction) irc_parse_incoming, server);
|
||||
}
|
||||
|
||||
void irc_irc_init(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue