mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 07:16:37 +02:00
Merge branch 'secured-data'
This commit is contained in:
@@ -945,8 +945,7 @@ gui_color_buffer_display ()
|
||||
}
|
||||
|
||||
/* display palette colors */
|
||||
if (hashtable_get_integer (gui_color_hash_palette_color,
|
||||
"items_count") > 0)
|
||||
if (gui_color_hash_palette_color->items_count > 0)
|
||||
{
|
||||
y++;
|
||||
gui_chat_printf_y (gui_color_buffer, y++,
|
||||
|
||||
@@ -63,6 +63,63 @@ int gui_term_cols = 0;
|
||||
int gui_term_lines = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Gets a password from user (called on startup, when GUI is not initialized).
|
||||
*
|
||||
* The result is stored in "password" with max "size" bytes (including the
|
||||
* final '\0').
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_get_password (const char *prompt1, const char *prompt2,
|
||||
const char *prompt3,
|
||||
char *password, int size)
|
||||
{
|
||||
int i, ch;
|
||||
|
||||
initscr ();
|
||||
cbreak ();
|
||||
noecho ();
|
||||
|
||||
clear();
|
||||
|
||||
mvprintw (0, 0, "%s", prompt1);
|
||||
mvprintw (1, 0, "%s", prompt2);
|
||||
mvprintw (2, 0, "%s", prompt3);
|
||||
mvprintw (3, 0, "=> ");
|
||||
refresh ();
|
||||
|
||||
memset (password, '\0', size);
|
||||
i = 0;
|
||||
while (i < size - 1)
|
||||
{
|
||||
ch = getch ();
|
||||
if (ch == '\n')
|
||||
break;
|
||||
if (ch == 127)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
i--;
|
||||
password[i] = '\0';
|
||||
mvprintw (3, 3 + i, " ");
|
||||
move (3, 3 + i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
password[i] = ch;
|
||||
mvprintw (3, 3 + i, "*");
|
||||
i++;
|
||||
}
|
||||
refresh ();
|
||||
}
|
||||
password[i] = '\0';
|
||||
|
||||
refresh ();
|
||||
endwin ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Pre-initializes GUI (called before gui_init).
|
||||
*/
|
||||
|
||||
@@ -1125,6 +1125,7 @@ gui_key_focus_command (const char *key, int context,
|
||||
else
|
||||
{
|
||||
command = string_replace_with_callback (commands[i],
|
||||
"${", "}",
|
||||
&gui_key_focus_command_replace_cb,
|
||||
hashtable,
|
||||
&errors);
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
/* main functions (GUI dependent) */
|
||||
|
||||
extern void gui_main_get_password (const char *prompt1, const char *prompt2,
|
||||
const char *prompt3,
|
||||
char *password, int size);
|
||||
extern void gui_main_loop ();
|
||||
extern void gui_main_pre_init (int *argc, char **argv[]);
|
||||
extern void gui_main_init ();
|
||||
|
||||
Reference in New Issue
Block a user