2007-01-11 [paul] 2.7.0cvs8
authorColin Leroy <colin@colino.net>
Thu, 11 Jan 2007 16:36:17 +0000 (16:36 +0000)
committerColin Leroy <colin@colino.net>
Thu, 11 Jan 2007 16:36:17 +0000 (16:36 +0000)
* src/imap.c
Fix recursion when server lists the
current subfolder in the response
* src/mimeview.c
Fix updating of icon_list/ctree
* src/plugins/pgpcore/select-keys.c
Fix a few annoyances when choosing
keys for the CMS (S/MIME) protocol

ChangeLog
PATCHSETS
configure.ac
src/imap.c
src/mimeview.c
src/plugins/pgpcore/select-keys.c

index a3f4d8912760c65e066fa7b64198aa1bd7b95c5f..9932239f24a3e74fcf12d654b529d30b13f67581 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-01-11 [paul]      2.7.0cvs8
+
+       * src/imap.c
+               Fix recursion when server lists the
+               current subfolder in the response
+       * src/mimeview.c
+               Fix updating of icon_list/ctree
+       * src/plugins/pgpcore/select-keys.c
+               Fix a few annoyances when choosing
+               keys for the CMS (S/MIME) protocol
+
 2007-01-11 [wwp]       2.7.0cvs7
 
        * src/compose.c
 2007-01-11 [wwp]       2.7.0cvs7
 
        * src/compose.c
index 36eb4461f19509197fa5d095d11ccc37d6d592d5..fef44dd9b1ec3db3b7ef844cc95b32f614ff169f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.161 -r 1.274.2.162 src/mainwindow.c;  ) > 2.7.0cvs5.patchset
 ( cvs diff -u -r 1.52.2.34 -r 1.52.2.35 src/prefs_folder_item.c;  ) > 2.7.0cvs6.patchset
 ( cvs diff -u -r 1.382.2.349 -r 1.382.2.350 src/compose.c;  cvs diff -u -r 1.105.2.76 -r 1.105.2.77 src/prefs_account.c;  cvs diff -u -r 1.49.2.23 -r 1.49.2.24 src/prefs_account.h;  ) > 2.7.0cvs7.patchset
 ( cvs diff -u -r 1.274.2.161 -r 1.274.2.162 src/mainwindow.c;  ) > 2.7.0cvs5.patchset
 ( cvs diff -u -r 1.52.2.34 -r 1.52.2.35 src/prefs_folder_item.c;  ) > 2.7.0cvs6.patchset
 ( cvs diff -u -r 1.382.2.349 -r 1.382.2.350 src/compose.c;  cvs diff -u -r 1.105.2.76 -r 1.105.2.77 src/prefs_account.c;  cvs diff -u -r 1.49.2.23 -r 1.49.2.24 src/prefs_account.h;  ) > 2.7.0cvs7.patchset
+( cvs diff -u -r 1.179.2.146 -r 1.179.2.147 src/imap.c;  cvs diff -u -r 1.83.2.96 -r 1.83.2.97 src/mimeview.c;  cvs diff -u -r 1.1.2.14 -r 1.1.2.15 src/plugins/pgpcore/select-keys.c;  ) > 2.7.0cvs8.patchset
index f8a108f85afd1a3dbf63f85d745929d74d96462a..713df096db8821145dc500f8d03bdaed4567a290 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=7
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=7
+EXTRA_VERSION=8
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index e160aea53f088f8aae07800500584fddd0254b98..cea5bbf18fec9b65a1264dcc4e1b7b92c861231a 100644 (file)
@@ -4098,7 +4098,7 @@ static GSList * imap_list_from_lep(IMAPFolder * folder,
                        continue;
                }
                
                        continue;
                }
                
