diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index 9b3b4e4..2f6a0cf 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -32,6 +32,7 @@ #include "weechat.h" #include "wee-upgrade.h" +#include "wee-hook.h" #include "wee-infolist.h" #include "wee-string.h" #include "wee-util.h" @@ -628,14 +629,19 @@ upgrade_weechat_remove_file_cb (void *data, const char *filename) } /* - * upgrade_weechat_remove_files: remove *.upgrade files after upgrade + * upgrade_weechat_end: remove *.upgrade files after upgrade and send signal + * "weechat_upgrade_done" */ void -upgrade_weechat_remove_files () +upgrade_weechat_end () { util_exec_on_files (weechat_home, 0, NULL, &upgrade_weechat_remove_file_cb); + + weechat_upgrading = 0; + + hook_signal_send ("upgrade_done", WEECHAT_HOOK_SIGNAL_STRING, NULL); } diff --git a/src/core/wee-upgrade.h b/src/core/wee-upgrade.h index 3c96779..df40d00 100644 --- a/src/core/wee-upgrade.h +++ b/src/core/wee-upgrade.h @@ -38,6 +38,6 @@ enum t_upgrade_weechat_type int upgrade_weechat_save (); int upgrade_weechat_load (); -void upgrade_weechat_remove_files (); +void upgrade_weechat_end (); #endif /* __WEECHAT_UPGRADE_H */ diff --git a/src/core/weechat.c b/src/core/weechat.c index 8d60ba4..474f304 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -420,8 +420,7 @@ main (int argc, char *argv[]) command_startup (1); /* command executed after plugins */ gui_layout_window_apply (gui_layout_windows, -1); /* apply saved layout */ if (weechat_upgrading) - upgrade_weechat_remove_files ();/* remove .upgrade files */ - weechat_upgrading = 0; + upgrade_weechat_end (); /* remove .upgrade files + signal */ gui_main_loop (); /* WeeChat main loop */ diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 9163120..2c6554f 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -322,6 +322,11 @@ plugin_api_info_get_internal (void *data, const char *info_name, { return WEECHAT_WEBSITE_DOWNLOAD; } + else if (string_strcasecmp (info_name, "weechat_upgrading") == 0) + { + snprintf (value, sizeof (value), "%d", weechat_upgrading); + return value; + } else if (string_strcasecmp (info_name, "charset_terminal") == 0) { return weechat_local_charset; @@ -957,6 +962,8 @@ plugin_api_init () &plugin_api_info_get_internal, NULL); hook_info (NULL, "weechat_site_download", N_("WeeChat site, download page"), NULL, &plugin_api_info_get_internal, NULL); + hook_info (NULL, "weechat_upgrading", N_("1 if WeeChat is upgrading"), NULL, + &plugin_api_info_get_internal, NULL); hook_info (NULL, "charset_terminal", N_("terminal charset"), NULL, &plugin_api_info_get_internal, NULL); hook_info (NULL, "charset_internal", N_("WeeChat internal charset"), NULL,