diff mcabber/src/jabglue.c @ 1065:230dca34dbea

Extand pgp_data structure Extand pgp_data structure so that we can disbale PGP per contact and compare the signature key with a reference key id.
author Mikael Berthe <mikael@lilotux.net>
date Sat, 02 Dec 2006 11:13:40 +0100
parents c0d44a9a99bc
children a5dc85fdebde
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Fri Dec 01 23:50:52 2006 +0100
+++ b/mcabber/src/jabglue.c	Sat Dec 02 11:13:40 2006 +0100
@@ -539,7 +539,6 @@
   rname = strchr(fjid, JID_RESOURCE_SEPARATOR);
   barejid = jidtodisp(fjid);
   sl_buddy = roster_find(barejid, jidsearch, ROSTER_TYPE_USER);
-  g_free(barejid);
 
   // If we can get a resource name, we use it.  Else we use NULL,
   // which hopefully will give us the most likely resource.
@@ -549,12 +548,17 @@
 
 #ifdef HAVE_GPGME
   if (type == ROSTER_TYPE_USER && sl_buddy && gpg_enabled()) {
-    struct pgp_data *res_pgpdata;
-    res_pgpdata = buddy_resource_pgp(sl_buddy->data, rname);
-    if (res_pgpdata && res_pgpdata->sign_keyid)
-      enc = gpg_encrypt(text, res_pgpdata->sign_keyid);
+    if (!settings_pgp_getdisabled(barejid)) { // disabled for this contact?
+      struct pgp_data *res_pgpdata;
+      res_pgpdata = buddy_resource_pgp(sl_buddy->data, rname);
+      if (res_pgpdata && res_pgpdata->sign_keyid)
+        enc = gpg_encrypt(text, res_pgpdata->sign_keyid);
+    }
   }
 #endif
+#if defined HAVE_GPGME || defined JEP0022 || defined JEP0085
+  g_free(barejid);
+#endif
 
   x = jutil_msgnew(strtype, (char*)fjid, NULL,
                    (enc ? "This message is PGP-encrypted." : (char*)text));