1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

Give file descriptor to callback of hook_fd

This commit is contained in:
Sebastien Helleu
2009-02-18 11:13:23 +01:00
parent e263a847da
commit 4d1fdfade0
23 changed files with 80 additions and 36 deletions
+2 -1
View File
@@ -949,7 +949,8 @@ hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
&& (FD_ISSET(HOOK_FD(ptr_hook, fd), exception_fds)))))
{
ptr_hook->running = 1;
(void) (HOOK_FD(ptr_hook, callback)) (ptr_hook->callback_data);
(void) (HOOK_FD(ptr_hook, callback)) (ptr_hook->callback_data,
HOOK_FD(ptr_hook, fd));
ptr_hook->running = 0;
}
+1 -1
View File
@@ -126,7 +126,7 @@ struct t_hook_timer
struct timeval next_exec; /* next scheduled execution */
};
typedef int (t_hook_callback_fd)(void *data);
typedef int (t_hook_callback_fd)(void *data, int fd);
struct t_hook_fd
{
+5 -2
View File
@@ -752,7 +752,7 @@ network_connect_child (struct t_hook *hook_connect)
*/
int
network_connect_child_read_cb (void *arg_hook_connect)
network_connect_child_read_cb (void *arg_hook_connect, int fd)
{
struct t_hook *hook_connect;
char buffer[1], buf_size_ip[6], *ip_address, *error;
@@ -761,6 +761,9 @@ network_connect_child_read_cb (void *arg_hook_connect)
#ifdef HAVE_GNUTLS
int rc;
#endif
/* make C compiler happy */
(void) fd;
hook_connect = (struct t_hook *)arg_hook_connect;
@@ -914,7 +917,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
HOOK_CONNECT(hook_connect, hook_fd) = hook_fd (NULL,
HOOK_CONNECT(hook_connect, child_read),
1, 0, 0,
network_connect_child_read_cb,
&network_connect_child_read_cb,
hook_connect);
#endif
}