diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | doc/de/autogen/plugin_api/infos.txt | 2 | ||||
-rw-r--r-- | doc/en/autogen/plugin_api/infos.txt | 2 | ||||
-rw-r--r-- | doc/en/weechat_plugin_api.en.txt | 3 | ||||
-rw-r--r-- | doc/fr/autogen/plugin_api/infos.txt | 2 | ||||
-rw-r--r-- | doc/fr/weechat_plugin_api.fr.txt | 3 | ||||
-rw-r--r-- | doc/it/autogen/plugin_api/infos.txt | 2 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.txt | 4 | ||||
-rw-r--r-- | po/cs.po | 10 | ||||
-rw-r--r-- | po/de.po | 10 | ||||
-rw-r--r-- | po/es.po | 10 | ||||
-rw-r--r-- | po/fr.po | 18 | ||||
-rw-r--r-- | po/hu.po | 10 | ||||
-rw-r--r-- | po/it.po | 14 | ||||
-rw-r--r-- | po/pl.po | 10 | ||||
-rw-r--r-- | po/pt_BR.po | 10 | ||||
-rw-r--r-- | po/ru.po | 10 | ||||
-rw-r--r-- | po/weechat.pot | 10 | ||||
-rw-r--r-- | src/core/wee-command.c | 14 | ||||
-rw-r--r-- | src/core/wee-upgrade.c | 30 | ||||
-rw-r--r-- | src/core/wee-upgrade.h | 2 | ||||
-rw-r--r-- | src/core/weechat.c | 33 | ||||
-rw-r--r-- | src/core/weechat.h | 3 | ||||
-rw-r--r-- | src/plugins/plugin-api.c | 7 |
24 files changed, 180 insertions, 43 deletions
@@ -1,12 +1,14 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.4-rc2, 2010-12-20 +v0.3.4-rc2, 2010-12-26 Version 0.3.4 (under dev!) -------------------------- +* core: add info "weechat_upgrading", signal "upgrade_ended", display duration + of upgrade * core: add 256 colors support, new section "palette" in weechat.conf (task #6834) * core: replace the 10 nick color options and number of nick colors by a single diff --git a/doc/de/autogen/plugin_api/infos.txt b/doc/de/autogen/plugin_api/infos.txt index 3ca5bae80..f3ad18d2e 100644 --- a/doc/de/autogen/plugin_api/infos.txt +++ b/doc/de/autogen/plugin_api/infos.txt @@ -52,4 +52,6 @@ | weechat | weechat_site_download | Download-Seite von WeeChat | - +| weechat | weechat_upgrading | 1 if WeeChat is upgrading (command `/upgrade`) | - + |======================================== diff --git a/doc/en/autogen/plugin_api/infos.txt b/doc/en/autogen/plugin_api/infos.txt index db75a89d5..708a570f1 100644 --- a/doc/en/autogen/plugin_api/infos.txt +++ b/doc/en/autogen/plugin_api/infos.txt @@ -52,4 +52,6 @@ | weechat | weechat_site_download | WeeChat site, download page | - +| weechat | weechat_upgrading | 1 if WeeChat is upgrading (command `/upgrade`) | - + |======================================== diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index 27535032b..bc4e754f0 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -6775,6 +6775,9 @@ Arguments: | weechat | upgrade | - | command `/upgrade` issued by user +| weechat | upgrade_ended | - | + end of upgrade process (command `/upgrade`) + | weechat | weechat_highlight | string: message with prefix | highlight happened diff --git a/doc/fr/autogen/plugin_api/infos.txt b/doc/fr/autogen/plugin_api/infos.txt index a51dbcb36..4f277aef9 100644 --- a/doc/fr/autogen/plugin_api/infos.txt +++ b/doc/fr/autogen/plugin_api/infos.txt @@ -52,4 +52,6 @@ | weechat | weechat_site_download | site WeeChat, page de téléchargement | - +| weechat | weechat_upgrading | 1 si WeeChat est en cours de mise à jour (commande `/upgrade`) | - + |======================================== diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index 9f65d2f5e..817ae52d2 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -6862,6 +6862,9 @@ Paramètres : | weechat | upgrade | - | la commande `/upgrade` a été exécutée par l'utilisateur +| weechat | upgrade_ended | - | + fin du processus de mise à jour (commande `/upgrade`) + | weechat | weechat_highlight | chaîne : message avec le préfixe | un highlight est survenu diff --git a/doc/it/autogen/plugin_api/infos.txt b/doc/it/autogen/plugin_api/infos.txt index e55a391e8..66013eb43 100644 --- a/doc/it/autogen/plugin_api/infos.txt +++ b/doc/it/autogen/plugin_api/infos.txt @@ -52,4 +52,6 @@ | weechat | weechat_site_download | sito di WeeChat, pagina di download | - +| weechat | weechat_upgrading | 1 if WeeChat is upgrading (command `/upgrade`) | - + |======================================== diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index bbe7bc113..d7a2ccdde 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -6793,6 +6793,10 @@ Argomenti: | weechat | upgrade | - | comando `/upgrade` digitato dall'utente +// TRANSLATION MISSING +| weechat | upgrade_ended | - | + end of upgrade process (command `/upgrade`) + | weechat | weechat_highlight | string: messaggio con prefisso | evento accaduto @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-11-06 11:55+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2442,6 +2442,11 @@ msgstr "bajt" msgid "debug: removing file: %s" msgstr "ladění: odstraňuji soubor: %s" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%sChyba aktualizace WeeChat se souborem \"%s\"" @@ -5986,6 +5991,9 @@ msgstr "stránka WeeChat" msgid "WeeChat site, download page" msgstr "stránka WeeChat, stránka pro stažení" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + msgid "terminal charset" msgstr "znaková sada terminálu" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.3-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-24 11:54+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-12-21 17:42+0100\n" "Last-Translator: Nils G.\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2559,6 +2559,11 @@ msgstr "Byte" msgid "debug: removing file: %s" msgstr "debug: lösche Datei: %s" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%sFehler bei der Aktualisierung von WeeChat, mit der Datei \"%s\":" @@ -6255,6 +6260,9 @@ msgstr "WeeChat Seite" msgid "WeeChat site, download page" msgstr "Download-Seite von WeeChat" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + msgid "terminal charset" msgstr "Terminal Zeichensatz" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-11-06 11:56+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2474,6 +2474,11 @@ msgstr "byte" msgid "debug: removing file: %s" msgstr "depurado: removiendo el archivo: %s" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%sError al actualizar WeeChat con el archivo \"%s\":" @@ -6059,6 +6064,9 @@ msgstr "sitio web de WeeChat" msgid "WeeChat site, download page" msgstr "sitio web de WeeChat, página de descarga" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + msgid "terminal charset" msgstr "set de caracteres de la terminal" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" -"PO-Revision-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" +"PO-Revision-Date: 2010-12-26 11:51+0100\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: French\n" @@ -1796,7 +1796,11 @@ msgid "" "color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b " "is redefinition of color (terminal must support it) (everything is optional " "in this format and order is not important)" -msgstr "couleur personnalisée dans la palette, le format est: \"alias;fg,bg;r/g/b\" où alias est le nom de la couleur, fg,bg est \"texte,fond\" (par exemple: \"200,-1\"), r/g/b est la redéfinition de la couleur (le terminal doit le supporter) (tout est optionnel dans ce format et l'ordre n'est pas important)" +msgstr "" +"couleur personnalisée dans la palette, le format est: \"alias;fg,bg;r/g/b\" " +"où alias est le nom de la couleur, fg,bg est \"texte,fond\" (par exemple: " +"\"200,-1\"), r/g/b est la redéfinition de la couleur (le terminal doit le " +"supporter) (tout est optionnel dans ce format et l'ordre n'est pas important)" #, c-format msgid "%sError: palette option must be numeric" @@ -2514,6 +2518,11 @@ msgstr "octet" msgid "debug: removing file: %s" msgstr "debug: suppression du fichier: %s" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "Mise à jour terminée (%.02f %s)" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%sErreur de mise à jour de WeeChat avec le fichier \"%s\":" @@ -6138,6 +6147,9 @@ msgstr "site WeeChat" msgid "WeeChat site, download page" msgstr "site WeeChat, page de téléchargement" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "1 si WeeChat est en cours de mise à jour (commande `/upgrade`)" + msgid "terminal charset" msgstr "charset du terminal" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-11-05 17:17+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2265,6 +2265,11 @@ msgstr "byte" msgid "debug: removing file: %s" msgstr " IRC(%s)\n" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, fuzzy, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "WeeChat frissítése...\n" @@ -5685,6 +5690,9 @@ msgstr "WeeChat szlogen" msgid "WeeChat site, download page" msgstr "" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + #, fuzzy msgid "terminal charset" msgstr "pufferek kezelése" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-12-22 11:02+0100\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1791,8 +1791,8 @@ msgstr "" "colore personalizzato nella tavolozza, il formato è \"alias;fg,bg;r/g/b\" " "dove l'alias è il nome del colore, fg,bg sono \"colore di primo piano,colore " "di sfondo (esempio: \"200,-1\"), r/g/b la nuova definizone del colore (il " -"terminale deve supportarla) (tutto è opzionale in questo formato e non importa " -"l'ordine)" +"terminale deve supportarla) (tutto è opzionale in questo formato e non " +"importa l'ordine)" #, c-format msgid "%sError: palette option must be numeric" @@ -2492,6 +2492,11 @@ msgstr "byte" msgid "debug: removing file: %s" msgstr "debug: rimozione del file: %s" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%sErrore durante l'aggiornamento di WeeChat con il file \"%s\"" @@ -6105,6 +6110,9 @@ msgstr "sito di WeeChat" msgid "WeeChat site, download page" msgstr "sito di WeeChat, pagina di download" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + msgid "terminal charset" msgstr "set caratteri terminale" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-11-06 11:56+0100\n" "Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2472,6 +2472,11 @@ msgstr "bajt" msgid "debug: removing file: %s" msgstr "debug: usuwam plik: %s" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%sBłąd przy uaktualnianiu WeeChat z użyciem pliku \"%s\":" @@ -6020,6 +6025,9 @@ msgstr "Strona WeeChat" msgid "WeeChat site, download page" msgstr "Strona pobrań WeeChat" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + msgid "terminal charset" msgstr "kodowanie terminala" diff --git a/po/pt_BR.po b/po/pt_BR.po index 79ebd103d..98fbd6fb2 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-11-13 09:26+0100\n" "Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1999,6 +1999,11 @@ msgstr "" msgid "debug: removing file: %s" msgstr "" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "" @@ -5026,6 +5031,9 @@ msgstr "" msgid "WeeChat site, download page" msgstr "" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + msgid "terminal charset" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: 2010-11-05 17:17+0100\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2281,6 +2281,11 @@ msgstr "байтов" msgid "debug: removing file: %s" msgstr " IRC(%s)\n" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, fuzzy, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "Обновляю WeeChat...\n" @@ -5700,6 +5705,9 @@ msgstr "слоган WeeChat" msgid "WeeChat site, download page" msgstr "" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + #, fuzzy msgid "terminal charset" msgstr "управление буферами" diff --git a/po/weechat.pot b/po/weechat.pot index b0abc16ad..bf96aa72d 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-12-21 09:22+0100\n" +"POT-Creation-Date: 2010-12-26 12:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -1938,6 +1938,11 @@ msgstr "" msgid "debug: removing file: %s" msgstr "" +#. TRANSLATORS: "%s" is translation of "second" or "seconds" +#, c-format +msgid "Upgrade done (%.02f %s)" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "" @@ -4962,6 +4967,9 @@ msgstr "" msgid "WeeChat site, download page" msgstr "" +msgid "1 if WeeChat is upgrading (command `/upgrade`)" +msgstr "" + msgid "terminal charset" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 95612d9a2..dd1d3c95b 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -3865,7 +3865,7 @@ command_uptime (void *data, struct t_gui_buffer *buffer, (void) data; (void) argv_eol; - running_time = time (NULL) - weechat_start_time; + running_time = time (NULL) - weechat_first_start_time; day = running_time / (60 * 60 * 24); hour = (running_time % (60 * 60 * 24)) / (60 * 60); min = ((running_time % (60 * 60 * 24)) % (60 * 60)) / 60; @@ -3880,7 +3880,7 @@ command_uptime (void *data, struct t_gui_buffer *buffer, hour, min, sec, - ctime (&weechat_start_time)); + ctime (&weechat_first_start_time)); string[strlen (string) - 1] = '\0'; input_data (buffer, string); } @@ -3894,7 +3894,7 @@ command_uptime (void *data, struct t_gui_buffer *buffer, hour, min, sec, - util_get_time_string (&weechat_start_time)); + util_get_time_string (&weechat_first_start_time)); input_data (buffer, string); } else @@ -3918,7 +3918,7 @@ command_uptime (void *data, struct t_gui_buffer *buffer, sec, GUI_COLOR(GUI_COLOR_CHAT), GUI_COLOR(GUI_COLOR_CHAT_BUFFER), - util_get_time_string (&weechat_start_time)); + util_get_time_string (&weechat_first_start_time)); } return WEECHAT_RC_OK; @@ -3953,7 +3953,7 @@ command_version_display (struct t_gui_buffer *buffer, weechat_upgrade_count, /* TRANSLATORS: text is: "upgraded xx times" */ NG_("time", "times", weechat_upgrade_count), - util_get_time_string (&weechat_start_time)); + util_get_time_string (&weechat_first_start_time)); input_data (buffer, string); } } @@ -3972,7 +3972,7 @@ command_version_display (struct t_gui_buffer *buffer, "Upgraded %d %s, first start: %s", weechat_upgrade_count, (weechat_upgrade_count > 1) ? "times" : "time", - ctime (&weechat_start_time)); + ctime (&weechat_first_start_time)); string[strlen (string) - 1] = '\0'; input_data (buffer, string); } @@ -3996,7 +3996,7 @@ command_version_display (struct t_gui_buffer *buffer, weechat_upgrade_count, /* TRANSLATORS: text is: "upgraded xx times" */ NG_("time", "times", weechat_upgrade_count), - util_get_time_string (&weechat_start_time)); + util_get_time_string (&weechat_first_start_time)); } } } diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index 9b3b4e461..c786c66f3 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -29,9 +29,11 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <sys/time.h> #include "weechat.h" #include "wee-upgrade.h" +#include "wee-hook.h" #include "wee-infolist.h" #include "wee-string.h" #include "wee-util.h" @@ -207,7 +209,7 @@ upgrade_weechat_save_uptime (struct t_upgrade_file *upgrade_file) infolist_free (ptr_infolist); return 0; } - if (!infolist_new_var_time (ptr_item, "start_time", weechat_start_time)) + if (!infolist_new_var_time (ptr_item, "start_time", weechat_first_start_time)) { infolist_free (ptr_infolist); return 0; @@ -539,7 +541,7 @@ upgrade_weechat_read_cb (void *data, } break; case UPGRADE_WEECHAT_TYPE_UPTIME: - weechat_start_time = infolist_time (infolist, "start_time"); + weechat_first_start_time = infolist_time (infolist, "start_time"); weechat_upgrade_count = infolist_integer (infolist, "upgrade_count"); break; case UPGRADE_WEECHAT_TYPE_HOTLIST: @@ -628,14 +630,34 @@ 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 () { + struct timeval tv_now; + long time_diff; + + /* remove .upgrade files */ util_exec_on_files (weechat_home, 0, NULL, &upgrade_weechat_remove_file_cb); + + /* display message for end of /upgrade with duration */ + gettimeofday (&tv_now, NULL); + time_diff = util_timeval_diff (&weechat_current_start_timeval, &tv_now); + gui_chat_printf (NULL, + /* TRANSLATORS: "%s" is translation of "second" or "seconds" */ + _("Upgrade done (%.02f %s)"), + ((float)time_diff) / 1000, + NG_("second", "seconds", time_diff / 1000)); + + /* upgrading ended */ + weechat_upgrading = 0; + + /* send signal for end of /upgrade */ + hook_signal_send ("upgrade_ended", WEECHAT_HOOK_SIGNAL_STRING, NULL); } diff --git a/src/core/wee-upgrade.h b/src/core/wee-upgrade.h index 3c96779b2..df40d0062 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 8d60ba4a0..0738a7288 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -45,6 +45,7 @@ #include <stdio.h> #include <string.h> #include <sys/stat.h> +#include <sys/time.h> #include <time.h> #include <signal.h> @@ -77,8 +78,10 @@ int weechat_debug_core = 0; /* debug level for core */ char *weechat_argv0 = NULL; /* WeeChat binary file name (argv[0])*/ int weechat_upgrading = 0; /* =1 if WeeChat is upgrading */ -time_t weechat_start_time = 0; /* start time (used by /uptime cmd) */ +time_t weechat_first_start_time = 0; /* start time (used by /uptime cmd) */ int weechat_upgrade_count = 0; /* number of /upgrade done */ +struct timeval weechat_current_start_timeval; /* start time used to display */ + /* duration of /upgrade */ int weechat_quit = 0; /* = 1 if quit request from user */ int weechat_sigsegv = 0; /* SIGSEGV received? */ char *weechat_home = NULL; /* home dir. (default: ~/.weechat) */ @@ -90,6 +93,17 @@ int weechat_plugin_no_dlclose = 0; /* remove calls to dlclose for libs */ /* + * weechat_init_vars: initialize some variables + */ + +void +weechat_init_vars () +{ + weechat_first_start_time = time (NULL); + gettimeofday (&weechat_current_start_timeval, NULL); +} + +/* * weechat_display_usage: display WeeChat usage */ @@ -300,17 +314,6 @@ weechat_create_home_dirs () } /* - * weechat_init_vars: initialize some variables - */ - -void -weechat_init_vars () -{ - /* start time, used by /uptime command */ - weechat_start_time = time (NULL); -} - -/* * weechat_welcome_message: display WeeChat welcome message - yeah! */ @@ -373,6 +376,8 @@ weechat_shutdown (int return_code, int crash) int main (int argc, char *argv[]) { + weechat_init_vars (); /* initialize some variables */ + setlocale (LC_ALL, ""); /* initialize gettext */ #ifdef ENABLE_NLS bindtextdomain (PACKAGE, LOCALEDIR); @@ -395,7 +400,6 @@ main (int argc, char *argv[]) hook_init (); /* initialize hooks */ debug_init (); /* hook signals for debug */ gui_main_pre_init (&argc, &argv); /* pre-initiliaze interface */ - weechat_init_vars (); /* initialize some variables */ command_init (); /* initialize WeeChat commands */ completion_init (); /* add core completion hooks */ gui_keyboard_init (); /* init keyboard */ @@ -420,8 +424,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/core/weechat.h b/src/core/weechat.h index 2328b377c..f7abe407e 100644 --- a/src/core/weechat.h +++ b/src/core/weechat.h @@ -103,7 +103,8 @@ extern int weechat_debug_core; extern char *weechat_argv0; extern int weechat_upgrading; -extern time_t weechat_start_time; +extern time_t weechat_first_start_time; +extern struct timeval weechat_current_start_timeval; extern int weechat_upgrade_count; extern int weechat_quit; extern char *weechat_home; diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 9163120c9..7297a8829 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 (command `/upgrade`)"), 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, |