Commit 2e38ebed 2e38ebedfffd89b7513b80730b97621a544b557d by Sergey Poznyakoff

(mailbox_flush): New function. Marks all

messages as seen and saves the attributes to the mailbox,
optionally expunging it.
1 parent f7f413b4
......@@ -199,9 +199,32 @@ mailbox_close (mailbox_t mbox)
{
if (mbox == NULL || mbox->_close == NULL)
return MU_ERR_EMPTY_VFN;
return mbox->_close (mbox);
}
int
mailbox_flush (mailbox_t mbox, int expunge)
{
size_t i, total = 0;
int status = 0;
mailbox_messages_count (mbox, &total);
for (i = 1; i <= total; i++)
{
message_t msg = NULL;
attribute_t attr = NULL;
mailbox_get_message (mbox, i, &msg);
message_get_attribute (msg, &attr);
attribute_set_seen (attr);
}
if (expunge)
status = mailbox_expunge (mbox);
else
status = mailbox_save_attributes (mbox);
return status;
}
/* messages */
int
mailbox_append_message (mailbox_t mbox, message_t msg)
......