1
From a1c765a2cb08f49d31c70e5e6fbfba4190eb126e Mon Sep 17 00:00:00 2001
2
From: Stephen Paul Weber <singpolyma@singpolyma.net>
3
Date: Thu, 21 Apr 2011 00:10:40 -0500
4
Subject: [PATCH 02/18] Generalize get_password
6
So that we can use it to get other passwords as well.
8
src/core/xmpp-servers.c | 10 +++++-----
9
src/core/xmpp-servers.h | 5 +++--
10
2 files changed, 8 insertions(+), 7 deletions(-)
12
--- a/src/core/xmpp-servers.c
13
+++ b/src/core/xmpp-servers.c
15
* Displays input prompt on command line and takes input data from user
16
* From irssi-silc (silc-client/lib/silcutil/silcutil.c)
21
+get_password(char *prompt)
23
char input[2048], *ret = NULL;
27
tcsetattr(fd, TCSANOW, &to);
29
- printf("\tXMPP Password: ");
30
+ printf("\n\n%s", prompt);
33
memset(input, 0, sizeof(input));
35
ret = g_strdup(input);
36
memset(input, 0, sizeof(input));
37
#endif /* DISABLE_TERMIOS */
38
+ signal_emit("send command", 1, "redraw");
43
|| *(server->connrec->password) == '\0'
44
|| *(server->connrec->password) == '\r') {
45
g_free_not_null(server->connrec->password);
46
- server->connrec->prompted_password = get_password();
47
- signal_emit("send command", 1, "redraw");
48
+ server->connrec->prompted_password = get_password("XMPP Password: ");
49
if (server->connrec->prompted_password != NULL)
50
server->connrec->password =
51
g_strdup(server->connrec->prompted_password);
52
--- a/src/core/xmpp-servers.h
53
+++ b/src/core/xmpp-servers.h
55
SERVER_REC *xmpp_server_init_connect(SERVER_CONNECT_REC *);
56
void xmpp_server_connect(XMPP_SERVER_REC *);
58
-void xmpp_servers_init(void);
59
-void xmpp_servers_deinit(void);
60
+void xmpp_servers_init(void);
61
+void xmpp_servers_deinit(void);
62
+char *get_password(char *prompt);