/*
* PGP/Core keyring autocompletion
*
- * Copyright (C) 2014 Christian Hesse <mail@eworm.de>
+ * Copyright (C) 2014 Christian Hesse <mail@eworm.de> and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#include "claws-features.h"
+#endif
+
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <gpgme.h>
#include "autocompletion.h"
+#include "addr_compl.h"
+#include "prefs_gpg.h"
+#include "hooks.h"
+#include "utils.h"
static guint autocompletion_hook_id = 0;
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)
/* 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) {
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);
+ gpgme_key_unref(key);
}
gpgme_release(ctx);
}