Package: irssi-plugin-xmpp / 0.54-3

singpolyma-0002-Generalize-get_password.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From a1c765a2cb08f49d31c70e5e6fbfba4190eb126e Mon Sep 17 00:00:00 2001
From: Stephen Paul Weber <singpolyma@singpolyma.net>
Date: Thu, 21 Apr 2011 00:10:40 -0500
Subject: [PATCH 02/18] Generalize get_password

So that we can use it to get other passwords as well.
---
 src/core/xmpp-servers.c | 10 +++++-----
 src/core/xmpp-servers.h |  5 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)

--- a/src/core/xmpp-servers.c
+++ b/src/core/xmpp-servers.c
@@ -266,8 +266,8 @@
  * Displays input prompt on command line and takes input data from user
  * From irssi-silc (silc-client/lib/silcutil/silcutil.c)
  */
-static char *
-get_password()
+char *
+get_password(char *prompt)
 {
 	char input[2048], *ret = NULL;
 	int fd;
@@ -294,7 +294,7 @@
 	to.c_cc[VMIN] = 255;
 	tcsetattr(fd, TCSANOW, &to);
 
-	printf("\tXMPP Password: ");
+	printf("\n\n%s", prompt);
 	fflush(stdout);
 
 	memset(input, 0, sizeof(input));
@@ -318,6 +318,7 @@
 	ret = g_strdup(input);
 	memset(input, 0, sizeof(input));
 #endif /* DISABLE_TERMIOS */
+	signal_emit("send command", 1, "redraw");
 	return ret;
 }
 
@@ -357,8 +358,7 @@
 	    || *(server->connrec->password) == '\0'
 	    || *(server->connrec->password) == '\r') {
 		g_free_not_null(server->connrec->password);
-		server->connrec->prompted_password = get_password();
-		signal_emit("send command", 1, "redraw");
+		server->connrec->prompted_password = get_password("XMPP Password: ");
 		if (server->connrec->prompted_password != NULL)
 			server->connrec->password =
 			    g_strdup(server->connrec->prompted_password);
--- a/src/core/xmpp-servers.h
+++ b/src/core/xmpp-servers.h
@@ -58,8 +58,9 @@
 SERVER_REC	*xmpp_server_init_connect(SERVER_CONNECT_REC *);
 void		 xmpp_server_connect(XMPP_SERVER_REC *);
 
-void        	xmpp_servers_init(void);
-void		xmpp_servers_deinit(void);
+void xmpp_servers_init(void);
+void xmpp_servers_deinit(void);
+char *get_password(char *prompt);
 __END_DECLS
 
 #endif