[libcryptui] Avoid repeating the self encryption key in cryptui_key_chooser_get_recipients()



commit f110e1c8a2efa46c106b910b765a4a8728021dce
Author: Jérémy Bobbio <lunar debian org>
Date:   Thu May 16 12:06:30 2013 +0000

    Avoid repeating the self encryption key in cryptui_key_chooser_get_recipients()
    
    When using self encryption, cryptui_key_chooser_get_recipients() would
    previously always prepend the key to the recipient list. This is uneeded
    if the key is already in there.
    
    This change makes prompt_recipients() in seahorse-tool.c happier when
    selecting the key using for signing in the recipient list.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701987

 libcryptui/cryptui-key-chooser.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libcryptui/cryptui-key-chooser.c b/libcryptui/cryptui-key-chooser.c
index 96d808f..f45c181 100644
--- a/libcryptui/cryptui-key-chooser.c
+++ b/libcryptui/cryptui-key-chooser.c
@@ -568,9 +568,13 @@ cryptui_key_chooser_get_recipients (CryptUIKeyChooser *chooser)
         g_list_free (keys);
     }
 
-    if (!key)
+    if (!key) {
         g_warning ("Encrypt to self is set, but no personal keys can be found");
-    else
+        return recipients;
+    }
+
+    /* Only prepend the key if it's not already in the recipients. */
+    if (!g_list_find (recipients, key))
         recipients = g_list_prepend (recipients, (gpointer)key);
 
     return recipients;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]