diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-08-21 18:57:49 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-08-21 18:57:49 +0200 |
commit | 129f32ce8ed0fb6d8b37ed945455144bd83ce95a (patch) | |
tree | 2c3d13d11fdf260df5a1949884eb4fc3061ccaf4 /src/plugins/python | |
parent | cc5118b3b6726d8fc8bf087eea59e474a838896b (diff) | |
download | weechat-129f32ce8ed0fb6d8b37ed945455144bd83ce95a.zip |
script: add option script.look.quiet_actions (no messages when installing/removing/loading/unloading scripts on script buffer)
Diffstat (limited to 'src/plugins/python')
-rw-r--r-- | src/plugins/python/weechat-python.c | 72 |
1 files changed, 48 insertions, 24 deletions
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index d237df29d..a3218dbfd 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -825,9 +825,12 @@ weechat_python_unload_name (const char *name) if (ptr_script) { weechat_python_unload (ptr_script); - weechat_printf (NULL, - weechat_gettext ("%s: script \"%s\" unloaded"), - PYTHON_PLUGIN_NAME, name); + if (!python_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: script \"%s\" unloaded"), + PYTHON_PLUGIN_NAME, name); + } } else { @@ -867,9 +870,12 @@ weechat_python_reload_name (const char *name) if (filename) { weechat_python_unload (ptr_script); - weechat_printf (NULL, - weechat_gettext ("%s: script \"%s\" unloaded"), - PYTHON_PLUGIN_NAME, name); + if (!python_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: script \"%s\" unloaded"), + PYTHON_PLUGIN_NAME, name); + } weechat_python_load (filename); free (filename); } @@ -890,7 +896,7 @@ int weechat_python_command_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - char *path_script; + char *ptr_name, *path_script; /* make C compiler happy */ (void) data; @@ -939,24 +945,40 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer, plugin_script_display_list (weechat_python_plugin, python_scripts, argv_eol[2], 1); } - else if (weechat_strcasecmp (argv[1], "load") == 0) - { - /* load Python script */ - path_script = plugin_script_search_path (weechat_python_plugin, - argv_eol[2]); - weechat_python_load ((path_script) ? path_script : argv_eol[2]); - if (path_script) - free (path_script); - } - else if (weechat_strcasecmp (argv[1], "reload") == 0) - { - /* reload one Python script */ - weechat_python_reload_name (argv_eol[2]); - } - else if (weechat_strcasecmp (argv[1], "unload") == 0) + else if ((weechat_strcasecmp (argv[1], "load") == 0) + || (weechat_strcasecmp (argv[1], "reload") == 0) + || (weechat_strcasecmp (argv[1], "unload") == 0)) { - /* unload Python script */ - weechat_python_unload_name (argv_eol[2]); + ptr_name = argv_eol[2]; + if (strncmp (ptr_name, "-q ", 3) == 0) + { + python_quiet = 1; + ptr_name += 3; + while (ptr_name[0] == ' ') + { + ptr_name++; + } + } + if (weechat_strcasecmp (argv[1], "load") == 0) + { + /* load Python script */ + path_script = plugin_script_search_path (weechat_python_plugin, + ptr_name); + weechat_python_load ((path_script) ? path_script : ptr_name); + if (path_script) + free (path_script); + } + else if (weechat_strcasecmp (argv[1], "reload") == 0) + { + /* reload one Python script */ + weechat_python_reload_name (ptr_name); + } + else if (weechat_strcasecmp (argv[1], "unload") == 0) + { + /* unload Python script */ + weechat_python_unload_name (ptr_name); + } + python_quiet = 0; } else { @@ -1123,6 +1145,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls) python_scripts, &weechat_python_unload, &weechat_python_load, + &python_quiet, &python_action_install_list); } else if (data == &python_action_remove_list) @@ -1130,6 +1153,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls) plugin_script_action_remove (weechat_python_plugin, python_scripts, &weechat_python_unload, + &python_quiet, &python_action_remove_list); } } |