diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-02-25 08:46:41 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-02-25 08:46:41 +0100 |
commit | b60aec975ba13d347edd3a110cbfef7699bc3cfb (patch) | |
tree | 99945fce576fe848714bdeb9486f6fdbab974c2d /src/plugins/python/weechat-python.c | |
parent | 87b50969722b894bebe791211b232da5ffd82082 (diff) | |
download | weechat-b60aec975ba13d347edd3a110cbfef7699bc3cfb.zip |
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).
Diffstat (limited to 'src/plugins/python/weechat-python.c')
-rw-r--r-- | src/plugins/python/weechat-python.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index f5f6fde23..72304b4a7 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -86,7 +86,7 @@ static struct PyModuleDef moduleDefOutputs = { /* * string used to execute action "install": - * when signal "python_install_script" is received, name of string + * when signal "python_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) */ @@ -94,12 +94,20 @@ char *python_action_install_list = NULL; /* * string used to execute action "remove": - * when signal "python_remove_script" is received, name of string + * when signal "python_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 *python_action_remove_list = NULL; +/* + * string used to execute action "autoload": + * when signal "python_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 *python_action_autoload_list = NULL; + char python_buffer_output[128]; @@ -1167,13 +1175,20 @@ weechat_python_timer_action_cb (void *data, int remaining_calls) &python_quiet, &python_action_remove_list); } + else if (data == &python_action_autoload_list) + { + plugin_script_action_autoload (weechat_python_plugin, + &python_quiet, + &python_action_autoload_list); + } } return WEECHAT_RC_OK; } /* - * Callback called when a script action is asked (install/remove a script). + * Callback called when a script action is asked (install/remove/autoload a + * script). */ int @@ -1202,6 +1217,14 @@ weechat_python_signal_script_action_cb (void *data, const char *signal, &weechat_python_timer_action_cb, &python_action_remove_list); } + else if (strcmp (signal, "python_script_autoload") == 0) + { + plugin_script_action_add (&python_action_autoload_list, + (const char *)signal_data); + weechat_hook_timer (1, 0, 1, + &weechat_python_timer_action_cb, + &python_action_autoload_list); + } } return WEECHAT_RC_OK; @@ -1314,6 +1337,8 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) free (python_action_install_list); if (python_action_remove_list) free (python_action_remove_list); + if (python_action_autoload_list) + free (python_action_autoload_list); return WEECHAT_RC_OK; } |