balsa r8034 - in trunk: . libbalsa src



Author: pawels
Date: Fri Jan  2 13:35:33 2009
New Revision: 8034
URL: http://svn.gnome.org/viewvc/balsa?rev=8034&view=rev

Log:
* src/main-window.c: report number of deleted message duplicates.
* libbalsa/mailbox.[ch]: provide it.
* libbalsa/imap-server.c: using binary fetches breaks integrity checks.


Modified:
   trunk/ChangeLog
   trunk/libbalsa/imap-server.c
   trunk/libbalsa/mailbox.c
   trunk/libbalsa/mailbox.h
   trunk/libbalsa/mailbox_imap.c
   trunk/src/main-window.c

Modified: trunk/libbalsa/imap-server.c
==============================================================================
--- trunk/libbalsa/imap-server.c	(original)
+++ trunk/libbalsa/imap-server.c	Fri Jan  2 13:35:33 2009
@@ -324,7 +324,14 @@
     imap_handle_set_tls_mode(handle, mode);
     imap_handle_set_option(handle, IMAP_OPT_ANONYMOUS, server->try_anonymous);
     imap_handle_set_option(handle, IMAP_OPT_CLIENT_SORT, TRUE);
+#ifdef HAVE_GPGME
+    /* binary fetches change encoding and the checksums, and
+       signatures, disable them if we ever consider verifying message
+       integrity. */
+    imap_handle_set_option(handle, IMAP_OPT_BINARY, FALSE);
+#else
     imap_handle_set_option(handle, IMAP_OPT_BINARY, TRUE);
+#endif
     imap_handle_set_option(handle, IMAP_OPT_IDLE,
                            LIBBALSA_IMAP_SERVER(server)->use_idle);
     return info;

Modified: trunk/libbalsa/mailbox.c
==============================================================================
--- trunk/libbalsa/mailbox.c	(original)
+++ trunk/libbalsa/mailbox.c	Fri Jan  2 13:35:33 2009
@@ -4157,11 +4157,12 @@
     return LIBBALSA_MAILBOX_GET_CLASS(mailbox)->duplicate_msgnos != NULL;
 }
 
-void
+gint
 libbalsa_mailbox_move_duplicates(LibBalsaMailbox * mailbox,
                                  LibBalsaMailbox * dest, GError ** err)
 {
     GArray *msgnos = NULL;
+    gint retval;
 
     if (libbalsa_mailbox_can_move_duplicates(mailbox))
         msgnos =
@@ -4172,22 +4173,23 @@
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_DUPLICATES_ERROR,
                     _("Finding duplicate messages in source mailbox failed"));
-        return;
+        return 0;
     }
 
     if (!msgnos)
-        return;
+        return 0;
 
     if (msgnos->len > 0) {
-        if (mailbox != dest)
+        if (dest && mailbox != dest)
             libbalsa_mailbox_messages_move(mailbox, msgnos, dest, err);
         else
             libbalsa_mailbox_messages_change_flags(mailbox, msgnos,
                                                    LIBBALSA_MESSAGE_FLAG_DELETED,
                                                    0);
     }
-
+    retval = msgnos->len;
     g_array_free(msgnos, TRUE);
+    return retval;
 }
 
 #if BALSA_USE_THREADS

Modified: trunk/libbalsa/mailbox.h
==============================================================================
--- trunk/libbalsa/mailbox.h	(original)
+++ trunk/libbalsa/mailbox.h	Fri Jan  2 13:35:33 2009
@@ -488,7 +488,7 @@
 
 guint libbalsa_mailbox_total_messages(LibBalsaMailbox * mailbox);
 gboolean libbalsa_mailbox_can_move_duplicates(LibBalsaMailbox * mailbox);
-void libbalsa_mailbox_move_duplicates(LibBalsaMailbox * mailbox,
+gint libbalsa_mailbox_move_duplicates(LibBalsaMailbox * mailbox,
                                       LibBalsaMailbox * dest,
                                       GError ** err);
 

Modified: trunk/libbalsa/mailbox_imap.c
==============================================================================
--- trunk/libbalsa/mailbox_imap.c	(original)
+++ trunk/libbalsa/mailbox_imap.c	Fri Jan  2 13:35:33 2009
@@ -2539,7 +2539,6 @@
 	    g_hash_table_insert(dupes, msg_id, GINT_TO_POINTER(1));
 	else {
 	    g_array_append_val(res, i);
-	    printf("(IMAP) Found duplicate: %u for '%s'\n", i, msg_id);
 	}
     }
     g_hash_table_destroy(dupes);

Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c	(original)
+++ trunk/src/main-window.c	Fri Jan  2 13:35:33 2009
@@ -4291,14 +4291,21 @@
         LibBalsaMailbox *mailbox =
             BALSA_INDEX(index)->mailbox_node->mailbox;
         GError *err = NULL;
-        libbalsa_mailbox_move_duplicates(mailbox, balsa_app.trash, &err);
+        gint dup_count = libbalsa_mailbox_move_duplicates(mailbox, NULL, &err);
         if (err) {
             balsa_information(LIBBALSA_INFORMATION_WARNING,
                               _("Removing duplicates failed: %s"),
                               err->message);
             g_error_free(err);
-        } else
-            balsa_index_ensure_visible(BALSA_INDEX(index));
+        } else {
+	    if(dup_count)
+		balsa_information(LIBBALSA_INFORMATION_MESSAGE,
+				  _("Removed %d duplicates"), dup_count);
+	    else
+		balsa_information(LIBBALSA_INFORMATION_MESSAGE,
+				  _("No duplicates found"));
+	}
+
     }
 }
 #endif /* ENABLE_TOUCH_UI */



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