mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 11:25:42 +02:00
New arguments for function "register" in scripts (author, license), with optional check of license when script is loaded
This commit is contained in:
@@ -2419,7 +2419,7 @@ weechat_lua_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
"Unloading Lua script \"%s\"",
|
||||
script->name);
|
||||
|
||||
if (script->shutdown_func[0])
|
||||
if (script->shutdow_func && script->shutdown_func[0])
|
||||
{
|
||||
r = weechat_lua_exec (plugin, script, SCRIPT_EXEC_INT,
|
||||
script->shutdown_func, NULL, NULL, NULL);
|
||||
@@ -2712,6 +2712,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
plugin->mkdir_home (plugin, "lua");
|
||||
plugin->mkdir_home (plugin, "lua/autoload");
|
||||
|
||||
script_init (weechat_lua_plugin);
|
||||
weechat_script_auto_load (plugin, "lua", weechat_lua_load);
|
||||
|
||||
/* init ok */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2377,7 +2377,7 @@ weechat_python_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
"Unloading Python script \"%s\"",
|
||||
script->name);
|
||||
|
||||
if (script->shutdown_func[0])
|
||||
if (script->shutdown_func && script->shutdown_func[0])
|
||||
{
|
||||
r = (int *) weechat_python_exec (plugin, script, SCRIPT_EXEC_INT,
|
||||
script->shutdown_func, NULL, NULL, NULL);
|
||||
@@ -2694,7 +2694,8 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
|
||||
plugin->mkdir_home (plugin, "python");
|
||||
plugin->mkdir_home (plugin, "python/autoload");
|
||||
|
||||
|
||||
script_init (weechat_python_plugin);
|
||||
weechat_script_auto_load (plugin, "python", weechat_python_load);
|
||||
|
||||
/* init ok */
|
||||
|
||||
@@ -2273,7 +2273,7 @@ weechat_ruby_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
"Unloading Ruby script \"%s\"",
|
||||
script->name);
|
||||
|
||||
if (script->shutdown_func[0])
|
||||
if (script->shutdown_func && script->shutdown_func[0])
|
||||
{
|
||||
r = (int *) weechat_ruby_exec (plugin, script, SCRIPT_EXEC_INT,
|
||||
script->shutdown_func, NULL, NULL, NULL);
|
||||
@@ -2675,7 +2675,8 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
"Ruby error: %s", STR2CSTR(ruby_error_info));
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
|
||||
script_init (weechat_ruby_plugin);
|
||||
weechat_script_auto_load (plugin, "ruby", weechat_ruby_load);
|
||||
|
||||
/* init ok */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,17 +23,19 @@
|
||||
#define WEECHAT_SCRIPT_EXEC_INT 1
|
||||
#define WEECHAT_SCRIPT_EXEC_STRING 2
|
||||
|
||||
#define WEECHAT_SCRIPT_MSG_NOT_INITIALIZED(__language, __function) \
|
||||
#define WEECHAT_SCRIPT_MSG_NOT_INITIALIZED(__function) \
|
||||
weechat_printf (NULL, \
|
||||
weechat_gettext("%s%s: unable to call function " \
|
||||
"\"%s\", script is not " \
|
||||
"initialized"), \
|
||||
weechat_prefix ("error"), __language, __function)
|
||||
#define WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS(__language, __function) \
|
||||
weechat_prefix ("error"), weechat_plugin->name, \
|
||||
__function)
|
||||
#define WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS(__function) \
|
||||
weechat_printf (NULL, \
|
||||
weechat_gettext("%s%s: wrong arguments for " \
|
||||
"function \"%s\""), \
|
||||
weechat_prefix ("error"), __language, __function)
|
||||
weechat_prefix ("error"), weechat_plugin->name, \
|
||||
__function)
|
||||
|
||||
struct t_plugin_script
|
||||
{
|
||||
@@ -41,8 +43,10 @@ struct t_plugin_script
|
||||
char *filename; /* name of script on disk */
|
||||
void *interpreter; /* interpreter for script */
|
||||
char *name; /* script name */
|
||||
char *description; /* plugin description */
|
||||
char *author; /* author name/mail */
|
||||
char *version; /* plugin version */
|
||||
char *license; /* script license */
|
||||
char *description; /* plugin description */
|
||||
char *shutdown_func; /* function when script is unloaded*/
|
||||
char *charset; /* script charset */
|
||||
|
||||
@@ -52,6 +56,7 @@ struct t_plugin_script
|
||||
struct t_plugin_script *next_script; /* link to next script */
|
||||
};
|
||||
|
||||
extern void script_init (struct t_weechat_plugin *weechat_plugin);
|
||||
extern char *script_pointer_to_string (void *pointer);
|
||||
extern void *script_string_to_pointer (char *pointer_str);
|
||||
extern void script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
@@ -65,8 +70,8 @@ extern char *script_search_full_name (struct t_weechat_plugin *weechat_plugin,
|
||||
extern struct t_plugin_script *script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **script_list,
|
||||
char *filename, char *name,
|
||||
char *version,
|
||||
char *shutdown_func,
|
||||
char *author, char *version,
|
||||
char *license, char *shutdown_func,
|
||||
char *description,
|
||||
char *charset);
|
||||
extern void script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
|
||||
Reference in New Issue
Block a user