seahorse r2709 - in trunk: . pgp



Author: sadam
Date: Fri Jan 23 03:00:40 2009
New Revision: 2709
URL: http://svn.gnome.org/viewvc/seahorse?rev=2709&view=rev

Log:
2009-01-22  Adam Schreiber  <sadam clemson edu>

    * pgp/seahorse-hkp-source.c: Prepend "0x" onto hex keyid search 
terms that
    need it.


Modified:
   trunk/ChangeLog
   trunk/pgp/seahorse-hkp-source.c

Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c	(original)
+++ trunk/pgp/seahorse-hkp-source.c	Fri Jan 23 03:00:40 2009
@@ -771,6 +771,25 @@
 
 }
 
+static gboolean
+is_hex_keyid (const gchar *match)
+{
+    const gchar *t;
+    
+    t = match;
+    
+    if (strlen (match) != 8)
+        return FALSE;
+    
+    while (*t != NULL) {
+        if (!((*t >= 0x30 && *t <= 0x39) || (*t >= 0x41 && *t <= 0x46) || (*t >= 0x61 && *t <= 0x66)))
+            return FALSE;
+            
+        t++;
+    }
+    
+    return TRUE;
+}
 
 static SeahorseOperation*
 seahorse_hkp_source_search (SeahorseSource *src, const gchar *match)
@@ -780,6 +799,7 @@
     GHashTable *form;
     gchar *t;
     SoupURI *uri;
+    gchar hexfpr[11];
     
     g_assert (SEAHORSE_IS_SOURCE (src));
     g_assert (SEAHORSE_IS_HKP_SOURCE (src));
@@ -791,7 +811,15 @@
     
     form = g_hash_table_new (g_str_hash, g_str_equal);
     g_hash_table_insert (form, "op", "index");
-    g_hash_table_insert (form, "search", (char *)match);
+    
+    if (is_hex_keyid (match)) {
+        strncpy (hexfpr, "0x", 3);
+        strncpy (hexfpr + 2, match, 9);
+        
+        g_hash_table_insert (form, "search", hexfpr);
+    } else 
+        g_hash_table_insert (form, "search", (char *)match);
+        
     soup_uri_set_query_from_form (uri, form);
     g_hash_table_destroy (form);
     



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