I didn't really look at the logic itself, but attached patch
fixes/cleans up a couple of things.
On Tue, 2011-02-01 at 17:48 -0200, Emerson Pinter wrote:
> I contacted Lex Brugman about the delete-to-trash plugin for dovecot
> 2.0, he told me there's no version compatible with 2.0 yet... So I
> looked at the code and started to adapt the code for dovecot 2.0. I have
> 0 experience with dovecot plugin development, but with a quick
> adaptation, I managed a apparently stable plugin version, based on
> deleted-to-trash 0.3. I'm using since last friday with Dovecot 2.0.9
> with ~30 imap users. Tested deletion and restore with individual
> messages, 1000, and 2000 messages.
>
> Emerson Pinter
>
>
> On 22-12-2010 14:26, Antonio Perez-Aranda wrote:
> > There are some body using delete-to-trash on any version of Dovecot 2.0?
> >
--- deleted-to-trash-plugin.c.old 2011-02-01 22:23:35.971442875 +0200
+++ deleted-to-trash-plugin.c 2011-02-01 22:25:13.825341445 +0200
@@ -23,7 +23,6 @@
ns = curns;
break;
}
- i_free(curns);
}
return ns;
@@ -59,13 +58,11 @@
{
if(array_count(&last_copy.mail_id) > 0)
{
- array_free(&last_copy.mail_id);
- i_array_init(&last_copy.mail_id, TRASH_LIST_INITSIZE);
+ array_clear(&last_copy.mail_id);
}
if(last_copy.src_mailbox_name != NULL)
{
- i_free(last_copy.src_mailbox_name);
- last_copy.src_mailbox_name = NULL;
+ i_free_and_null(last_copy.src_mailbox_name);
}
}
@@ -150,7 +147,6 @@
}
mailbox_free(&trash_box);
- i_free(trash_box);
}
else
{
@@ -235,8 +231,7 @@
last_copy.transaction_context = save_ctx->transaction;
if(array_count(&last_copy.mail_id) > 0)
{
- array_free(&last_copy.mail_id);
- i_array_init(&last_copy.mail_id, TRASH_LIST_INITSIZE);
+ array_clear(&last_copy.mail_id);
}
if(strcmp(mail->box->name, trashfolder_name) != 0 )