diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-05-06 16:51:30 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-05-06 16:51:30 +0200 |
commit | e9603acb1a1943bda3c2cc809e5e39ff8a13b68c (patch) | |
tree | d4fb7fef63f5a4c1d415fdca9c1938016b23bbb3 /src/plugins/scripts | |
parent | e7a16efa0cf5123f87ef6d7072fbbb9ccdd42bac (diff) | |
download | weechat-e9603acb1a1943bda3c2cc809e5e39ff8a13b68c.zip |
IRC DCC chat and file (without resume) reintroduced, via xfer plugin (called by /dcc command)
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 37 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 29 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 32 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 36 |
4 files changed, 134 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index fe874cb46..9e0431da1 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -3291,6 +3291,42 @@ weechat_lua_api_buffer_search (lua_State *L) } /* + * weechat_lua_api_buffer_clear: clear a buffer + */ + +static int +weechat_lua_api_buffer_clear (lua_State *L) +{ + const char *buffer; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_clear"); + LUA_RETURN_ERROR; + } + + buffer = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_clear"); + LUA_RETURN_ERROR; + } + + buffer = lua_tostring (lua_current_interpreter, -1); + + weechat_buffer_clear (script_str2ptr ((char *)buffer)); + + LUA_RETURN_OK; +} + +/* * weechat_lua_api_buffer_close: close a buffer */ @@ -4794,6 +4830,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "unhook_all", &weechat_lua_api_unhook_all }, { "buffer_new", &weechat_lua_api_buffer_new }, { "buffer_search", &weechat_lua_api_buffer_search }, + { "buffer_clear", &weechat_lua_api_buffer_clear }, { "buffer_close", &weechat_lua_api_buffer_close }, { "buffer_get_string", &weechat_lua_api_buffer_get_string }, { "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 082363983..b1081e00f 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -2751,6 +2751,34 @@ static XS (XS_weechat_buffer_search) } /* + * weechat::buffer_clear: clear a buffer + */ + +static XS (XS_weechat_buffer_clear) +{ + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_clear"); + PERL_RETURN_ERROR; + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_clear"); + PERL_RETURN_ERROR; + } + + weechat_buffer_clear (script_str2ptr (SvPV (ST (0), PL_na))); /* buffer */ + + PERL_RETURN_OK; +} + +/* * weechat::buffer_close: close a buffer */ @@ -3867,6 +3895,7 @@ weechat_perl_api_init (pTHX) newXS ("weechat::unhook_all", XS_weechat_unhook_all, "weechat"); newXS ("weechat::buffer_new", XS_weechat_buffer_new, "weechat"); newXS ("weechat::buffer_search", XS_weechat_buffer_search, "weechat"); + newXS ("weechat::buffer_clear", XS_weechat_buffer_clear, "weechat"); newXS ("weechat::buffer_close", XS_weechat_buffer_close, "weechat"); newXS ("weechat::buffer_get_string", XS_weechat_buffer_get_string, "weechat"); newXS ("weechat::buffer_get_pointer", XS_weechat_buffer_get_pointer, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 9a7696c24..c1ea8821d 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -2919,6 +2919,37 @@ weechat_python_api_buffer_search (PyObject *self, PyObject *args) } /* + * weechat_python_api_buffer_clear: clear a buffer + */ + +static PyObject * +weechat_python_api_buffer_clear (PyObject *self, PyObject *args) +{ + char *buffer; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_clear"); + PYTHON_RETURN_ERROR; + } + + buffer = NULL; + + if (!PyArg_ParseTuple (args, "s", &buffer)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_clear"); + PYTHON_RETURN_ERROR; + } + + weechat_buffer_clear (script_str2ptr (buffer)); + + PYTHON_RETURN_OK; +} + +/* * weechat_python_api_buffer_close: close a buffer */ @@ -4110,6 +4141,7 @@ PyMethodDef weechat_python_funcs[] = { "unhook_all", &weechat_python_api_unhook_all, METH_VARARGS, "" }, { "buffer_new", &weechat_python_api_buffer_new, METH_VARARGS, "" }, { "buffer_search", &weechat_python_api_buffer_search, METH_VARARGS, "" }, + { "buffer_clear", &weechat_python_api_buffer_clear, METH_VARARGS, "" }, { "buffer_close", &weechat_python_api_buffer_close, METH_VARARGS, "" }, { "buffer_get_string", &weechat_python_api_buffer_get_string, METH_VARARGS, "" }, { "buffer_get_pointer", &weechat_python_api_buffer_get_pointer, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 70bba8fde..2439b1b36 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -3349,6 +3349,41 @@ weechat_ruby_api_buffer_search (VALUE class, VALUE category, VALUE name) } /* + * weechat_ruby_api_buffer_clear: clear a buffer + */ + +static VALUE +weechat_ruby_api_buffer_clear (VALUE class, VALUE buffer) +{ + char *c_buffer; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_clear"); + RUBY_RETURN_ERROR; + } + + c_buffer = NULL; + + if (NIL_P (buffer)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_clear"); + RUBY_RETURN_ERROR; + } + + Check_Type (buffer, T_STRING); + + c_buffer = STR2CSTR (buffer); + + weechat_buffer_clear (script_str2ptr (c_buffer)); + + RUBY_RETURN_OK; +} + +/* * weechat_ruby_api_buffer_close: close a buffer */ @@ -4714,6 +4749,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_module_function (ruby_mWeechat, "unhook_all", &weechat_ruby_api_unhook_all, 0); rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 4); rb_define_module_function (ruby_mWeechat, "buffer_search", &weechat_ruby_api_buffer_search, 2); + rb_define_module_function (ruby_mWeechat, "buffer_clear", &weechat_ruby_api_buffer_clear, 1); rb_define_module_function (ruby_mWeechat, "buffer_close", &weechat_ruby_api_buffer_close, 1); rb_define_module_function (ruby_mWeechat, "buffer_get_string", &weechat_ruby_api_buffer_get_string, 2); rb_define_module_function (ruby_mWeechat, "buffer_get_pointer", &weechat_ruby_api_buffer_get_pointer, 2); |