diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 866f844cb..fdda32e4b 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -19,6 +19,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] === New features +* core: allow ctrl-C to exit WeeChat when the passphrase is asked on startup + (closes #452) * core: allow pointer as list name in evaluation of hdata (closes #450) * core: add signal "signal_sighup" * api: add function string_eval_path_home() diff --git a/po/cs.po b/po/cs.po index 7a7f94dff..f05fa88e7 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -3949,6 +3949,9 @@ msgid "" "secured data!)" msgstr "" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/de.po b/po/de.po index 6f1c1dfba..f14e885fe 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-06-26 23:27+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German <>\n" @@ -4691,6 +4691,9 @@ msgstr "" "(um diese Abfrage zu überspringen, bitte ein Leerzeichen eingeben. Dies " "DEAKTIVIERT die Nutzung der schutzwürdigen Daten!)" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/es.po b/po/es.po index 11feaee78..bcfe3f994 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -4168,6 +4168,9 @@ msgid "" "secured data!)" msgstr "" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/fr.po b/po/fr.po index 9c04842d5..963d744e9 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" -"PO-Revision-Date: 2015-06-27 16:50+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" +"PO-Revision-Date: 2015-06-28 09:11+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -4583,6 +4583,9 @@ msgstr "" "(entrez juste un espace pour sauter la phrase de chiffrement, mais cela " "DÉSACTIVERA toutes les données sécurisées !)" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "(appuyez sur ctrl-C pour quitter WeeChat maintenant)" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/hu.po b/po/hu.po index e33e30a4e..2dea762e1 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3569,6 +3569,9 @@ msgid "" "secured data!)" msgstr "" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/it.po b/po/it.po index ef5ff2ced..7b9a6e0ee 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -4291,6 +4291,9 @@ msgstr "" "(inserire uno spazio per ignorare la chiave di cifratura, ma ciò DISABILITA " "tutti i dati messi al sicuro!)" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/ja.po b/po/ja.po index b12c2ba57..9e8ed2dda 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-06-21 22:54+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -4385,6 +4385,9 @@ msgstr "" "(パスフレーズの入力をスキップするにはスペースをひとつだけ入力してください、こ" "れにより全てのデータが安全ではなくなります!)" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/pl.po b/po/pl.po index 97f16b02a..bea2ea637 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-05-09 14:00+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -4488,6 +4488,9 @@ msgstr "" "(wprowadź tylko jedną spację, aby pominąć hasło, poskutkuje to BRAKIEM " "DOSTĘPU do wszystkich zabezpieczonych danych!)" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index d8e5dbfee..abade822f 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -4159,6 +4159,9 @@ msgid "" "secured data!)" msgstr "" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/ru.po b/po/ru.po index 216fc6d0a..56a461c7c 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -3596,6 +3596,9 @@ msgid "" "secured data!)" msgstr "" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/tr.po b/po/tr.po index 4185883b5..19d464424 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2015-03-10 21:33+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -3212,6 +3212,9 @@ msgid "" "secured data!)" msgstr "" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index e916c34e7..a05dd7857 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-06-27 16:44+0200\n" +"POT-Creation-Date: 2015-06-28 09:11+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -3207,6 +3207,9 @@ msgid "" "secured data!)" msgstr "" +msgid "(press ctrl-C to exit WeeChat now)" +msgstr "" + msgid "" "To recover your secured data, you can use /secure decrypt (see /help secure)" msgstr "" diff --git a/src/core/wee-secure.c b/src/core/wee-secure.c index 4ba69a83c..226fe6e0b 100644 --- a/src/core/wee-secure.c +++ b/src/core/wee-secure.c @@ -566,16 +566,20 @@ secure_decrypt_data_not_decrypted (const char *passphrase) void secure_get_passphrase_from_user (const char *error) { + const char *prompt[5]; char passphrase[1024]; + prompt[0] = _("Please enter your passphrase to decrypt the data secured " + "by WeeChat:"); + prompt[1] = _("(enter just one space to skip the passphrase, but this " + "will DISABLE all secured data!)"); + prompt[2] = _("(press ctrl-C to exit WeeChat now)"); + prompt[3] = error; + prompt[4] = NULL; + while (1) { - gui_main_get_password (_("Please enter your passphrase to decrypt the " - "data secured by WeeChat:"), - _("(enter just one space to skip the passphrase, " - "but this will DISABLE all secured data!)"), - error, - passphrase, sizeof (passphrase)); + gui_main_get_password (prompt, passphrase, sizeof (passphrase)); if (secure_passphrase) { free (secure_passphrase); @@ -590,6 +594,11 @@ secure_get_passphrase_from_user (const char *error) _("To recover your secured data, you can " "use /secure decrypt (see /help secure)")); } + else if (strcmp (passphrase, "\x03") == 0) + { + /* ctrl-C pressed, just exit now */ + exit (1); + } else secure_passphrase = strdup (passphrase); return; diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index e01fa20bf..f83d8324a 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -74,22 +74,26 @@ int gui_term_lines = 0; /* number of lines in terminal */ */ void -gui_main_get_password (const char *prompt1, const char *prompt2, - const char *prompt3, - char *password, int size) +gui_main_get_password (const char **prompt, char *password, int size) { - int i, ch; + int line, i, ch; initscr (); cbreak (); noecho (); + raw (); clear(); - mvaddstr (0, 0, prompt1); - mvaddstr (1, 0, prompt2); - mvaddstr (2, 0, prompt3); - mvaddstr (3, 0, "=> "); + line = 0; + + while (prompt[line]) + { + mvaddstr (line, 0, prompt[line]); + line++; + } + + mvaddstr (line, 0, "=> "); refresh (); memset (password, '\0', size); @@ -97,22 +101,30 @@ gui_main_get_password (const char *prompt1, const char *prompt2, while (i < size - 1) { ch = getch (); + /* enter */ if (ch == '\n') break; + /* ctrl-C */ + if (ch == 3) + { + password[0] = 3; + i = 1; + break; + } if (ch == 127) { if (i > 0) { i--; password[i] = '\0'; - mvaddstr (3, 3 + i, " "); - move (3, 3 + i); + mvaddstr (line, 3 + i, " "); + move (line, 3 + i); } } else { password[i] = ch; - mvaddstr (3, 3 + i, "*"); + mvaddstr (line, 3 + i, "*"); i++; } refresh (); diff --git a/src/gui/gui-main.h b/src/gui/gui-main.h index 926eee1da..251f8b7dc 100644 --- a/src/gui/gui-main.h +++ b/src/gui/gui-main.h @@ -22,8 +22,7 @@ /* main functions (GUI dependent) */ -extern void gui_main_get_password (const char *prompt1, const char *prompt2, - const char *prompt3, +extern void gui_main_get_password (const char **prompt, char *password, int size); extern void gui_main_debug_libs (); extern void gui_main_end (int clean_exit);