summaryrefslogtreecommitdiff
path: root/src/plugins/scripts
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-02-18 11:13:23 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-02-18 11:13:23 +0100
commit4d1fdfade0cfb51e9ff680861e3333bd2b24173a (patch)
tree39ce7b5d276134eb5de1625b0c4206d4c09d709e /src/plugins/scripts
parente263a847da839253e346fa3843aaf7cb90199f01 (diff)
downloadweechat-4d1fdfade0cfb51e9ff680861e3333bd2b24173a.zip
Give file descriptor to callback of hook_fd
Diffstat (limited to 'src/plugins/scripts')
-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
7 files changed, 32 insertions, 17 deletions
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,