[Commits] [SCM] claws branch, master, updated. 3.12.0-75-g1207b10

mones at claws-mail.org mones at claws-mail.org
Tue Sep 8 02:43:17 CEST 2015


The branch, master has been updated
       via  1207b105a41e9584406b7faab4cbe75cf9bf9534 (commit)
      from  71b8625f5daf4ea32b4b1beff6fb044d48a7b31b (commit)

Summary of changes:
 src/plugins/pgpcore/autocompletion.c |    8 ++++++++
 src/plugins/pgpcore/prefs_gpg.c      |    3 +++
 src/plugins/pgpcore/prefs_gpg.h      |    1 +
 3 files changed, 12 insertions(+)


- Log -----------------------------------------------------------------
commit 1207b105a41e9584406b7faab4cbe75cf9bf9534
Author: Christian Hesse <mail at eworm.de>
Date:   Mon Sep 7 20:24:01 2015 +0200

    Hidden preference to limit PGP autocompletion
    
    Some keys have a lot of UIDs, resulting in a huge dropdown list. This
    allows to limit PGP autocompletion to use the first n UID/address of a
    key only.

diff --git a/src/plugins/pgpcore/autocompletion.c b/src/plugins/pgpcore/autocompletion.c
index 2355bd8..286f241 100644
--- a/src/plugins/pgpcore/autocompletion.c
+++ b/src/plugins/pgpcore/autocompletion.c
@@ -49,6 +49,7 @@ static gboolean pgp_autocompletion_hook(gpointer source, gpointer data)
 	gpgme_user_id_t uid;
 	address_entry *ae;
 	GList *addr_list = NULL;
+	gint i;
 
 	/* just return if autocompletion is disabled */
 	if (!prefs_gpg_get_config()->autocompletion)
@@ -68,6 +69,7 @@ static gboolean pgp_autocompletion_hook(gpointer source, gpointer data)
 			/* skip keys that are revoked, expired, ... */
 			if ((key->revoked || key->expired || key->disabled || key->invalid) == FALSE) {
 				uid = key->uids;
+				i = 0;
 
 				/* walk all user ids within a key */
 				while (uid != NULL) {
@@ -89,7 +91,13 @@ static gboolean pgp_autocompletion_hook(gpointer source, gpointer data)
 
 						debug_print("%s <%s>\n", uid->name, uid->email);
 					}
+
+					if (prefs_gpg_get_config()->autocompletion_limit > 0 &&
+							prefs_gpg_get_config()->autocompletion_limit == i)
+						break;
+
 					uid = uid->next;
+					i++;
 				}
 			}
 			gpgme_key_release(key);
diff --git a/src/plugins/pgpcore/prefs_gpg.c b/src/plugins/pgpcore/prefs_gpg.c
index 80522d1..eb543a3 100644
--- a/src/plugins/pgpcore/prefs_gpg.c
+++ b/src/plugins/pgpcore/prefs_gpg.c
@@ -47,6 +47,9 @@ static PrefParam param[] = {
 	{"autocompletion", "FALSE",
 	 &prefs_gpg.autocompletion, P_BOOL,
 	 NULL, NULL, NULL},
+	{"autocompletion_limit", "0",
+	 &prefs_gpg.autocompletion_limit, P_INT,
+	 NULL, NULL, NULL},
 	{"use_gpg_agent", "TRUE", &prefs_gpg.use_gpg_agent, P_BOOL,
 	 NULL, NULL, NULL},
 	{"store_passphrase", "FALSE", &prefs_gpg.store_passphrase, P_BOOL,
diff --git a/src/plugins/pgpcore/prefs_gpg.h b/src/plugins/pgpcore/prefs_gpg.h
index 28dec3f..3eb9c34 100644
--- a/src/plugins/pgpcore/prefs_gpg.h
+++ b/src/plugins/pgpcore/prefs_gpg.h
@@ -35,6 +35,7 @@ struct GPGConfig
 {
 	gboolean	 auto_check_signatures;
 	gboolean	 autocompletion;
+	gint		 autocompletion_limit;
 	gboolean	 use_gpg_agent;
 	gboolean	 store_passphrase;
 	gint		 store_passphrase_timeout;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list