Package: irssi-plugin-xmpp / 0.54-3

singpolyma-0018-Option-to-use-gpg-agent.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
From d6b046d0c1b2e92d3db2f1847214ef3d0132d758 Mon Sep 17 00:00:00 2001
From: Stephen Paul Weber <singpolyma@singpolyma.net>
Date: Sun, 24 Apr 2011 16:40:57 -0500
Subject: [PATCH 18/18] Option to use gpg-agent

---
 src/core/tools.c        | 10 ++++++++--
 src/core/xmpp-servers.c |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

--- a/src/core/tools.c
+++ b/src/core/tools.c
@@ -43,7 +43,8 @@
 	char buf[100], buf2[100] = "";
 	const char *keyid = settings_get_str("xmpp_pgp");
 
-	if(keyid) { /* If no keyID, then we don't need a password */
+	/* If no keyID, then we don't need a password */
+	if(keyid && !settings_get_str("xmpp_pgp_agent")) {
 		if(pipe(pipefd)) goto pgp_error;
 		if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:");
 		if(!pgp_passwd) goto pgp_error;
@@ -66,7 +67,12 @@
 	              +strlen(switches)+8+ \
 	              (tmp2_path ? strlen(tmp2_path) : 0));
 	if(keyid) {
-		sprintf(cmd, "gpg -u '%s' --passphrase-fd '%d' ", keyid, pipefd[0]);
+		strcpy(cmd, "gpg -u '");
+		strcat(cmd, keyid);
+		strcat(cmd, "' ");
+		if(!settings_get_str("xmpp_pgp_agent")) {
+			sprintf(cmd+strlen(cmd), "--passphrase-fd '%d' ", pipefd[0]);
+		}
 	} else {
 		strcpy(cmd, "gpg ");
 	}
--- a/src/core/xmpp-servers.c
+++ b/src/core/xmpp-servers.c
@@ -617,6 +617,7 @@
 	settings_add_int("xmpp", "xmpp_priority", 0);
 	settings_add_int("xmpp", "xmpp_priority_away", -1);
 	settings_add_str("xmpp", "xmpp_pgp", NULL);
+	settings_add_str("xmpp", "xmpp_pgp_agent", NULL);
 	settings_add_bool("xmpp_lookandfeel", "xmpp_set_nick_as_username",
 	    FALSE);
 	settings_add_bool("xmpp_proxy", "xmpp_use_proxy", FALSE);