diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-command.c | 1 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-main.c | 11 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 2 | ||||
-rw-r--r-- | src/plugins/plugin.c | 20 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua.c | 16 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl.c | 18 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 16 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby.c | 16 | ||||
-rw-r--r-- | src/plugins/scripts/script.c | 24 | ||||
-rw-r--r-- | src/plugins/scripts/script.h | 3 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl.c | 15 |
11 files changed, 102 insertions, 40 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 395f9c263..319ce8b74 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -3471,6 +3471,7 @@ command_upgrade (void *data, struct t_gui_buffer *buffer, exec_args[3] = strdup (weechat_home); weechat_quit = 1; + weechat_upgrading = 1; /* save layout, unload plugins, save config, then upgrade */ gui_layout_save_on_exit (); diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 44ba81ec5..46511ad87 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -349,6 +349,17 @@ gui_main_end (int clean_exit) { if (clean_exit) { + /* + * final refreshs, to see messages just before exiting + * (if we are upgrading, don't refresh anything!) + */ + if (!weechat_upgrading) + { + gui_main_refreshs (); + if (gui_window_refresh_needed) + gui_main_refreshs (); + } + /* remove bar items and bars */ gui_bar_item_end (); gui_bar_free_all (); diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 3da7322bc..b1a08fdef 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1659,7 +1659,7 @@ gui_buffer_close (struct t_gui_buffer *buffer) ptr_window = ptr_window->next_window) { if (ptr_window->buffer == buffer) - ptr_window->buffer = NULL; + ptr_window->buffer = gui_buffers; } hook_signal_send ("buffer_closed", diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 5abf0eb88..6bd6d420b 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -840,9 +840,12 @@ plugin_unload (struct t_weechat_plugin *plugin) plugin_remove (plugin); - gui_chat_printf (NULL, - _("Plugin \"%s\" unloaded"), - (name) ? name : "???"); + if ((weechat_debug_core >= 1) || !plugin_quiet) + { + gui_chat_printf (NULL, + _("Plugin \"%s\" unloaded"), + (name) ? name : "???"); + } if (name) free (name); } @@ -875,10 +878,21 @@ plugin_unload_name (const char *name) void plugin_unload_all () { + int plugins_loaded; + + plugins_loaded = (weechat_plugins) ? 1 : 0; + + plugin_quiet = 1; while (weechat_plugins) { plugin_unload (last_weechat_plugin); } + plugin_quiet = 0; + + if (plugins_loaded) + { + gui_chat_printf (NULL, _("Plugins unloaded")); + } } /* diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index f8c6469cf..1f69f36b7 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -305,9 +305,12 @@ weechat_lua_unload (struct t_plugin_script *script) char *lua_argv[1] = { NULL }; void *interpreter; - weechat_printf (NULL, - weechat_gettext ("%s: unloading script \"%s\""), - LUA_PLUGIN_NAME, script->name); + if ((weechat_lua_plugin->debug >= 1) || !lua_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: unloading script \"%s\""), + LUA_PLUGIN_NAME, script->name); + } if (script->shutdown_func && script->shutdown_func[0]) { @@ -676,11 +679,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) int weechat_plugin_end (struct t_weechat_plugin *plugin) { - /* make C compiler happy */ - (void) plugin; - /* unload all scripts */ - weechat_lua_unload_all (); + lua_quiet = 1; + script_end (plugin, &lua_scripts, &weechat_lua_unload_all); + lua_quiet = 0; return WEECHAT_RC_OK; } diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 212b07cee..447d4717e 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -432,10 +432,13 @@ weechat_perl_unload (struct t_plugin_script *script) int *r; char *perl_argv[1] = { NULL }; void *interpreter; - - weechat_printf (NULL, - weechat_gettext ("%s: unloading script \"%s\""), - PERL_PLUGIN_NAME, script->name); + + if ((weechat_perl_plugin->debug >= 1) || !perl_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: unloading script \"%s\""), + PERL_PLUGIN_NAME, script->name); + } #ifdef MULTIPLICITY PERL_SET_CONTEXT (script->interpreter); @@ -871,11 +874,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) int weechat_plugin_end (struct t_weechat_plugin *plugin) { - /* make C compiler happy */ - (void) plugin; - /* unload all scripts */ - weechat_perl_unload_all (); + perl_quiet = 1; + script_end (plugin, &perl_scripts, &weechat_perl_unload_all); + perl_quiet = 0; #ifndef MULTIPLICITY /* free perl intepreter */ diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index e406de6b7..55e1be01e 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -537,9 +537,12 @@ weechat_python_unload (struct t_plugin_script *script) void *interpreter; PyThreadState *old_interpreter; - weechat_printf (NULL, - weechat_gettext ("%s: unloading script \"%s\""), - PYTHON_PLUGIN_NAME, script->name); + if ((weechat_python_plugin->debug >= 1) || !python_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: unloading script \"%s\""), + PYTHON_PLUGIN_NAME, script->name); + } if (script->shutdown_func && script->shutdown_func[0]) { @@ -943,11 +946,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) int weechat_plugin_end (struct t_weechat_plugin *plugin) { - /* make C compiler happy */ - (void) plugin; - /* unload all scripts */ - weechat_python_unload_all (); + python_quiet = 1; + script_end (plugin, &python_scripts, &weechat_python_unload_all); + python_quiet = 0; /* free Python interpreter */ if (python_mainThreadState != NULL) diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index fe4a1181a..9355dc8e8 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -592,9 +592,12 @@ weechat_ruby_unload (struct t_plugin_script *script) char *ruby_argv[1] = { NULL }; void *interpreter; - weechat_printf (NULL, - weechat_gettext ("%s: unloading script \"%s\""), - RUBY_PLUGIN_NAME, script->name); + if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: unloading script \"%s\""), + RUBY_PLUGIN_NAME, script->name); + } if (script->shutdown_func && script->shutdown_func[0]) { @@ -1063,11 +1066,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) int weechat_plugin_end (struct t_weechat_plugin *plugin) { - /* make C compiler happy */ - (void) plugin; - /* unload all scripts */ - weechat_ruby_unload_all (); + ruby_quiet = 1; + script_end (plugin, &ruby_scripts, &weechat_ruby_unload_all); + ruby_quiet = 0; ruby_cleanup (0); diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c index 1afaa40b7..52658650b 100644 --- a/src/plugins/scripts/script.c +++ b/src/plugins/scripts/script.c @@ -172,7 +172,7 @@ script_upgrade_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin, } /* - * script_init: initialize script + * script_init: initialize script plugin */ void @@ -1239,6 +1239,28 @@ script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin, } /* + * script_end: end script plugin + */ + +void +script_end (struct t_weechat_plugin *weechat_plugin, + struct t_plugin_script **scripts, + void (*callback_unload_all)()) +{ + int scripts_loaded; + + scripts_loaded = (*scripts) ? 1 : 0; + + (void)(callback_unload_all) (); + + if (scripts_loaded) + { + weechat_printf (NULL, _("%s: scripts unloaded"), + weechat_plugin->name); + } +} + +/* * script_print_log: print script infos in log (usually for crash dump) */ diff --git a/src/plugins/scripts/script.h b/src/plugins/scripts/script.h index 58a20e74c..702cb0f79 100644 --- a/src/plugins/scripts/script.h +++ b/src/plugins/scripts/script.h @@ -143,6 +143,9 @@ extern struct t_infolist *script_infolist_list_scripts (struct t_weechat_plugin struct t_plugin_script *scripts, void *pointer, const char *arguments); +extern void script_end (struct t_weechat_plugin *weechat_plugin, + struct t_plugin_script **scripts, + void (*callback_unload_all)()); extern void script_print_log (struct t_weechat_plugin *weechat_plugin, struct t_plugin_script *scripts); diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c index 4a5a05666..cd2216b68 100644 --- a/src/plugins/scripts/tcl/weechat-tcl.c +++ b/src/plugins/scripts/tcl/weechat-tcl.c @@ -240,9 +240,12 @@ weechat_tcl_unload (struct t_plugin_script *script) Tcl_Interp* interp; void *pointer; - weechat_printf (NULL, - weechat_gettext ("%s: unloading script \"%s\""), - TCL_PLUGIN_NAME, script->name); + if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet) + { + weechat_printf (NULL, + weechat_gettext ("%s: unloading script \"%s\""), + TCL_PLUGIN_NAME, script->name); + } if (script->shutdown_func && script->shutdown_func[0]) { @@ -611,10 +614,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) int weechat_plugin_end (struct t_weechat_plugin *plugin) { - (void) plugin; - /* unload all scripts */ - weechat_tcl_unload_all (); + tcl_quiet = 1; + script_end (plugin, &tcl_scripts, &weechat_tcl_unload_all); + tcl_quiet = 0; return WEECHAT_RC_OK; } |