Bug 2109

Summary: implement remove_msgs callback for MailMBOX
Product: Claws Mail (GTK 2) Reporter: Cindy Matthews <cm51>
Component: Plugins/mailMBOXAssignee: users
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 3.7.4   
Hardware: PC   
OS: Linux   

Description Cindy Matthews 2010-01-29 20:19:48 UTC
Performance of multiple deletes is atrocious. In part this comes about because the mbox code doesn't support multiple deletes, and instead spends its time messing about locking and unlocking the mail file. A fix for this is below:

I have written a multiple delete function along these lines:

static gint
claws_mailmbox_remove_msgs( Folder *folder, FolderItem *item,
                            MsgInfoList *msglist, GRelation *relation )
{
    struct claws_mailmbox_folder *mbox;
    int r;
    
    g_return_val_if_fail( item!=NULL, -1 );
    mbox=get_mbox(item,0);
    g_return_val_if_fail( mbox!=NULL, -1 );

    MsgInfoList *cur;
    for( cur=msglist; cur; cur=cur->next )
    {
       MsgInfo *msginfo=(MsgInfo*) cur->data;
       if( !msginfo )
       {
           continue;
       }
       if( MSG_IS_MOVE(msginfo->flags) && MSG_IS_MOVE_DONE(msginfo->flags) )
       {
           msginfo->flags.tmp_flags&=~MSG_MOVE_DONE;
           continue;
       }
       claws_mailmbox_delete_msg(mbox,msginfo->msgnum);
    }

    /* Fix for bug 1434
     */
    claws_mailmbox_expunge(mbox);

    return r;
}

With this function referenced in the class structure, deletes are much faster, but still at least an order of magnitude slower than other mail programmes.

The code above is mature and is ported to 3.7.4.
Comment 1 Colin Leroy 2012-09-12 12:10:43 UTC
Better late than never... Thanks for your patch, applied.
2012-09-12 [colin]	1.14.7cvs5

	* src/mailmbox_folder.c
		Fix bug #2109, "implement remove_msgs callback for MailMBOX"
		Patch mostly by Cindy Matthews.