summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/ruby
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/ruby
parent860842240b2c3f673a2265716359cb6605048386 (diff)
downloadweechat-af87798455e9d82773094a3c274ecb991af41ed9.zip
New plugin "notify", new option for debug messages in plugins
Diffstat (limited to 'src/plugins/scripts/ruby')
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c38
1 files changed, 38 insertions, 0 deletions
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);