changeset 1238:80008fe2a4f2

Re-enable gpg-agent (revert 591d8b35c881) Some people were actually using it... :)
author Mikael Berthe <mikael@lilotux.net>
date Sat, 16 Jun 2007 12:30:43 +0200
parents dcb99f0b5aaa
children eb9fc5d6d085
files mcabber/src/main.c mcabber/src/pgp.c
diffstat 2 files changed, 5 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/main.c	Sat Jun 16 12:28:27 2007 +0200
+++ b/mcabber/src/main.c	Sat Jun 16 12:30:43 2007 +0200
@@ -247,13 +247,12 @@
 #ifdef HAVE_GPGME
   const char *pk, *pp;
   char *typed_passwd = NULL;
+  char *p;
   bool pgp_invalid = FALSE;
   bool pgp_agent;
-  //char *p;
 
-  //p = getenv("GPG_AGENT_INFO");
-  //pgp_agent = (p && strchr(p, ':'));
-  pgp_agent = FALSE;
+  p = getenv("GPG_AGENT_INFO");
+  pgp_agent = (p && strchr(p, ':'));
 
   pk = settings_opt_get("pgp_private_key");
   pp = settings_opt_get("pgp_passphrase");
--- a/mcabber/src/pgp.c	Sat Jun 16 12:28:27 2007 +0200
+++ b/mcabber/src/pgp.c	Sat Jun 16 12:30:43 2007 +0200
@@ -253,11 +253,11 @@
 {
   gpgme_ctx_t ctx;
   gpgme_data_t in, out;
+  char *p;
   char *signed_data = NULL;
   size_t nread;
   gpgme_key_t key;
   gpgme_error_t err;
-  //char *p;
 
   if (!gpg.enabled || !gpg.private_key)
     return NULL;
@@ -273,12 +273,9 @@
   gpgme_set_textmode(ctx, 0);
   gpgme_set_armor(ctx, 1);
 
-  /*
   p = getenv("GPG_AGENT_INFO");
   if (!(p && strchr(p, ':')))
     gpgme_set_passphrase_cb(ctx, passphrase_cb, 0);
-  */
-  gpgme_set_passphrase_cb(ctx, passphrase_cb, 0);
 
   err = gpgme_get_key(ctx, gpg.private_key, &key, 1);
   if (err || !key) {
@@ -324,13 +321,12 @@
 {
   gpgme_ctx_t ctx;
   gpgme_data_t in, out;
-  char *data;
+  char *p, *data;
   char *decrypted_data = NULL;
   size_t nread;
   gpgme_error_t err;
   const char prefix[] = "-----BEGIN PGP MESSAGE-----\n\n";
   const char suffix[] = "\n-----END PGP MESSAGE-----\n";
-  //char *p;
 
   if (!gpg.enabled)
     return NULL;
@@ -344,12 +340,9 @@
 
   gpgme_set_protocol(ctx, GPGME_PROTOCOL_OpenPGP);
 
-  /*
   p = getenv("GPG_AGENT_INFO");
   if (!(p && strchr(p, ':')))
     gpgme_set_passphrase_cb(ctx, passphrase_cb, 0);
-  */
-  gpgme_set_passphrase_cb(ctx, passphrase_cb, 0);
 
   // Surround the given data with the prefix & suffix
   data = g_new(char, sizeof(prefix) + sizeof(suffix) + strlen(gpg_data));