diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-12-23 20:32:03 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-12-23 20:35:30 +0100 |
commit | c4626bc08ab972625cd8ada2a05cfc3b8436a63c (patch) | |
tree | b409176768b49bc4ebe5cea5e277127c0ca9374f /src/plugins/ruby | |
parent | d7122cd6be8095d31a93e30e361ff1bcb31811bc (diff) | |
download | weechat-c4626bc08ab972625cd8ada2a05cfc3b8436a63c.zip |
scripts: add option "version" in script commands (closes #1075)
Diffstat (limited to 'src/plugins/ruby')
-rw-r--r-- | src/plugins/ruby/weechat-ruby.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c index e525a3753..edf75d13c 100644 --- a/src/plugins/ruby/weechat-ruby.c +++ b/src/plugins/ruby/weechat-ruby.c @@ -816,6 +816,10 @@ weechat_ruby_command_cb (const void *pointer, void *data, { weechat_ruby_unload_all (); } + else if (weechat_strcasecmp (argv[1], "version") == 0) + { + plugin_script_display_interpreter (weechat_ruby_plugin, 0); + } else WEECHAT_COMMAND_ERROR; } @@ -962,31 +966,6 @@ weechat_ruby_signal_debug_dump_cb (const void *pointer, void *data, } /* - * Display infos about external libraries used. - */ - -int -weechat_ruby_signal_debug_libs_cb (const void *pointer, void *data, - const char *signal, - const char *type_data, void *signal_data) -{ - /* make C compiler happy */ - (void) pointer; - (void) data; - (void) signal; - (void) type_data; - (void) signal_data; - -#ifdef HAVE_RUBY_VERSION_H - weechat_printf (NULL, " %s: %s", RUBY_PLUGIN_NAME, ruby_version); -#else - weechat_printf (NULL, " %s: (?)", RUBY_PLUGIN_NAME); -#endif /* HAVE_RUBY_VERSION_H */ - - return WEECHAT_RC_OK; -} - -/* * Timer for executing actions. */ @@ -1139,6 +1118,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) weechat_ruby_plugin = plugin; + /* set interpreter name and version */ + weechat_hashtable_set (plugin->variables, "interpreter_name", + plugin->name); +#ifdef HAVE_RUBY_VERSION_H + weechat_hashtable_set (plugin->variables, "interpreter_version", + ruby_version); +#else + weechat_hashtable_set (plugin->variables, "interpreter_version", + ""); +#endif /* HAVE_RUBY_VERSION_H */ + ruby_error = 0; /* init stdout/stderr buffer */ @@ -1185,7 +1175,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) init.callback_hdata = &weechat_ruby_hdata_cb; init.callback_infolist = &weechat_ruby_infolist_cb; init.callback_signal_debug_dump = &weechat_ruby_signal_debug_dump_cb; - init.callback_signal_debug_libs = &weechat_ruby_signal_debug_libs_cb; init.callback_signal_script_action = &weechat_ruby_signal_script_action_cb; init.callback_load_file = &weechat_ruby_load_cb; |