mirror of
https://github.com/irssi/irssi.git
synced 2026-08-16 15:12:11 +02:00
handle to channel rename
This commit is contained in:
parent
221d520c37
commit
0da7a7c56d
23 changed files with 357 additions and 337 deletions
|
|
@ -323,7 +323,7 @@ static void server_init_1(IRC_SERVER_REC *server)
|
|||
server_init_2(server);
|
||||
}
|
||||
|
||||
static void init_ssl_loop(IRC_SERVER_REC *server, GIOChannel *handle)
|
||||
static void init_ssl_loop_channel(IRC_SERVER_REC *server, GIOChannel *channel)
|
||||
{
|
||||
int error;
|
||||
server->connrec->starttls = 1;
|
||||
|
|
@ -333,7 +333,7 @@ static void init_ssl_loop(IRC_SERVER_REC *server, GIOChannel *handle)
|
|||
server->starttls_tag = 0;
|
||||
}
|
||||
|
||||
error = irssi_ssl_handshake(handle);
|
||||
error = irssi_ssl_handshake_channel(channel);
|
||||
if (error == -1) {
|
||||
server->connection_lost = TRUE;
|
||||
server_disconnect((SERVER_REC *) server);
|
||||
|
|
@ -341,8 +341,8 @@ static void init_ssl_loop(IRC_SERVER_REC *server, GIOChannel *handle)
|
|||
}
|
||||
if (error & 1) { /* wait */
|
||||
server->starttls_tag =
|
||||
i_input_add(handle, error == 1 ? I_INPUT_READ : I_INPUT_WRITE,
|
||||
(GInputFunction) init_ssl_loop, server);
|
||||
i_input_add(channel, error == 1 ? I_INPUT_READ : I_INPUT_WRITE,
|
||||
(GInputFunction) init_ssl_loop_channel, server);
|
||||
return;
|
||||
}
|
||||
/* continue */
|
||||
|
|
@ -375,7 +375,7 @@ void irc_server_send_starttls(IRC_SERVER_REC *server)
|
|||
|
||||
static void event_starttls(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
GIOChannel *ssl_handle;
|
||||
GIOChannel *ssl_channel;
|
||||
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
|
|
@ -387,12 +387,12 @@ static void event_starttls(IRC_SERVER_REC *server, const char *data)
|
|||
char *str;
|
||||
line_split("", -1, &str, &server->handle->readbuffer);
|
||||
}
|
||||
ssl_handle = net_start_ssl((SERVER_REC *) server);
|
||||
if (ssl_handle != NULL) {
|
||||
ssl_channel = net_start_ssl_channel((SERVER_REC *) server);
|
||||
if (ssl_channel != NULL) {
|
||||
g_source_remove(server->readtag);
|
||||
server->readtag = -1;
|
||||
server->handle->handle = ssl_handle;
|
||||
init_ssl_loop(server, server->handle->handle);
|
||||
server->handle->channel = ssl_channel;
|
||||
init_ssl_loop_channel(server, server->handle->channel);
|
||||
} else {
|
||||
g_warning("net_start_ssl failed");
|
||||
}
|
||||
|
|
@ -485,7 +485,7 @@ void irc_server_connect(SERVER_REC *server)
|
|||
{
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
if (server->connrec->connect_handle != NULL) {
|
||||
if (server->connrec->connect_channel != NULL) {
|
||||
/* an existing handle from upgrade */
|
||||
IRC_SERVER_CONNECT_REC *conn;
|
||||
int tls_disconnect;
|
||||
|
|
@ -495,8 +495,8 @@ void irc_server_connect(SERVER_REC *server)
|
|||
|
||||
if (tls_disconnect) {
|
||||
/* we cannot use it, it is encrypted. force a reconnect */
|
||||
g_io_channel_unref(conn->connect_handle);
|
||||
conn->connect_handle = NULL;
|
||||
g_io_channel_unref(conn->connect_channel);
|
||||
conn->connect_channel = NULL;
|
||||
server->session_reconnect = FALSE;
|
||||
server_connect_ref((SERVER_CONNECT_REC *) conn);
|
||||
server_disconnect(server);
|
||||
|
|
@ -695,23 +695,24 @@ 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 (net_sendbuffer_send(server->handle, data, len) == -1) {
|
||||
/* something bad happened */
|
||||
server->connection_lost = TRUE;
|
||||
return;
|
||||
}
|
||||
if (server->handle != NULL) {
|
||||
if (net_sendbuffer_send(server->handle, data, len) == -1) {
|
||||
/* something bad happened */
|
||||
server->connection_lost = TRUE;
|
||||
return;
|
||||
}
|
||||
server->last_cmd = g_get_real_time();
|
||||
|
||||
server->last_cmd = g_get_real_time();
|
||||
|
||||
/* A bit kludgy way to do the flood protection. In ircnet, there
|
||||
actually is 1sec / 100 bytes penalty, but we rather want to deal
|
||||
with the max. 1000 bytes input buffer problem. If we send more
|
||||
than that with the burst, we'll get excess flooded. */
|
||||
if (len < 100 || server->cmd_queue_speed <= 10)
|
||||
server->wait_cmd = 0;
|
||||
else {
|
||||
server->wait_cmd = server->last_cmd;
|
||||
server->wait_cmd += (2 + len / 100) * G_USEC_PER_SEC;
|
||||
/* A bit kludgy way to do the flood protection. In ircnet, there
|
||||
actually is 1sec / 100 bytes penalty, but we rather want to deal
|
||||
with the max. 1000 bytes input buffer problem. If we send more
|
||||
than that with the burst, we'll get excess flooded. */
|
||||
if (len < 100 || server->cmd_queue_speed <= 10)
|
||||
server->wait_cmd = 0;
|
||||
else {
|
||||
server->wait_cmd = server->last_cmd;
|
||||
server->wait_cmd += (2 + len / 100) * G_USEC_PER_SEC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -579,8 +579,10 @@ static void irc_init_server(IRC_SERVER_REC *server)
|
|||
if (!IS_IRC_SERVER(server))
|
||||
return;
|
||||
|
||||
server->readtag = i_input_add(net_sendbuffer_handle(server->handle), I_INPUT_READ,
|
||||
(GInputFunction) irc_parse_incoming, server);
|
||||
if (server->handle->channel != NULL) {
|
||||
server->readtag = i_input_add(net_sendbuffer_channel(server->handle), I_INPUT_READ,
|
||||
(GInputFunction) irc_parse_incoming, server);
|
||||
}
|
||||
}
|
||||
|
||||
void irc_irc_init(void)
|
||||
|
|
|
|||
|
|
@ -337,29 +337,29 @@ void dcc_chat_input(CHAT_DCC_REC *dcc)
|
|||
static void dcc_chat_listen(CHAT_DCC_REC *dcc)
|
||||
{
|
||||
IPADDR ip;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
int port;
|
||||
|
||||
g_return_if_fail(IS_DCC_CHAT(dcc));
|
||||
|
||||
/* accept connection */
|
||||
handle = net_accept(dcc->handle, &ip, &port);
|
||||
if (handle == NULL)
|
||||
channel = net_accept_channel(dcc->channel, &ip, &port);
|
||||
if (channel == NULL)
|
||||
return;
|
||||
|
||||
/* TODO: add paranoia check - see dcc-files.c */
|
||||
|
||||
net_disconnect(dcc->handle);
|
||||
net_disconnect_channel(dcc->channel);
|
||||
g_source_remove(dcc->tagconn);
|
||||
dcc->tagconn = -1;
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->handle = handle;
|
||||
dcc->sendbuf = net_sendbuffer_create(handle, 0);
|
||||
dcc->channel = channel;
|
||||
dcc->sendbuf = net_sendbuffer_create_channel(channel, 0);
|
||||
memcpy(&dcc->addr, &ip, sizeof(IPADDR));
|
||||
net_ip2host(&dcc->addr, dcc->addrstr);
|
||||
dcc->port = port;
|
||||
dcc->tagread = i_input_add(handle, I_INPUT_READ, (GInputFunction) dcc_chat_input, dcc);
|
||||
dcc->tagread = i_input_add(channel, I_INPUT_READ, (GInputFunction) dcc_chat_input, dcc);
|
||||
|
||||
signal_emit("dcc connected", 1, dcc);
|
||||
}
|
||||
|
|
@ -369,7 +369,7 @@ static void sig_chat_connected(CHAT_DCC_REC *dcc)
|
|||
{
|
||||
g_return_if_fail(IS_DCC_CHAT(dcc));
|
||||
|
||||
if (net_geterror(dcc->handle) != 0) {
|
||||
if (net_geterror_channel(dcc->channel) != 0) {
|
||||
/* error connecting */
|
||||
signal_emit("dcc error connect", 1, dcc);
|
||||
dcc_destroy(DCC(dcc));
|
||||
|
|
@ -381,8 +381,9 @@ static void sig_chat_connected(CHAT_DCC_REC *dcc)
|
|||
dcc->tagconn = -1;
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->sendbuf = net_sendbuffer_create(dcc->handle, 0);
|
||||
dcc->tagread = i_input_add(dcc->handle, I_INPUT_READ, (GInputFunction) dcc_chat_input, dcc);
|
||||
dcc->sendbuf = net_sendbuffer_create_channel(dcc->channel, 0);
|
||||
dcc->tagread =
|
||||
i_input_add(dcc->channel, I_INPUT_READ, (GInputFunction) dcc_chat_input, dcc);
|
||||
|
||||
signal_emit("dcc connected", 1, dcc);
|
||||
}
|
||||
|
|
@ -391,15 +392,14 @@ static void dcc_chat_connect(CHAT_DCC_REC *dcc)
|
|||
{
|
||||
g_return_if_fail(IS_DCC_CHAT(dcc));
|
||||
|
||||
if (dcc->addrstr[0] == '\0' ||
|
||||
dcc->starttime != 0 || dcc->handle != NULL) {
|
||||
if (dcc->addrstr[0] == '\0' || dcc->starttime != 0 || dcc->channel != NULL) {
|
||||
/* already sent a chat request / already chatting */
|
||||
return;
|
||||
}
|
||||
|
||||
dcc->handle = dcc_connect_ip(&dcc->addr, dcc->port);
|
||||
if (dcc->handle != NULL) {
|
||||
dcc->tagconn = i_input_add(dcc->handle, I_INPUT_WRITE | I_INPUT_READ,
|
||||
dcc->channel = dcc_connect_ip_channel(&dcc->addr, dcc->port);
|
||||
if (dcc->channel != NULL) {
|
||||
dcc->tagconn = i_input_add(dcc->channel, I_INPUT_WRITE | I_INPUT_READ,
|
||||
(GInputFunction) sig_chat_connected, dcc);
|
||||
} else {
|
||||
/* error connecting */
|
||||
|
|
@ -412,25 +412,23 @@ static void dcc_chat_passive(CHAT_DCC_REC *dcc)
|
|||
{
|
||||
IPADDR own_ip;
|
||||
int port;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
char host[MAX_IP_LEN];
|
||||
|
||||
g_return_if_fail(IS_DCC_CHAT(dcc));
|
||||
|
||||
if (dcc->addrstr[0] == '\0' ||
|
||||
dcc->starttime != 0 || dcc->handle != NULL) {
|
||||
if (dcc->addrstr[0] == '\0' || dcc->starttime != 0 || dcc->channel != NULL) {
|
||||
/* already sent a chat request / already chatting */
|
||||
return;
|
||||
}
|
||||
|
||||
handle = dcc_listen(net_sendbuffer_handle(dcc->server->handle),
|
||||
&own_ip, &port);
|
||||
if (handle == NULL)
|
||||
channel = dcc_listen_channel(net_sendbuffer_channel(dcc->server->handle), &own_ip, &port);
|
||||
if (channel == NULL)
|
||||
cmd_return_error(CMDERR_ERRNO);
|
||||
|
||||
dcc->handle = handle;
|
||||
dcc->channel = channel;
|
||||
dcc->tagconn =
|
||||
i_input_add(dcc->handle, I_INPUT_READ, (GInputFunction) dcc_chat_listen, dcc);
|
||||
i_input_add(dcc->channel, I_INPUT_READ, (GInputFunction) dcc_chat_listen, dcc);
|
||||
|
||||
/* Let's send the reply to the other client! */
|
||||
dcc_ip2str(&own_ip, host);
|
||||
|
|
@ -445,7 +443,7 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
|
|||
void *free_arg;
|
||||
CHAT_DCC_REC *dcc;
|
||||
IPADDR own_ip;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
GHashTable *optlist;
|
||||
int p_id;
|
||||
char *nick, host[MAX_IP_LEN];
|
||||
|
|
@ -470,7 +468,7 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
|
|||
}
|
||||
|
||||
dcc = dcc_chat_find_id(nick);
|
||||
if (dcc != NULL && dcc_is_waiting_user(dcc)) {
|
||||
if (dcc != NULL && dcc_is_waiting_user_channel(dcc)) {
|
||||
if (!dcc_is_passive(dcc)) {
|
||||
/* found from dcc chat requests,
|
||||
we're the connecting side */
|
||||
|
|
@ -483,8 +481,7 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
|
|||
return;
|
||||
}
|
||||
|
||||
if (dcc != NULL && dcc_is_listening(dcc) &&
|
||||
dcc->server == server) {
|
||||
if (dcc != NULL && dcc_is_listening_channel(dcc) && dcc->server == server) {
|
||||
/* sending request again even while old request is
|
||||
still waiting, remove it. */
|
||||
dcc_destroy(DCC(dcc));
|
||||
|
|
@ -502,14 +499,14 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
|
|||
|
||||
if (g_hash_table_lookup(optlist, "passive") == NULL) {
|
||||
/* Standard DCC CHAT... let's listen for incoming connections */
|
||||
handle = dcc_listen(net_sendbuffer_handle(server->handle),
|
||||
&own_ip, &port);
|
||||
if (handle == NULL)
|
||||
channel =
|
||||
dcc_listen_channel(net_sendbuffer_channel(server->handle), &own_ip, &port);
|
||||
if (channel == NULL)
|
||||
cmd_param_error(CMDERR_ERRNO);
|
||||
|
||||
dcc->handle = handle;
|
||||
dcc->channel = channel;
|
||||
dcc->tagconn =
|
||||
i_input_add(dcc->handle, I_INPUT_READ, (GInputFunction) dcc_chat_listen, dcc);
|
||||
i_input_add(dcc->channel, I_INPUT_READ, (GInputFunction) dcc_chat_listen, dcc);
|
||||
|
||||
/* send the chat request */
|
||||
signal_emit("dcc request send", 1, dcc);
|
||||
|
|
@ -645,7 +642,7 @@ static void ctcp_msg_dcc_chat(IRC_SERVER_REC *server, const char *data,
|
|||
|
||||
dcc = DCC_CHAT(dcc_find_request(DCC_CHAT_TYPE, nick, NULL));
|
||||
if (dcc != NULL) {
|
||||
if (dcc_is_listening(dcc)) {
|
||||
if (dcc_is_listening_channel(dcc)) {
|
||||
/* we requested dcc chat, they requested
|
||||
dcc chat from us .. allow it. */
|
||||
dcc_destroy(DCC(dcc));
|
||||
|
|
|
|||
|
|
@ -102,8 +102,7 @@ void dcc_get_send_received(GET_DCC_REC *dcc)
|
|||
memcpy(dcc->count_buf, &recd, 4);
|
||||
|
||||
dcc->count_pos =
|
||||
net_transmit(dcc->handle, dcc->count_buf+dcc->count_pos,
|
||||
4-dcc->count_pos);
|
||||
net_transmit_channel(dcc->channel, dcc->count_buf + dcc->count_pos, 4 - dcc->count_pos);
|
||||
if (dcc->count_pos == 4) dcc->count_pos = 0;
|
||||
|
||||
/* count_pos might be -1 here. if this happens, the
|
||||
|
|
@ -112,7 +111,7 @@ void dcc_get_send_received(GET_DCC_REC *dcc)
|
|||
never, but I just want to do it right.. :) */
|
||||
if (dcc->tagwrite == -1) {
|
||||
dcc->tagwrite =
|
||||
i_input_add(dcc->handle, I_INPUT_WRITE, (GInputFunction) sig_dccget_send, dcc);
|
||||
i_input_add(dcc->channel, I_INPUT_WRITE, (GInputFunction) sig_dccget_send, dcc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -123,8 +122,8 @@ static void sig_dccget_send(GET_DCC_REC *dcc)
|
|||
int ret;
|
||||
|
||||
if (dcc->count_pos != 0) {
|
||||
ret = net_transmit(dcc->handle, dcc->count_buf+dcc->count_pos,
|
||||
4-dcc->count_pos);
|
||||
ret = net_transmit_channel(dcc->channel, dcc->count_buf + dcc->count_pos,
|
||||
4 - dcc->count_pos);
|
||||
|
||||
if (dcc->count_pos <= 0)
|
||||
dcc->count_pos = ret;
|
||||
|
|
@ -157,8 +156,8 @@ static void sig_dccget_receive(GET_DCC_REC *dcc)
|
|||
}
|
||||
|
||||
for (;;) {
|
||||
ret = net_receive(dcc->handle, dcc_get_recv_buffer,
|
||||
DCC_GET_RECV_BUFFER_SIZE);
|
||||
ret = net_receive_channel(dcc->channel, dcc_get_recv_buffer,
|
||||
DCC_GET_RECV_BUFFER_SIZE);
|
||||
if (ret == 0) break;
|
||||
|
||||
if (ret < 0) {
|
||||
|
|
@ -194,7 +193,7 @@ void sig_dccget_connected(GET_DCC_REC *dcc)
|
|||
int ret, ret_errno, temphandle, old_umask;
|
||||
|
||||
if (!dcc->from_dccserver) {
|
||||
if (net_geterror(dcc->handle) != 0) {
|
||||
if (net_geterror_channel(dcc->channel) != 0) {
|
||||
/* error connecting */
|
||||
signal_emit("dcc error connect", 1, dcc);
|
||||
dcc_destroy(DCC(dcc));
|
||||
|
|
@ -285,13 +284,13 @@ void sig_dccget_connected(GET_DCC_REC *dcc)
|
|||
return;
|
||||
}
|
||||
dcc->tagread =
|
||||
i_input_add(dcc->handle, I_INPUT_READ, (GInputFunction) sig_dccget_receive, dcc);
|
||||
i_input_add(dcc->channel, I_INPUT_READ, (GInputFunction) sig_dccget_receive, dcc);
|
||||
signal_emit("dcc connected", 1, dcc);
|
||||
|
||||
if (dcc->from_dccserver) {
|
||||
str = g_strdup_printf("121 %s %d\n",
|
||||
dcc->server ? dcc->server->nick : "??", 0);
|
||||
net_transmit(dcc->handle, str, strlen(str));
|
||||
net_transmit_channel(dcc->channel, str, strlen(str));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -307,10 +306,10 @@ void dcc_get_connect(GET_DCC_REC *dcc)
|
|||
return;
|
||||
}
|
||||
|
||||
dcc->handle = dcc_connect_ip(&dcc->addr, dcc->port);
|
||||
dcc->channel = dcc_connect_ip_channel(&dcc->addr, dcc->port);
|
||||
|
||||
if (dcc->handle != NULL) {
|
||||
dcc->tagconn = i_input_add(dcc->handle, I_INPUT_WRITE | I_INPUT_READ,
|
||||
if (dcc->channel != NULL) {
|
||||
dcc->tagconn = i_input_add(dcc->channel, I_INPUT_WRITE | I_INPUT_READ,
|
||||
(GInputFunction) sig_dccget_connected, dcc);
|
||||
} else {
|
||||
/* error connecting */
|
||||
|
|
@ -321,43 +320,43 @@ void dcc_get_connect(GET_DCC_REC *dcc)
|
|||
|
||||
static void dcc_get_listen(GET_DCC_REC *dcc)
|
||||
{
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
IPADDR addr;
|
||||
int port;
|
||||
|
||||
/* accept connection */
|
||||
handle = net_accept(dcc->handle, &addr, &port);
|
||||
if (handle == NULL)
|
||||
channel = net_accept_channel(dcc->channel, &addr, &port);
|
||||
if (channel == NULL)
|
||||
return;
|
||||
|
||||
net_disconnect(dcc->handle);
|
||||
net_disconnect_channel(dcc->channel);
|
||||
g_source_remove(dcc->tagconn);
|
||||
dcc->tagconn = -1;
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->handle = handle;
|
||||
dcc->channel = channel;
|
||||
memcpy(&dcc->addr, &addr, sizeof(IPADDR));
|
||||
net_ip2host(&dcc->addr, dcc->addrstr);
|
||||
dcc->port = port;
|
||||
|
||||
dcc->tagconn = i_input_add(handle, I_INPUT_READ | I_INPUT_WRITE,
|
||||
dcc->tagconn = i_input_add(channel, I_INPUT_READ | I_INPUT_WRITE,
|
||||
(GInputFunction) sig_dccget_connected, dcc);
|
||||
}
|
||||
|
||||
void dcc_get_passive(GET_DCC_REC *dcc)
|
||||
{
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
IPADDR own_ip;
|
||||
int port;
|
||||
char host[MAX_IP_LEN];
|
||||
|
||||
handle = dcc_listen(net_sendbuffer_handle(dcc->server->handle),
|
||||
&own_ip, &port);
|
||||
if (handle == NULL)
|
||||
channel = dcc_listen_channel(net_sendbuffer_channel(dcc->server->handle), &own_ip, &port);
|
||||
if (channel == NULL)
|
||||
cmd_return_error(CMDERR_ERRNO);
|
||||
|
||||
dcc->handle = handle;
|
||||
dcc->tagconn = i_input_add(dcc->handle, I_INPUT_READ, (GInputFunction) dcc_get_listen, dcc);
|
||||
dcc->channel = channel;
|
||||
dcc->tagconn =
|
||||
i_input_add(dcc->channel, I_INPUT_READ, (GInputFunction) dcc_get_listen, dcc);
|
||||
|
||||
/* Let's send the reply to the other client! */
|
||||
dcc_ip2str(&own_ip, host);
|
||||
|
|
@ -581,7 +580,7 @@ void cmd_dcc_receive(const char *data, DCC_GET_FUNC accept_func,
|
|||
|
||||
next = tmp->next;
|
||||
if (IS_DCC_GET(dcc) && g_ascii_strcasecmp(dcc->nick, nick) == 0 &&
|
||||
(dcc_is_waiting_user(dcc) || dcc->from_dccserver) &&
|
||||
(dcc_is_waiting_user_channel(dcc) || dcc->from_dccserver) &&
|
||||
(*fname == '\0' || g_strcmp0(dcc->arg, fname) == 0)) {
|
||||
found = TRUE;
|
||||
if (!dcc_is_passive(dcc))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ IPADDR addr; /* address we're connected in */
|
|||
char addrstr[MAX_IP_LEN]; /* in readable form */
|
||||
int port; /* port we're connected in */
|
||||
|
||||
GIOChannel *handle; /* socket handle */
|
||||
GIOChannel *channel; /* socket handle */
|
||||
int tagconn, tagread, tagwrite;
|
||||
time_t starttime; /* transfer start time */
|
||||
uoff_t transfd; /* bytes transferred */
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ static void dcc_send_data(SEND_DCC_REC *dcc)
|
|||
return;
|
||||
}
|
||||
|
||||
ret = net_transmit(dcc->handle, buffer, ret);
|
||||
ret = net_transmit_channel(dcc->channel, buffer, ret);
|
||||
if (ret > 0) dcc->transfd += ret;
|
||||
dcc->gotalldata = FALSE;
|
||||
|
||||
|
|
@ -287,8 +287,8 @@ static void dcc_send_read_size(SEND_DCC_REC *dcc)
|
|||
guint32 bytes;
|
||||
int ret;
|
||||
|
||||
ret = net_receive(dcc->handle, dcc->count_buf+dcc->count_pos,
|
||||
4-dcc->count_pos);
|
||||
ret =
|
||||
net_receive_channel(dcc->channel, dcc->count_buf + dcc->count_pos, 4 - dcc->count_pos);
|
||||
if (ret == -1) {
|
||||
dcc_close(DCC(dcc));
|
||||
return;
|
||||
|
|
@ -313,31 +313,31 @@ static void dcc_send_read_size(SEND_DCC_REC *dcc)
|
|||
/* input function: DCC SEND - someone tried to connect to our socket */
|
||||
static void dcc_send_connected(SEND_DCC_REC *dcc)
|
||||
{
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
IPADDR addr;
|
||||
int port;
|
||||
|
||||
/* accept connection */
|
||||
handle = net_accept(dcc->handle, &addr, &port);
|
||||
if (handle == NULL)
|
||||
channel = net_accept_channel(dcc->channel, &addr, &port);
|
||||
if (channel == NULL)
|
||||
return;
|
||||
|
||||
/* TODO: some kind of paranoia check would be nice. it would check
|
||||
that the host of the nick who we sent the request matches the
|
||||
address who connected us. */
|
||||
|
||||
net_disconnect(dcc->handle);
|
||||
net_disconnect_channel(dcc->channel);
|
||||
g_source_remove(dcc->tagconn);
|
||||
dcc->tagconn = -1;
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->handle = handle;
|
||||
dcc->channel = channel;
|
||||
memcpy(&dcc->addr, &addr, sizeof(IPADDR));
|
||||
net_ip2host(&dcc->addr, dcc->addrstr);
|
||||
dcc->port = port;
|
||||
|
||||
dcc->tagread = i_input_add(handle, I_INPUT_READ, (GInputFunction) dcc_send_read_size, dcc);
|
||||
dcc->tagwrite = i_input_add(handle, I_INPUT_WRITE, (GInputFunction) dcc_send_data, dcc);
|
||||
dcc->tagread = i_input_add(channel, I_INPUT_READ, (GInputFunction) dcc_send_read_size, dcc);
|
||||
dcc->tagwrite = i_input_add(channel, I_INPUT_WRITE, (GInputFunction) dcc_send_data, dcc);
|
||||
|
||||
signal_emit("dcc connected", 1, dcc);
|
||||
}
|
||||
|
|
@ -345,15 +345,15 @@ static void dcc_send_connected(SEND_DCC_REC *dcc)
|
|||
/* input function: DCC SEND - connect to the receiver (passive protocol) */
|
||||
static void dcc_send_connect(SEND_DCC_REC *dcc)
|
||||
{
|
||||
dcc->handle = dcc_connect_ip(&dcc->addr, dcc->port);
|
||||
dcc->channel = dcc_connect_ip_channel(&dcc->addr, dcc->port);
|
||||
|
||||
if (dcc->handle != NULL) {
|
||||
if (dcc->channel != NULL) {
|
||||
dcc->starttime = time(NULL);
|
||||
|
||||
dcc->tagread = i_input_add(dcc->handle, I_INPUT_READ,
|
||||
dcc->tagread = i_input_add(dcc->channel, I_INPUT_READ,
|
||||
(GInputFunction) dcc_send_read_size, dcc);
|
||||
dcc->tagwrite =
|
||||
i_input_add(dcc->handle, I_INPUT_WRITE, (GInputFunction) dcc_send_data, dcc);
|
||||
i_input_add(dcc->channel, I_INPUT_WRITE, (GInputFunction) dcc_send_data, dcc);
|
||||
signal_emit("dcc connected", 1, dcc);
|
||||
} else {
|
||||
/* error connecting */
|
||||
|
|
@ -372,7 +372,7 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname,
|
|||
int hfile, port = 0;
|
||||
SEND_DCC_REC *dcc;
|
||||
IPADDR own_ip;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
|
||||
if (dcc_find_request(DCC_SEND_TYPE, target, fname)) {
|
||||
signal_emit("dcc error send exists", 2, target, fname);
|
||||
|
|
@ -398,16 +398,16 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname,
|
|||
/* start listening (only if passive == FALSE )*/
|
||||
|
||||
if (passive == FALSE) {
|
||||
handle = dcc_listen(chat != NULL ? chat->handle :
|
||||
net_sendbuffer_handle(server->handle),
|
||||
&own_ip, &port);
|
||||
if (handle == NULL) {
|
||||
channel = dcc_listen_channel(chat != NULL ? chat->channel :
|
||||
net_sendbuffer_channel(server->handle),
|
||||
&own_ip, &port);
|
||||
if (channel == NULL) {
|
||||
close(hfile);
|
||||
g_warning("dcc_listen() failed: %s", strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
handle = NULL;
|
||||
channel = NULL;
|
||||
}
|
||||
|
||||
str = g_path_get_basename(fname);
|
||||
|
|
@ -425,7 +425,7 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
dcc->handle = handle;
|
||||
dcc->channel = channel;
|
||||
dcc->port = port;
|
||||
dcc->size = st.st_size;
|
||||
dcc->fhandle = hfile;
|
||||
|
|
@ -433,7 +433,7 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname,
|
|||
dcc->file_quoted = strchr(fname, ' ') != NULL;
|
||||
if (!passive) {
|
||||
dcc->tagconn =
|
||||
i_input_add(handle, I_INPUT_READ, (GInputFunction) dcc_send_connected, dcc);
|
||||
i_input_add(channel, I_INPUT_READ, (GInputFunction) dcc_send_connected, dcc);
|
||||
}
|
||||
|
||||
/* Generate an ID for this send if using passive protocol */
|
||||
|
|
|
|||
|
|
@ -49,15 +49,15 @@ static void sig_dcc_destroyed(SERVER_DCC_REC *dcc)
|
|||
}
|
||||
|
||||
/* Start listening for incoming connections */
|
||||
static GIOChannel *dcc_listen_port(GIOChannel *iface, IPADDR *ip, int port)
|
||||
static GIOChannel *dcc_listen_port_channel(GIOChannel *iface, IPADDR *ip, int port)
|
||||
{
|
||||
if (net_getsockname(iface, ip, NULL) == -1)
|
||||
if (net_getsockname_channel(iface, ip, NULL) == -1)
|
||||
return NULL;
|
||||
|
||||
if (IPADDR_IS_V6(ip))
|
||||
return net_listen(NULL, &port);
|
||||
return net_listen_channel(NULL, &port);
|
||||
else
|
||||
return net_listen(&ip4_any, &port);
|
||||
return net_listen_channel(&ip4_any, &port);
|
||||
}
|
||||
|
||||
/* input function: DCC SERVER received some data.. */
|
||||
|
|
@ -85,7 +85,7 @@ static void dcc_server_input(SERVER_DCC_REC *dcc)
|
|||
if (dcc->connection_established) {
|
||||
/* We set handle to NULL first because the new (chat/get) is using the same */
|
||||
/* handle and we don't want dcc_close to disconnect it.*/
|
||||
dcc->handle = NULL;
|
||||
dcc->channel = NULL;
|
||||
dcc_close(DCC(dcc));
|
||||
break;
|
||||
}
|
||||
|
|
@ -164,27 +164,27 @@ static void dcc_server_listen(SERVER_DCC_REC *dcc)
|
|||
{
|
||||
SERVER_DCC_REC *newdcc;
|
||||
IPADDR ip;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
int port;
|
||||
|
||||
g_return_if_fail(IS_DCC_SERVER(dcc));
|
||||
|
||||
/* accept connection */
|
||||
handle = net_accept(dcc->handle, &ip, &port);
|
||||
if (handle == NULL)
|
||||
channel = net_accept_channel(dcc->channel, &ip, &port);
|
||||
if (channel == NULL)
|
||||
return;
|
||||
|
||||
/* Create a new DCC SERVER to handle this connection */
|
||||
newdcc = dcc_server_clone(dcc);
|
||||
|
||||
newdcc->starttime = time(NULL);
|
||||
newdcc->handle = handle;
|
||||
newdcc->sendbuf = net_sendbuffer_create(handle, 0);
|
||||
newdcc->channel = channel;
|
||||
newdcc->sendbuf = net_sendbuffer_create_channel(channel, 0);
|
||||
memcpy(&newdcc->addr, &ip, sizeof(IPADDR));
|
||||
net_ip2host(&newdcc->addr, newdcc->addrstr);
|
||||
newdcc->port = port;
|
||||
newdcc->tagread =
|
||||
i_input_add(handle, I_INPUT_READ, (GInputFunction) dcc_server_input, newdcc);
|
||||
i_input_add(channel, I_INPUT_READ, (GInputFunction) dcc_server_input, newdcc);
|
||||
|
||||
signal_emit("dcc connected", 1, newdcc);
|
||||
}
|
||||
|
|
@ -205,12 +205,12 @@ static void dcc_server_msg(SERVER_DCC_REC *dcc, const char *msg)
|
|||
CHAT_DCC_REC *dccchat = dcc_chat_create(dcc->server, NULL, msg, "chat");
|
||||
|
||||
dccchat->starttime = time(NULL);
|
||||
dccchat->handle = dcc->handle;
|
||||
dccchat->sendbuf = net_sendbuffer_create(dccchat->handle, 0);
|
||||
dccchat->channel = dcc->channel;
|
||||
dccchat->sendbuf = net_sendbuffer_create_channel(dccchat->channel, 0);
|
||||
memcpy(&dccchat->addr, &dcc->addr, sizeof(IPADDR));
|
||||
net_ip2host(&dccchat->addr, dccchat->addrstr);
|
||||
dccchat->port = dcc->port;
|
||||
dccchat->tagread = i_input_add(dccchat->handle, I_INPUT_READ,
|
||||
dccchat->tagread = i_input_add(dccchat->channel, I_INPUT_READ,
|
||||
(GInputFunction) dcc_chat_input, dccchat);
|
||||
|
||||
dcc->connection_established = 1;
|
||||
|
|
@ -266,7 +266,7 @@ static void dcc_server_msg(SERVER_DCC_REC *dcc, const char *msg)
|
|||
}
|
||||
|
||||
dccget = dcc_get_create(dcc->server, NULL, nick, fname);
|
||||
dccget->handle = dcc->handle;
|
||||
dccget->channel = dcc->channel;
|
||||
dccget->target = g_strdup(dcc->server ? dcc->server->nick : "??");
|
||||
memcpy(&dccget->addr, &dcc->addr, sizeof(dcc->addr));
|
||||
if (dccget->addr.family == AF_INET) {
|
||||
|
|
@ -314,7 +314,7 @@ SERVER_DCC_REC *dcc_server_find_port(const char *port_str)
|
|||
static void cmd_dcc_server(const char *data, IRC_SERVER_REC *server)
|
||||
{
|
||||
void *free_arg;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
SERVER_DCC_REC *dcc;
|
||||
IPADDR own_ip;
|
||||
char *flags, *port;
|
||||
|
|
@ -337,18 +337,18 @@ static void cmd_dcc_server(const char *data, IRC_SERVER_REC *server)
|
|||
cmd_param_error(CMDERR_NOT_CONNECTED);
|
||||
}
|
||||
|
||||
handle = dcc_listen_port(net_sendbuffer_handle(server->handle),
|
||||
&own_ip, atoi(port));
|
||||
channel =
|
||||
dcc_listen_port_channel(net_sendbuffer_channel(server->handle), &own_ip, atoi(port));
|
||||
|
||||
if (handle == NULL) {
|
||||
if (channel == NULL) {
|
||||
cmd_param_error(CMDERR_ERRNO);
|
||||
}
|
||||
|
||||
dcc = dcc_server_create(server, flags);
|
||||
dcc->handle = handle;
|
||||
dcc->channel = channel;
|
||||
dcc->port = atoi(port);
|
||||
dcc->tagconn =
|
||||
i_input_add(dcc->handle, I_INPUT_READ, (GInputFunction) dcc_server_listen, dcc);
|
||||
i_input_add(dcc->channel, I_INPUT_READ, (GInputFunction) dcc_server_listen, dcc);
|
||||
|
||||
signal_emit("dcc server started", 1, dcc);
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ void dcc_destroy(DCC_REC *dcc)
|
|||
dcc->destroyed = TRUE;
|
||||
signal_emit("dcc destroyed", 1, dcc);
|
||||
|
||||
if (dcc->handle != NULL) net_disconnect(dcc->handle);
|
||||
if (dcc->channel != NULL)
|
||||
net_disconnect_channel(dcc->channel);
|
||||
if (dcc->tagconn != -1) g_source_remove(dcc->tagconn);
|
||||
if (dcc->tagread != -1) g_source_remove(dcc->tagread);
|
||||
if (dcc->tagwrite != -1) g_source_remove(dcc->tagwrite);
|
||||
|
|
@ -132,7 +133,7 @@ DCC_REC *dcc_find_request_latest(int type)
|
|||
for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) {
|
||||
DCC_REC *dcc = tmp->data;
|
||||
|
||||
if (dcc->type == type && dcc_is_waiting_user(dcc))
|
||||
if (dcc->type == type && dcc_is_waiting_user_channel(dcc))
|
||||
latest = dcc;
|
||||
}
|
||||
|
||||
|
|
@ -195,14 +196,14 @@ void dcc_str2ip(const char *str, IPADDR *ip)
|
|||
}
|
||||
|
||||
/* Start listening for incoming connections */
|
||||
GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port)
|
||||
GIOChannel *dcc_listen_channel(GIOChannel *iface, IPADDR *ip, int *port)
|
||||
{
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
IPADDR *listen_ip = NULL;
|
||||
const char *dcc_port, *p, *own_ip;
|
||||
int first, last;
|
||||
|
||||
if (net_getsockname(iface, ip, NULL) == -1)
|
||||
if (net_getsockname_channel(iface, ip, NULL) == -1)
|
||||
return NULL;
|
||||
|
||||
/* figure out if we want to listen in IPv4 address or in "any" address,
|
||||
|
|
@ -222,7 +223,7 @@ GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port)
|
|||
if (first == 0) {
|
||||
/* random port */
|
||||
*port = 0;
|
||||
return net_listen(listen_ip, port);
|
||||
return net_listen_channel(listen_ip, port);
|
||||
}
|
||||
|
||||
/* get last port */
|
||||
|
|
@ -240,20 +241,20 @@ GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port)
|
|||
|
||||
/* use the first available port */
|
||||
for (*port = first; *port <= last; (*port)++) {
|
||||
handle = net_listen(listen_ip, port);
|
||||
if (handle != NULL)
|
||||
return handle;
|
||||
channel = net_listen_channel(listen_ip, port);
|
||||
if (channel != NULL)
|
||||
return channel;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Connect to specified IP address using the correct own_ip. */
|
||||
GIOChannel *dcc_connect_ip(IPADDR *ip, int port)
|
||||
GIOChannel *dcc_connect_ip_channel(IPADDR *ip, int port)
|
||||
{
|
||||
IPADDR *own_ip, temp_ip;
|
||||
const char *own_ip_str;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
|
||||
own_ip_str = settings_get_str("dcc_own_ip");
|
||||
own_ip = NULL;
|
||||
|
|
@ -267,13 +268,13 @@ GIOChannel *dcc_connect_ip(IPADDR *ip, int port)
|
|||
if (own_ip == NULL)
|
||||
own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4;
|
||||
|
||||
handle = net_connect_ip(ip, port, own_ip);
|
||||
if (handle == NULL && errno == EADDRNOTAVAIL && own_ip != NULL) {
|
||||
channel = net_connect_ip_channel(ip, port, own_ip);
|
||||
if (channel == NULL && errno == EADDRNOTAVAIL && own_ip != NULL) {
|
||||
/* dcc_own_ip is external address */
|
||||
own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4;
|
||||
handle = net_connect_ip(ip, port, own_ip);
|
||||
channel = net_connect_ip_channel(ip, port, own_ip);
|
||||
}
|
||||
return handle;
|
||||
return channel;
|
||||
}
|
||||
|
||||
/* Server connected - update server for DCC records that have
|
||||
|
|
|
|||
|
|
@ -17,12 +17,10 @@ typedef struct {
|
|||
((dcc)->starttime != 0)
|
||||
|
||||
/* not connected, we're waiting for other side to connect */
|
||||
#define dcc_is_listening(dcc) \
|
||||
((dcc)->handle != NULL && (dcc)->starttime == 0)
|
||||
#define dcc_is_listening_channel(dcc) ((dcc)->channel != NULL && (dcc)->starttime == 0)
|
||||
|
||||
/* not connected, waiting for user to accept it */
|
||||
#define dcc_is_waiting_user(dcc) \
|
||||
((dcc)->handle == NULL)
|
||||
#define dcc_is_waiting_user_channel(dcc) ((dcc)->channel == NULL)
|
||||
|
||||
/* passive DCC */
|
||||
#define dcc_is_passive(dcc) \
|
||||
|
|
@ -52,9 +50,9 @@ void dcc_ip2str(IPADDR *ip, char *str);
|
|||
void dcc_str2ip(const char *str, IPADDR *ip);
|
||||
|
||||
/* Start listening for incoming connections */
|
||||
GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port);
|
||||
GIOChannel *dcc_listen_channel(GIOChannel *iface, IPADDR *ip, int *port);
|
||||
/* Connect to specified IP address using the correct own_ip. */
|
||||
GIOChannel *dcc_connect_ip(IPADDR *ip, int port);
|
||||
GIOChannel *dcc_connect_ip_channel(IPADDR *ip, int port);
|
||||
|
||||
/* Close DCC - sends "dcc closed" signal and calls dcc_destroy() */
|
||||
void dcc_close(DCC_REC *dcc);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ static int is_all_digits(const char *s)
|
|||
return strspn(s, "0123456789") == strlen(s);
|
||||
}
|
||||
|
||||
static GIOChannel *net_listen_unix(const char *path)
|
||||
static GIOChannel *net_listen_unix_channel(const char *path)
|
||||
{
|
||||
struct sockaddr_un sa;
|
||||
int saved_errno, handle;
|
||||
|
|
@ -84,16 +84,16 @@ error_close:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static GIOChannel *net_accept_unix(GIOChannel *handle)
|
||||
static GIOChannel *net_accept_unix_channel(GIOChannel *channel)
|
||||
{
|
||||
struct sockaddr_un sa;
|
||||
int ret;
|
||||
socklen_t addrlen;
|
||||
|
||||
g_return_val_if_fail(handle != NULL, NULL);
|
||||
g_return_val_if_fail(channel != NULL, NULL);
|
||||
|
||||
addrlen = sizeof sa;
|
||||
ret = accept(g_io_channel_unix_get_fd(handle), (struct sockaddr *)&sa, &addrlen);
|
||||
ret = accept(g_io_channel_unix_get_fd(channel), (struct sockaddr *) &sa, &addrlen);
|
||||
|
||||
if (ret < 0)
|
||||
return NULL;
|
||||
|
|
@ -431,7 +431,7 @@ static void sig_listen(LISTEN_REC *listen)
|
|||
CLIENT_REC *rec;
|
||||
IPADDR ip;
|
||||
NET_SENDBUF_REC *sendbuf;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
char host[MAX_IP_LEN];
|
||||
int port;
|
||||
char *addr;
|
||||
|
|
@ -440,20 +440,20 @@ static void sig_listen(LISTEN_REC *listen)
|
|||
|
||||
/* accept connection */
|
||||
if (listen->port) {
|
||||
handle = net_accept(listen->handle, &ip, &port);
|
||||
if (handle == NULL)
|
||||
channel = net_accept_channel(listen->channel, &ip, &port);
|
||||
if (channel == NULL)
|
||||
return;
|
||||
net_ip2host(&ip, host);
|
||||
addr = g_strdup_printf("%s:%d", host, port);
|
||||
} else {
|
||||
/* no port => this is a unix socket */
|
||||
handle = net_accept_unix(listen->handle);
|
||||
if (handle == NULL)
|
||||
channel = net_accept_unix_channel(listen->channel);
|
||||
if (channel == NULL)
|
||||
return;
|
||||
addr = g_strdup("(local)");
|
||||
}
|
||||
|
||||
sendbuf = net_sendbuffer_create(handle, 0);
|
||||
sendbuf = net_sendbuffer_create_channel(channel, 0);
|
||||
rec = g_new0(CLIENT_REC, 1);
|
||||
rec->listen = listen;
|
||||
rec->handle = sendbuf;
|
||||
|
|
@ -470,7 +470,7 @@ static void sig_listen(LISTEN_REC *listen)
|
|||
rec->server = servers == NULL ? NULL :
|
||||
IRC_SERVER(server_find_chatnet(listen->ircnet));
|
||||
}
|
||||
rec->recv_tag = i_input_add(handle, I_INPUT_READ, (GInputFunction) sig_listen_client, rec);
|
||||
rec->recv_tag = i_input_add(channel, I_INPUT_READ, (GInputFunction) sig_listen_client, rec);
|
||||
|
||||
proxy_clients = g_slist_prepend(proxy_clients, rec);
|
||||
listen->clients = g_slist_prepend(listen->clients, rec);
|
||||
|
|
@ -699,14 +699,14 @@ static void add_listen(const char *ircnet, int port, const char *port_or_path)
|
|||
{
|
||||
LISTEN_REC *rec;
|
||||
IPADDR ip4, ip6, *my_ip;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
|
||||
if (*port_or_path == '\0' || port < 0 || *ircnet == '\0')
|
||||
return;
|
||||
|
||||
if (port == 0) {
|
||||
/* listening on a unix socket */
|
||||
handle = net_listen_unix(port_or_path);
|
||||
channel = net_listen_unix_channel(port_or_path);
|
||||
} else {
|
||||
/* bind to specific host/ip? */
|
||||
my_ip = NULL;
|
||||
|
|
@ -725,10 +725,10 @@ static void add_listen(const char *ircnet, int port, const char *port_or_path)
|
|||
&ip6 :
|
||||
&ip4;
|
||||
}
|
||||
handle = net_listen(my_ip, &port);
|
||||
channel = net_listen_channel(my_ip, &port);
|
||||
}
|
||||
|
||||
if (handle == NULL) {
|
||||
if (channel == NULL) {
|
||||
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
||||
"Proxy: Listen in port %s failed: %s",
|
||||
port_or_path, g_strerror(errno));
|
||||
|
|
@ -736,12 +736,12 @@ static void add_listen(const char *ircnet, int port, const char *port_or_path)
|
|||
}
|
||||
|
||||
rec = g_new0(LISTEN_REC, 1);
|
||||
rec->handle = handle;
|
||||
rec->channel = channel;
|
||||
rec->ircnet = g_strdup(ircnet);
|
||||
rec->port = port;
|
||||
rec->port_or_path = g_strdup(port_or_path);
|
||||
|
||||
rec->tag = i_input_add(rec->handle, I_INPUT_READ, (GInputFunction) sig_listen, rec);
|
||||
rec->tag = i_input_add(rec->channel, I_INPUT_READ, (GInputFunction) sig_listen, rec);
|
||||
|
||||
proxy_listens = g_slist_append(proxy_listens, rec);
|
||||
}
|
||||
|
|
@ -757,7 +757,7 @@ static void remove_listen(LISTEN_REC *rec)
|
|||
if (rec->port == 0)
|
||||
unlink(rec->port_or_path);
|
||||
|
||||
net_disconnect(rec->handle);
|
||||
net_disconnect_channel(rec->channel);
|
||||
g_source_remove(rec->tag);
|
||||
g_free(rec->port_or_path);
|
||||
g_free(rec->ircnet);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ typedef struct {
|
|||
char *ircnet;
|
||||
|
||||
int tag;
|
||||
GIOChannel *handle;
|
||||
GIOChannel *channel;
|
||||
|
||||
GSList *clients;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue