~ubuntu-branches/ubuntu/trusty/irssi-plugin-xmpp/trusty

« back to all changes in this revision

Viewing changes to debian/patches/singpolyma-0002-Generalize-get_password.patch

  • Committer: Package Import Robot
  • Author(s): Florian Schlichting, Florian Schlichting
  • Date: 2014-01-03 00:25:20 UTC
  • mfrom: (2.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20140103002520-4ztm9phbq47vn4bl
Tags: 0.52+git20140102-1
[ Florian Schlichting ]
* Import Upstream version 0.52+git20140102
* Add VCS-* fields for collab-maint on alioth
* Add upstream git URL to Source field in debian/copyright
* Drop patches plucked from upstream CVS
* Refresh hardening.patch (offset, drop hunk fixed upstream)
* Provide xmpp-admin.pl script by Seth Difley
* Add GTalk-MUC-support.patch, plucked from github/freemandrew
* Add support for XMPP-PGP, plucked from github/singpolyma
* New useless-dependency-on-libidn.patch, to fix a lintian warning
* Declare compliance with Debian Policy 3.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
 
 
6
So that we can use it to get other passwords as well.
 
7
---
 
8
 src/core/xmpp-servers.c | 10 +++++-----
 
9
 src/core/xmpp-servers.h |  5 +++--
 
10
 2 files changed, 8 insertions(+), 7 deletions(-)
 
11
 
 
12
--- a/src/core/xmpp-servers.c
 
13
+++ b/src/core/xmpp-servers.c
 
14
@@ -261,8 +261,8 @@
 
15
  * Displays input prompt on command line and takes input data from user
 
16
  * From irssi-silc (silc-client/lib/silcutil/silcutil.c)
 
17
  */
 
18
-static char *
 
19
-get_password()
 
20
+char *
 
21
+get_password(char *prompt)
 
22
 {
 
23
        char input[2048], *ret = NULL;
 
24
        int fd;
 
25
@@ -287,7 +287,7 @@
 
26
        to.c_cc[VMIN] = 255;
 
27
        tcsetattr(fd, TCSANOW, &to);
 
28
 
 
29
-       printf("\tXMPP Password: ");
 
30
+       printf("\n\n%s", prompt);
 
31
        fflush(stdout);
 
32
 
 
33
        memset(input, 0, sizeof(input));
 
34
@@ -311,6 +311,7 @@
 
35
        ret = g_strdup(input);
 
36
        memset(input, 0, sizeof(input));
 
37
 #endif /* DISABLE_TERMIOS */
 
38
+       signal_emit("send command", 1, "redraw");
 
39
        return ret;
 
40
 }
 
41
 
 
42
@@ -350,8 +351,7 @@
 
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
 
54
@@ -58,8 +58,9 @@
 
55
 SERVER_REC     *xmpp_server_init_connect(SERVER_CONNECT_REC *);
 
56
 void            xmpp_server_connect(XMPP_SERVER_REC *);
 
57
 
 
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);
 
63
 __END_DECLS
 
64
 
 
65
 #endif