-               if (!all && strcmp(dup_name, real_path) == 0) {
+               if (!all && path_cmp(name, real_path) == 0) {
                        g_free(base);
                        free(dup_name);
                        continue;
                        g_free(base);
                        free(dup_name);
                        continue;
index 8e4938f0d957c58c8f5aa527f7ae7458a8c871b7..31c1b88e4908b54063c1d6dde4999bd52edb241f 100644 (file)
@@ -357,7 +357,6 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
        g_signal_handlers_block_by_func(G_OBJECT(ctree), mimeview_selected,
                                        mimeview);
 
        g_signal_handlers_block_by_func(G_OBJECT(ctree), mimeview_selected,
                                        mimeview);
 
-       mimeview_set_multipart_tree(mimeview, mimeinfo, NULL);
        icon_list_create(mimeview, mimeinfo);
 
        g_signal_handlers_unblock_by_func(G_OBJECT(ctree),
        icon_list_create(mimeview, mimeinfo);
 
        g_signal_handlers_unblock_by_func(G_OBJECT(ctree),
@@ -1813,6 +1812,7 @@ static void icon_selected (MimeView *mimeview, gint num, MimeInfo *partinfo)
 {
        GtkCTreeNode *node;
        node = gtk_ctree_find_by_row_data(GTK_CTREE(mimeview->ctree), NULL, partinfo);
 {
        GtkCTreeNode *node;
        node = gtk_ctree_find_by_row_data(GTK_CTREE(mimeview->ctree), NULL, partinfo);
+
        if (node)
                gtk_ctree_select(GTK_CTREE(mimeview->ctree), node);
 }              
        if (node)
                gtk_ctree_select(GTK_CTREE(mimeview->ctree), node);
 }              
@@ -1965,7 +1965,7 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
                          GINT_TO_POINTER(mimeview->icon_count));
        g_object_set_data(G_OBJECT(button), "partinfo", 
                          mimeinfo);
                          GINT_TO_POINTER(mimeview->icon_count));
        g_object_set_data(G_OBJECT(button), "partinfo", 
                          mimeinfo);
-       
+
        switch (mimeinfo->type) {
                
        case MIMETYPE_TEXT:
        switch (mimeinfo->type) {
                
        case MIMETYPE_TEXT:
@@ -2172,6 +2172,8 @@ static void icon_list_create(MimeView *mimeview, MimeInfo *mimeinfo)
 {
        GtkRequisition size;
 
 {
        GtkRequisition size;
 
+       mimeview_set_multipart_tree(mimeview, mimeinfo, NULL);
+
        g_return_if_fail(mimeinfo != NULL);
 
        while (mimeinfo != NULL) {
        g_return_if_fail(mimeinfo != NULL);
 
        while (mimeinfo != NULL) {
index ed344686aa83b6f58bc43cf96a77fe9098a78460..78c732916b293395875ba63041d24ad4833443e9 100644 (file)
@@ -77,7 +77,7 @@ struct select_keys_s {
 };
 
 
 };
 
 
-static void set_row (GtkCList *clist, gpgme_key_t key);
+static void set_row (GtkCList *clist, gpgme_key_t key, gpgme_protocol_t proto);
 static gpgme_key_t fill_clist (struct select_keys_s *sk, const char *pattern,
                        gpgme_protocol_t proto);
 static void create_dialog (struct select_keys_s *sk);
 static gpgme_key_t fill_clist (struct select_keys_s *sk, const char *pattern,
                        gpgme_protocol_t proto);
 static void create_dialog (struct select_keys_s *sk);
@@ -95,7 +95,7 @@ static void sort_keys (struct select_keys_s *sk, enum col_titles column);
 static void sort_keys_name (GtkWidget *widget, gpointer data);
 static void sort_keys_email (GtkWidget *widget, gpointer data);
 
 static void sort_keys_name (GtkWidget *widget, gpointer data);
 static void sort_keys_email (GtkWidget *widget, gpointer data);
 
-static gboolean use_untrusted (gpgme_key_t);
+static gboolean use_untrusted (gpgme_key_t, gpgme_protocol_t proto);
 
 static void
 update_progress (struct select_keys_s *sk, int running, const char *pattern)
 
 static void
 update_progress (struct select_keys_s *sk, int running, const char *pattern)
@@ -184,14 +184,14 @@ destroy_key (gpointer data)
 }
 
 static void
 }
 
 static void
-set_row (GtkCList *clist, gpgme_key_t key)
+set_row (GtkCList *clist, gpgme_key_t key, gpgme_protocol_t proto)
 {
     const char *s;
     const char *text[N_COL_TITLES];
     char *algo_buf;
     int row;
     gsize by_read = 0, by_written = 0;
 {
     const char *s;
     const char *text[N_COL_TITLES];
     char *algo_buf;
     int row;
     gsize by_read = 0, by_written = 0;
-    gchar *ret_str;
+    gchar *ret_str = NULL;
 
     /* first check whether the key is capable of encryption which is not
      * the case for revoked, expired or sign-only keys */
 
     /* first check whether the key is capable of encryption which is not
      * the case for revoked, expired or sign-only keys */
@@ -207,17 +207,38 @@ set_row (GtkCList *clist, gpgme_key_t key)
         s += 8; /* show only the short keyID */
     text[COL_KEYID] = s;
 
         s += 8; /* show only the short keyID */
     text[COL_KEYID] = s;
 
+
     s = key->uids->name;
     s = key->uids->name;
-    if (!s || !strlen(s))
+    if (!s || !*s)
         s = key->uids->uid;
         s = key->uids->uid;
-    ret_str = g_locale_to_utf8 (s, strlen(s), &by_read, &by_written, NULL);
+    if (proto == GPGME_PROTOCOL_CMS) {
+       if (strstr(s, ",CN="))
+               s = strstr(s, ",CN=")+4;
+       else if (strstr(s, "CN="))
+               s = strstr(s, "CN=")+3;
+    } 
+    
+    ret_str = NULL;
+    if (!g_utf8_validate(s, -1, NULL))
+           ret_str = g_locale_to_utf8 (s, strlen(s), &by_read, &by_written, NULL);
     if (ret_str && by_written) {
         s = ret_str;
     }
     text[COL_NAME] = s;
 
     if (ret_str && by_written) {
         s = ret_str;
     }
     text[COL_NAME] = s;
 
-    s = key->uids->email;
-    ret_str = g_locale_to_utf8 (s, strlen(s), &by_read, &by_written, NULL);
+    if (proto == GPGME_PROTOCOL_CMS && !key->uids->email || !*key->uids->email) {
+       gpgme_user_id_t uid = key->uids->next;
+       if (uid)
+               s = uid->email;
+       else
+               s = key->uids->email;
+    } else {
+        s = key->uids->email;
+    }
+    
+    ret_str = NULL;
+    if (!g_utf8_validate(s, -1, NULL))
+           ret_str = g_locale_to_utf8 (s, strlen(s), &by_read, &by_written, NULL);
     if (ret_str && by_written) {
         s = ret_str;
     }
     if (ret_str && by_written) {
         s = ret_str;
     }
@@ -293,12 +314,19 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
     while ( !(err = gpgme_op_keylist_next ( ctx, &key )) ) {
        gpgme_user_id_t uid = key->uids;
         debug_print ("%% %s:%d:  insert\n", __FILE__ ,__LINE__ );
     while ( !(err = gpgme_op_keylist_next ( ctx, &key )) ) {
        gpgme_user_id_t uid = key->uids;
         debug_print ("%% %s:%d:  insert\n", __FILE__ ,__LINE__ );
-        set_row (clist, key ); 
+        set_row (clist, key, proto ); 
        for (; uid; uid = uid->next) {
        for (; uid; uid = uid->next) {
-               if (!strcmp(pattern, uid->email)) {
+               gchar *raw_mail = NULL;
+               if (!uid->email)
+                       continue;
+               raw_mail = g_strdup(uid->email);
+               extract_address(raw_mail);
+               if (!strcmp(pattern, raw_mail)) {
                        exact_match = TRUE;
                        exact_match = TRUE;
+                       g_free(raw_mail);
                        break;
                }
                        break;
                }
+               g_free(raw_mail);
        }
        num_results++;
        last_key = key;
        }
        num_results++;
        last_key = key;
@@ -310,7 +338,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
  
     if (exact_match == TRUE && num_results == 1) {
            if (last_key->uids->validity < GPGME_VALIDITY_FULL && 
  
     if (exact_match == TRUE && num_results == 1) {
            if (last_key->uids->validity < GPGME_VALIDITY_FULL && 
-               !use_untrusted(last_key))
+               !use_untrusted(last_key, proto))
                    exact_match = FALSE;
     }
 
                    exact_match = FALSE;
     }
 
@@ -489,7 +517,7 @@ select_btn_cb (GtkWidget *widget, gpointer data)
     key = gtk_clist_get_row_data(sk->clist, row);
     if (key) {
         if ( key->uids->validity < GPGME_VALIDITY_FULL ) {
     key = gtk_clist_get_row_data(sk->clist, row);
     if (key) {
         if ( key->uids->validity < GPGME_VALIDITY_FULL ) {
-            use_key = use_untrusted(key);
+            use_key = use_untrusted(key, sk->proto);
             if (!use_key) {
                 debug_print ("** Key untrusted, will not encrypt");
                 return;
             if (!use_key) {
                 debug_print ("** Key untrusted, will not encrypt");
                 return;
@@ -555,10 +583,15 @@ other_btn_cb (GtkWidget *widget, gpointer data)
 
 
 static gboolean
 
 
 static gboolean
-use_untrusted (gpgme_key_t key)
+use_untrusted (gpgme_key_t key, gpgme_protocol_t proto)
 {
     AlertValue aval;
 {
     AlertValue aval;
-    gchar *buf = g_strdup_printf(_("The key of '%s' is not fully trusted.\n"
+    gchar *buf = NULL;
+    
+    if (proto != GPGME_PROTOCOL_OpenPGP)
+       return TRUE;
+
+    buf = g_strdup_printf(_("The key of '%s' is not fully trusted.\n"
               "If you choose to encrypt the message with this key you don't\n"
               "know for sure that it will go to the person you mean it to.\n"
               "Do you trust it enough to use it anyway?"), key->uids->email);
               "If you choose to encrypt the message with this key you don't\n"
               "know for sure that it will go to the person you mean it to.\n"
               "Do you trust it enough to use it anyway?"), key->uids->email);