mirror of
https://github.com/weechat/weechat.git
synced 2026-06-24 20:06:38 +02:00
script: add control of autoload (enable/disable/toggle) (task #12393)
New option script.scripts.autoload, new options autoload/noautoload/toggleautoload for command /script, new action "A" (meta-A) on script buffer (toggle autoload).
This commit is contained in:
@@ -71,7 +71,7 @@ const char *ruby_current_script_filename = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
* when signal "ruby_install_script" is received, name of string
|
||||
* when signal "ruby_script_install" is received, name of string
|
||||
* is added to this string, to be installed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
@@ -79,12 +79,20 @@ char *ruby_action_install_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "remove":
|
||||
* when signal "ruby_remove_script" is received, name of string
|
||||
* when signal "ruby_script_remove" is received, name of string
|
||||
* is added to this string, to be removed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
char *ruby_action_remove_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "autoload":
|
||||
* when signal "ruby_script_autoload" is received, name of string
|
||||
* is added to this string, to autoload or disable autoload later by a timer
|
||||
* (when nothing is running in script)
|
||||
*/
|
||||
char *ruby_action_autoload_list = NULL;
|
||||
|
||||
VALUE ruby_mWeechat, ruby_mWeechatOutputs;
|
||||
|
||||
#define MOD_NAME_PREFIX "WeechatRubyModule"
|
||||
@@ -987,6 +995,12 @@ weechat_ruby_timer_action_cb (void *data, int remaining_calls)
|
||||
&ruby_quiet,
|
||||
&ruby_action_remove_list);
|
||||
}
|
||||
else if (data == &ruby_action_autoload_list)
|
||||
{
|
||||
plugin_script_action_autoload (weechat_ruby_plugin,
|
||||
&ruby_quiet,
|
||||
&ruby_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1022,6 +1036,14 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
|
||||
&weechat_ruby_timer_action_cb,
|
||||
&ruby_action_remove_list);
|
||||
}
|
||||
else if (strcmp (signal, "ruby_script_autoload") == 0)
|
||||
{
|
||||
plugin_script_action_add (&ruby_action_autoload_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_ruby_timer_action_cb,
|
||||
&ruby_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1175,5 +1197,13 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
*/
|
||||
/*ruby_cleanup (0);*/
|
||||
|
||||
/* free some data */
|
||||
if (ruby_action_install_list)
|
||||
free (ruby_action_install_list);
|
||||
if (ruby_action_remove_list)
|
||||
free (ruby_action_remove_list);
|
||||
if (ruby_action_autoload_list)
|
||||
free (ruby_action_autoload_list);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user