summaryrefslogtreecommitdiff
path: root/src/plugins/scripts
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-06-17 16:01:09 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-06-17 16:01:09 +0200
commitaf87798455e9d82773094a3c274ecb991af41ed9 (patch)
tree32de00c475b9f127003d6e663d6e8f98f13ad3ad /src/plugins/scripts
parent860842240b2c3f673a2265716359cb6605048386 (diff)
downloadweechat-af87798455e9d82773094a3c274ecb991af41ed9.zip
New plugin "notify", new option for debug messages in plugins
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c40
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c33
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c34
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c38
4 files changed, 145 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index add53f967..92c8b2e31 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -3366,6 +3366,45 @@ weechat_lua_api_buffer_close (lua_State *L)
}
/*
+ * weechat_lua_api_buffer_get_integer: get a buffer property as integer
+ */
+
+static int
+weechat_lua_api_buffer_get_integer (lua_State *L)
+{
+ const char *buffer, *property;
+ int n, value;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_integer");
+ LUA_RETURN_INT(-1);
+ }
+
+ buffer = NULL;
+ property = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_integer");
+ LUA_RETURN_INT(-1);
+ }
+
+ buffer = lua_tostring (lua_current_interpreter, -2);
+ property = lua_tostring (lua_current_interpreter, -1);
+
+ value = weechat_buffer_get_integer (script_str2ptr (buffer),
+ property);
+
+ LUA_RETURN_INT(value);
+}
+
+/*
* weechat_lua_api_buffer_get_string: get a buffer property as string
*/
@@ -4968,6 +5007,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "buffer_search", &weechat_lua_api_buffer_search },
{ "buffer_clear", &weechat_lua_api_buffer_clear },
{ "buffer_close", &weechat_lua_api_buffer_close },
+ { "buffer_get_integer", &weechat_lua_api_buffer_get_integer },
{ "buffer_get_string", &weechat_lua_api_buffer_get_string },
{ "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer },
{ "buffer_set", &weechat_lua_api_buffer_set },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 35e2091f1..586f0fbbd 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2811,6 +2811,38 @@ static XS (XS_weechat_buffer_close)
}
/*
+ * weechat::buffer_get_integer: get a buffer property as integer
+ */
+
+static XS (XS_weechat_buffer_get_integer)
+{
+ char *buffer, *property;
+ int value;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_integer");
+ PERL_RETURN_INT(-1);
+ }
+
+ if (items < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_integer");
+ PERL_RETURN_INT(-1);
+ }
+
+ buffer = SvPV (ST (0), PL_na);
+ property = SvPV (ST (1), PL_na);
+ value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
+
+ PERL_RETURN_INT(value);
+}
+
+/*
* weechat::buffer_get_string: get a buffer property as string
*/
@@ -3898,6 +3930,7 @@ weechat_perl_api_init (pTHX)
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_integer", XS_weechat_buffer_get_integer, "weechat");
newXS ("weechat::buffer_get_string", XS_weechat_buffer_get_string, "weechat");
newXS ("weechat::buffer_get_pointer", XS_weechat_buffer_get_pointer, "weechat");
newXS ("weechat::buffer_set", XS_weechat_buffer_set, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index f6467e6c3..605c8d219 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -2987,6 +2987,39 @@ weechat_python_api_buffer_close (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_buffer_get_integer get a buffer property as integer
+ */
+
+static PyObject *
+weechat_python_api_buffer_get_integer (PyObject *self, PyObject *args)
+{
+ char *buffer, *property;
+ int value;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_integer");
+ PYTHON_RETURN_INT(-1);
+ }
+
+ buffer = NULL;
+ property = NULL;
+
+ if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_integer");
+ PYTHON_RETURN_INT(-1);
+ }
+
+ value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
+
+ PYTHON_RETURN_INT(value);
+}
+
+/*
* weechat_python_api_buffer_get_string: get a buffer property as string
*/
@@ -4144,6 +4177,7 @@ PyMethodDef weechat_python_funcs[] =
{ "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_integer", &weechat_python_api_buffer_get_integer, METH_VARARGS, "" },
{ "buffer_get_string", &weechat_python_api_buffer_get_string, METH_VARARGS, "" },
{ "buffer_get_pointer", &weechat_python_api_buffer_get_pointer, METH_VARARGS, "" },
{ "buffer_set", &weechat_python_api_buffer_set, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 4e58d8e7b..b0f91fcd6 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -3428,6 +3428,43 @@ weechat_ruby_api_buffer_close (VALUE class, VALUE buffer,
}
/*
+ * weechat_ruby_api_buffer_get_integer: get a buffer property as integer
+ */
+
+static VALUE
+weechat_ruby_api_buffer_get_integer (VALUE class, VALUE buffer, VALUE property)
+{
+ char *c_buffer, *c_property;
+ int value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_integer");
+ RUBY_RETURN_INT(-1);
+ }
+
+ if (NIL_P (buffer) || NIL_P (property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_integer");
+ RUBY_RETURN_INT(-1);
+ }
+
+ Check_Type (buffer, T_STRING);
+ Check_Type (property, T_STRING);
+
+ c_buffer = STR2CSTR (buffer);
+ c_property = STR2CSTR (property);
+
+ value = weechat_buffer_get_integer (script_str2ptr (c_buffer),
+ c_property);
+
+ RUBY_RETURN_INT(value);
+}
+
+/*
* weechat_ruby_api_buffer_get_string: get a buffer property as string
*/
@@ -4771,6 +4808,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
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_integer", &weechat_ruby_api_buffer_get_integer, 2);
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);
rb_define_module_function (ruby_mWeechat, "buffer_set", &weechat_ruby_api_buffer_set, 3);