summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-hook.c3
-rw-r--r--src/core/wee-hook.h2
-rw-r--r--src/core/wee-network.c7
-rw-r--r--src/gui/curses/gui-curses-keyboard.c3
-rw-r--r--src/gui/curses/gui-curses.h2
-rw-r--r--src/plugins/irc/irc-server.c5
-rw-r--r--src/plugins/irc/irc-server.h2
-rw-r--r--src/plugins/jabber/jabber-server.c5
-rw-r--r--src/plugins/jabber/jabber-server.h2
-rw-r--r--src/plugins/relay/relay-client.c5
-rw-r--r--src/plugins/relay/relay-network.c3
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c9
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c9
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c9
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c9
-rw-r--r--src/plugins/scripts/script-api.c2
-rw-r--r--src/plugins/scripts/script-api.h2
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c9
-rw-r--r--src/plugins/weechat-plugin.h2
-rw-r--r--src/plugins/xfer/xfer-chat.c5
-rw-r--r--src/plugins/xfer/xfer-chat.h2
-rw-r--r--src/plugins/xfer/xfer-network.c10
22 files changed, 73 insertions, 34 deletions
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index eab5ea6d1..cf07dd670 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -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;
}
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index 11801bc56..397156abf 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -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
{
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 3fb952095..10c8f12eb 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -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
}
diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c
index d7e1ebf9b..28a1d64ac 100644
--- a/src/gui/curses/gui-curses-keyboard.c
+++ b/src/gui/curses/gui-curses-keyboard.c
@@ -326,13 +326,14 @@ gui_keyboard_flush ()
*/
int
-gui_keyboard_read_cb (void *data)
+gui_keyboard_read_cb (void *data, int fd)
{
int ret, i, accept_paste, cancel_paste, text_added_to_buffer, paste_lines;
unsigned char buffer[4096];
/* make C compiler happy */
(void) data;
+ (void) fd;
accept_paste = 0;
cancel_paste = 0;
diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h
index a14b77379..5b13cf490 100644
--- a/src/gui/curses/gui-curses.h
+++ b/src/gui/curses/gui-curses.h
@@ -66,7 +66,7 @@ extern void gui_chat_calculate_line_diff (struct t_gui_window *window,
/* keyboard functions */
extern void gui_keyboard_default_bindings ();
-extern int gui_keyboard_read_cb (void *data);
+extern int gui_keyboard_read_cb (void *data, int fd);
/* window functions */
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index cf4d369a2..73becceaa 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1551,12 +1551,15 @@ irc_server_msgq_flush ()
*/
int
-irc_server_recv_cb (void *arg_server)
+irc_server_recv_cb (void *arg_server, int fd)
{
struct t_irc_server *server;
static char buffer[4096 + 2];
int num_read;
+ /* make C compiler happy */
+ (void) fd;
+
server = (struct t_irc_server *)arg_server;
if (!server)
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index ac6211a52..bddbc71d2 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -197,7 +197,7 @@ extern void irc_server_set_current_server (struct t_irc_server *server);
extern int irc_server_connect (struct t_irc_server *server);
extern void irc_server_auto_connect ();
extern void irc_server_autojoin_channels ();
-extern int irc_server_recv_cb (void *arg_server);
+extern int irc_server_recv_cb (void *arg_server, int fd);
extern int irc_server_timer_cb (void *data);
extern int irc_server_timer_check_away_cb (void *data);
extern void irc_server_outqueue_free_all (struct t_irc_server *server);
diff --git a/src/plugins/jabber/jabber-server.c b/src/plugins/jabber/jabber-server.c
index 4e7215acf..86c1401ae 100644
--- a/src/plugins/jabber/jabber-server.c
+++ b/src/plugins/jabber/jabber-server.c
@@ -1583,11 +1583,14 @@ jabber_server_send_signal (struct t_jabber_server *server, const char *signal,
*/
int
-jabber_server_recv_cb (void *arg_server)
+jabber_server_recv_cb (void *arg_server, int fd)
{
struct t_jabber_server *server;
int rc;
+ /* make C compiler happy */
+ (void) fd;
+
server = (struct t_jabber_server *)arg_server;
if (!server)
diff --git a/src/plugins/jabber/jabber-server.h b/src/plugins/jabber/jabber-server.h
index 5a0a01149..e77b14a15 100644
--- a/src/plugins/jabber/jabber-server.h
+++ b/src/plugins/jabber/jabber-server.h
@@ -196,7 +196,7 @@ extern struct t_jabber_server *jabber_server_copy (struct t_jabber_server *serve
const char *new_name);
extern int jabber_server_rename (struct t_jabber_server *server,
const char *new_server_name);
-extern int jabber_server_recv_cb (void *arg_server);
+extern int jabber_server_recv_cb (void *arg_server, int fd);
extern int jabber_server_timer_cb (void *data);
extern int jabber_server_add_to_infolist (struct t_infolist *infolist,
struct t_jabber_server *server);
diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c
index 19c5538a9..aa465b088 100644
--- a/src/plugins/relay/relay-client.c
+++ b/src/plugins/relay/relay-client.c
@@ -203,13 +203,16 @@ relay_client_send_infolist (struct t_relay_client *client,
*/
int
-relay_client_recv_cb (void *arg_client)
+relay_client_recv_cb (void *arg_client, int fd)
{
struct t_relay_client *client;
static char buffer[4096 + 2];
struct t_infolist *infolist;
int num_read;
+ /* make C compiler happy */
+ (void) fd;
+
client = (struct t_relay_client *)arg_client;
num_read = recv (client->sock, buffer, sizeof (buffer) - 1, 0);
diff --git a/src/plugins/relay/relay-network.c b/src/plugins/relay/relay-network.c
index b5305193a..60ceddce0 100644
--- a/src/plugins/relay/relay-network.c
+++ b/src/plugins/relay/relay-network.c
@@ -68,7 +68,7 @@ relay_network_close_socket ()
*/
int
-relay_network_sock_cb (void *data)
+relay_network_sock_cb (void *data, int fd)
{
struct sockaddr_in client_addr;
unsigned int client_length;
@@ -77,6 +77,7 @@ relay_network_sock_cb (void *data)
/* make C compiler happy */
(void) data;
+ (void) fd;
client_length = sizeof (client_addr);
memset (&client_addr, 0, client_length);
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 88733610c..503f2f10f 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -2940,15 +2940,18 @@ weechat_lua_api_hook_timer (lua_State *L)
*/
int
-weechat_lua_api_hook_fd_cb (void *data)
+weechat_lua_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- char *lua_argv[1];
+ char *lua_argv[2], str_fd[32];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
- lua_argv[0] = NULL;
+ snprintf (str_fd, sizeof (str_fd), "%d", fd);
+
+ lua_argv[0] = str_fd;
+ lua_argv[1] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 6967c6dcf..eb4dd7851 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2453,15 +2453,18 @@ static XS (XS_weechat_api_hook_timer)
*/
int
-weechat_perl_api_hook_fd_cb (void *data)
+weechat_perl_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- char *perl_argv[1];
+ char *perl_argv[2], str_fd[32];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
- perl_argv[0] = NULL;
+ snprintf (str_fd, sizeof (str_fd), "%d", fd);
+
+ perl_argv[0] = str_fd;
+ perl_argv[1] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index fe77270b4..9cf06796b 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -2613,15 +2613,18 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
*/
int
-weechat_python_api_hook_fd_cb (void *data)
+weechat_python_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- char *python_argv[1];
+ char *python_argv[2], str_fd[32];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
- python_argv[0] = NULL;
+ snprintf (str_fd, sizeof (str_fd), "%d", fd);
+
+ python_argv[0] = str_fd;
+ python_argv[1] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 1e34f9743..2dac97f1e 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -3000,15 +3000,18 @@ weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
*/
int
-weechat_ruby_api_hook_fd_cb (void *data)
+weechat_ruby_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- char *ruby_argv[1];
+ char *ruby_argv[2], str_fd[32];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
- ruby_argv[0] = NULL;
+ snprintf (str_fd, sizeof (str_fd), "%d", fd);
+
+ ruby_argv[0] = str_fd;
+ ruby_argv[1] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 1e39e5649..9f408d703 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -749,7 +749,7 @@ script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
int fd, int flag_read, int flag_write,
int flag_exception,
- int (*callback)(void *data),
+ int (*callback)(void *data, int fd),
const char *function)
{
struct t_script_callback *new_script_callback;
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index bd8822664..70b542968 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -125,7 +125,7 @@ extern struct t_hook *script_api_hook_fd (struct t_weechat_plugin *weechat_plugi
struct t_plugin_script *script,
int fd, int flag_read,
int flag_write, int flag_exception,
- int (*callback)(void *data),
+ int (*callback)(void *data, int fd),
const char *function);
extern struct t_hook *script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 27be56cef..65e77cdde 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -2826,15 +2826,18 @@ weechat_tcl_api_hook_timer (ClientData clientData, Tcl_Interp *interp,
*/
int
-weechat_tcl_api_hook_fd_cb (void *data)
+weechat_tcl_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- char *tcl_argv[1];
+ char *tcl_argv[2], str_fd[32];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
- tcl_argv[0] = NULL;
+ snprintf (str_fd, sizeof (str_fd), "%d", fd);
+
+ tcl_argv[0] = str_fd;
+ tcl_argv[1] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index d52c520ed..8f537577c 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -364,7 +364,7 @@ struct t_weechat_plugin
int flag_read,
int flag_write,
int flag_exception,
- int (*callback)(void *data),
+ int (*callback)(void *data, int fd),
void *callback_data);
struct t_hook *(*hook_connect) (struct t_weechat_plugin *plugin,
const char *proxy,
diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c
index c0a5df61e..27dfb1a41 100644
--- a/src/plugins/xfer/xfer-chat.c
+++ b/src/plugins/xfer/xfer-chat.c
@@ -85,13 +85,16 @@ xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...)
*/
int
-xfer_chat_recv_cb (void *arg_xfer)
+xfer_chat_recv_cb (void *arg_xfer, int fd)
{
struct t_xfer *xfer;
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
int num_read;
+ /* make C compiler happy */
+ (void) fd;
+
xfer = (struct t_xfer *)arg_xfer;
num_read = recv (xfer->sock, buffer, sizeof (buffer) - 2, 0);
diff --git a/src/plugins/xfer/xfer-chat.h b/src/plugins/xfer/xfer-chat.h
index fd5b12a42..2f41b36a7 100644
--- a/src/plugins/xfer/xfer-chat.h
+++ b/src/plugins/xfer/xfer-chat.h
@@ -20,7 +20,7 @@
#ifndef __WEECHAT_XFER_CHAT_H
#define __WEECHAT_XFER_CHAT_H 1
-extern int xfer_chat_recv_cb (void *arg_xfer);
+extern int xfer_chat_recv_cb (void *arg_xfer, int fd);
extern void xfer_chat_open_buffer (struct t_xfer *xfer);
#endif /* xfer-chat.h */
diff --git a/src/plugins/xfer/xfer-network.c b/src/plugins/xfer/xfer-network.c
index c38c29a7b..e5fe700c4 100644
--- a/src/plugins/xfer/xfer-network.c
+++ b/src/plugins/xfer/xfer-network.c
@@ -85,13 +85,16 @@ xfer_network_write_pipe (struct t_xfer *xfer, int status, int error)
*/
int
-xfer_network_child_read_cb (void *arg_xfer)
+xfer_network_child_read_cb (void *arg_xfer, int fd)
{
struct t_xfer *xfer;
char bufpipe[1 + 1 + 12 + 1];
int num_read;
char *error;
+ /* make C compiler happy */
+ (void) fd;
+
xfer = (struct t_xfer *)arg_xfer;
num_read = read (xfer->child_read, bufpipe, sizeof (bufpipe));
@@ -305,13 +308,16 @@ xfer_network_child_kill (struct t_xfer *xfer)
*/
int
-xfer_network_fd_cb (void *arg_xfer)
+xfer_network_fd_cb (void *arg_xfer, int fd)
{
struct t_xfer *xfer;
int sock;
struct sockaddr_in addr;
socklen_t length;
+ /* make C compiler happy */
+ (void) fd;
+
xfer = (struct t_xfer *)arg_xfer;
if (xfer->status == XFER_STATUS_CONNECTING)