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/guile | |
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/guile')
-rw-r--r-- | src/plugins/guile/weechat-guile.c | 72 |
1 files changed, 48 insertions, 24 deletions
diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index 93d84a24c..7dbd5ce4b 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -489,9 +489,12 @@ weechat_guile_unload_name (const char *name) if (ptr_script) { weechat_guile_unload (ptr_script); - weechat_printf (NULL, - weechat_gettext ("%s: script \"%s\" unloaded"), - GUILE_PLUGIN_NAME, name); + if (!guile_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: script \"%s\" unloaded"), + GUILE_PLUGIN_NAME, name); + } } else { @@ -531,9 +534,12 @@ weechat_guile_reload_name (const char *name) if (filename) { weechat_guile_unload (ptr_script); - weechat_printf (NULL, - weechat_gettext ("%s: script \"%s\" unloaded"), - GUILE_PLUGIN_NAME, name); + if (!guile_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: script \"%s\" unloaded"), + GUILE_PLUGIN_NAME, name); + } weechat_guile_load (filename); free (filename); } @@ -554,7 +560,7 @@ int weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - char *path_script; + char *ptr_name, *path_script; SCM value; /* make C compiler happy */ @@ -604,24 +610,40 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer, plugin_script_display_list (weechat_guile_plugin, guile_scripts, argv_eol[2], 1); } - else if (weechat_strcasecmp (argv[1], "load") == 0) + else if ((weechat_strcasecmp (argv[1], "load") == 0) + || (weechat_strcasecmp (argv[1], "reload") == 0) + || (weechat_strcasecmp (argv[1], "unload") == 0)) { - /* load Guile script */ - path_script = plugin_script_search_path (weechat_guile_plugin, - argv_eol[2]); - weechat_guile_load ((path_script) ? path_script : argv_eol[2]); - if (path_script) - free (path_script); - } - else if (weechat_strcasecmp (argv[1], "reload") == 0) - { - /* reload one Guile script */ - weechat_guile_reload_name (argv_eol[2]); - } - else if (weechat_strcasecmp (argv[1], "unload") == 0) - { - /* unload Guile script */ - weechat_guile_unload_name (argv_eol[2]); + ptr_name = argv_eol[2]; + if (strncmp (ptr_name, "-q ", 3) == 0) + { + guile_quiet = 1; + ptr_name += 3; + while (ptr_name[0] == ' ') + { + ptr_name++; + } + } + if (weechat_strcasecmp (argv[1], "load") == 0) + { + /* load Guile script */ + path_script = plugin_script_search_path (weechat_guile_plugin, + ptr_name); + weechat_guile_load ((path_script) ? path_script : ptr_name); + if (path_script) + free (path_script); + } + else if (weechat_strcasecmp (argv[1], "reload") == 0) + { + /* reload one Guile script */ + weechat_guile_reload_name (ptr_name); + } + else if (weechat_strcasecmp (argv[1], "unload") == 0) + { + /* unload Guile script */ + weechat_guile_unload_name (ptr_name); + } + guile_quiet = 0; } else if (weechat_strcasecmp (argv[1], "eval") == 0) { @@ -767,6 +789,7 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls) guile_scripts, &weechat_guile_unload, &weechat_guile_load, + &guile_quiet, &guile_action_install_list); } else if (data == &guile_action_remove_list) @@ -774,6 +797,7 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls) plugin_script_action_remove (weechat_guile_plugin, guile_scripts, &weechat_guile_unload, + &guile_quiet, &guile_action_remove_list); } } |