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/guile/weechat-guile.c | |
parent | d7122cd6be8095d31a93e30e361ff1bcb31811bc (diff) | |
download | weechat-c4626bc08ab972625cd8ada2a05cfc3b8436a63c.zip |
scripts: add option "version" in script commands (closes #1075)
Diffstat (limited to 'src/plugins/guile/weechat-guile.c')
-rw-r--r-- | src/plugins/guile/weechat-guile.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index 9e202c2b1..1519b84cc 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -629,6 +629,10 @@ weechat_guile_command_cb (const void *pointer, void *data, { weechat_guile_unload_all (); } + else if (weechat_strcasecmp (argv[1], "version") == 0) + { + plugin_script_display_interpreter (weechat_guile_plugin, 0); + } else WEECHAT_COMMAND_ERROR; } @@ -786,35 +790,6 @@ weechat_guile_signal_debug_dump_cb (const void *pointer, void *data, } /* - * Display infos about external libraries used. - */ - -int -weechat_guile_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; - -#if defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION) - weechat_printf (NULL, " %s: %d.%d.%d", - GUILE_PLUGIN_NAME, - SCM_MAJOR_VERSION, - SCM_MINOR_VERSION, - SCM_MICRO_VERSION); -#else - weechat_printf (NULL, " %s: (?)", GUILE_PLUGIN_NAME); -#endif /* defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION) */ - - return WEECHAT_RC_OK; -} - -/* * Timer for executing actions. */ @@ -964,9 +939,27 @@ int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; + char str_version[128]; weechat_guile_plugin = plugin; + /* set interpreter name and version */ + weechat_hashtable_set (plugin->variables, "interpreter_name", + plugin->name); +#if defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION) + snprintf (str_version, sizeof (str_version), + "%d.%d.%d", + SCM_MAJOR_VERSION, + SCM_MINOR_VERSION, + SCM_MICRO_VERSION); + weechat_hashtable_set (plugin->variables, "interpreter_version", + str_version); +#else + (void) str_version; + weechat_hashtable_set (plugin->variables, "interpreter_version", + ""); +#endif /* defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION) */ + guile_stdout = NULL; #ifdef HAVE_GUILE_GMP_MEMORY_FUNCTIONS @@ -991,7 +984,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) init.callback_hdata = &weechat_guile_hdata_cb; init.callback_infolist = &weechat_guile_infolist_cb; init.callback_signal_debug_dump = &weechat_guile_signal_debug_dump_cb; - init.callback_signal_debug_libs = &weechat_guile_signal_debug_libs_cb; init.callback_signal_script_action = &weechat_guile_signal_script_action_cb; init.callback_load_file = &weechat_guile_load_cb; |