Bug 2109 - implement remove_msgs callback for MailMBOX
Summary: implement remove_msgs callback for MailMBOX
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins/mailMBOX (show other bugs)
Version: 3.7.4
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2010-01-29 19:19 UTC by Cindy Matthews
Modified: 2012-09-12 10:10 UTC (History)
0 users

See Also:


Attachments

Description Cindy Matthews 2010-01-29 19: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 10: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.

Note You need to log in before you can comment on or make changes to this bug.