1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 04:46:37 +02:00

scripts: add option "version" in script commands (closes #1075)

This commit is contained in:
Sébastien Helleu
2017-12-23 20:32:03 +01:00
parent d7122cd6be
commit c4626bc08a
72 changed files with 702 additions and 612 deletions
+15 -26
View File
@@ -668,6 +668,10 @@ weechat_lua_command_cb (const void *pointer, void *data,
{
weechat_lua_unload_all ();
}
else if (weechat_strcasecmp (argv[1], "version") == 0)
{
plugin_script_display_interpreter (weechat_lua_plugin, 0);
}
else
WEECHAT_COMMAND_ERROR;
}
@@ -813,31 +817,6 @@ weechat_lua_signal_debug_dump_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
/*
* Display infos about external libraries used.
*/
int
weechat_lua_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 LUA_VERSION
weechat_printf (NULL, " %s: %s", LUA_PLUGIN_NAME, LUA_VERSION);
#else
weechat_printf (NULL, " %s: (?)", LUA_PLUGIN_NAME);
#endif /* LUA_VERSION */
return WEECHAT_RC_OK;
}
/*
* Timer for executing actions.
*/
@@ -936,12 +915,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_lua_plugin = plugin;
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
#ifdef LUA_VERSION
weechat_hashtable_set (plugin->variables, "interpreter_version",
LUA_VERSION);
#else
weechat_hashtable_set (plugin->variables, "interpreter_version",
"");
#endif /* LUA_VERSION */
init.callback_command = &weechat_lua_command_cb;
init.callback_completion = &weechat_lua_completion_cb;
init.callback_hdata = &weechat_lua_hdata_cb;
init.callback_infolist = &weechat_lua_infolist_cb;
init.callback_signal_debug_dump = &weechat_lua_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_lua_signal_debug_libs_cb;
init.callback_signal_script_action = &weechat_lua_signal_script_action_cb;
init.callback_load_file = &weechat_lua_load_cb;