From d6b046d0c1b2e92d3db2f1847214ef3d0132d758 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber 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 @@ -630,6 +630,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);