Commit ea860642 ea86064255231233cb9e7021c09c5e87fe7cbde8 by Sam Roberts

sv_mu_save_to() became mailbox/message.c:message_save_to_mailbox()

1 parent 5c2e34cb
......@@ -213,11 +213,11 @@ sv_fileinto (void *ac, void *ic, void *sc, void *mc, const char **errmsg)
if ((m->svflags & SV_FLAG_NO_ACTIONS) == 0)
{
*errmsg = "fileinto(delivering)";
m->rc = sv_mu_save_to (a->mailbox, m->msg, m->ticket, m->debug);
*errmsg = "fileinto, saving msg";
m->rc = message_save_to_mailbox (m->msg, m->ticket, m->debug, a->mailbox);
if (!m->rc)
{
*errmsg = "fileinto(deleting)";
*errmsg = "fileinto, deleting msg";
m->rc = sv_mu_mark_deleted (m->msg, 1);
}
}
......@@ -280,6 +280,7 @@ sv_notify (void *ac, void *ic, void *sc, void *mc, const char **errmsg)
}
#endif
#if 0
int
sv_autorespond (void *ac, void *ic, void *sc, void *mc, const char **errmsg)
{
......@@ -292,7 +293,6 @@ sv_send_response (void *ac, void *ic, void *sc, void *mc, const char **errmsg)
return SIEVE_FAIL;
}
#if 0
sieve_vacation_t vacation = {
0, /* min response */
0, /* max response */
......
/** utility wrappers around mailutils functionality **/
#include <assert.h>
#include <errno.h>
#include <string.h>
#include "sv.h"
#if 0
int
sv_mu_copy_debug_level (const mailbox_t from, mailbox_t to)
{
......@@ -15,73 +17,20 @@ sv_mu_copy_debug_level (const mailbox_t from, mailbox_t to)
if (!from || !to)
return EINVAL;
rc = mailbox_get_debug (from, &d);
if (!rc)
mu_debug_get_level (d, &level);
if (!rc)
rc = mailbox_get_debug (to, &d);
if (!rc)
rc = mu_debug_set_level (d, level);
if((rc = mailbox_get_debug (from, &d)))
return rc;
}
int
sv_mu_save_to (const char *toname, message_t msg,
ticket_t ticket, mu_debug_t debug)
{
int rc = 0;
mailbox_t to = 0;
rc = mailbox_create_default (&to, toname);
if (!rc && debug)
{
folder_t folder = 0;
mailbox_set_debug (to, debug);
if (mailbox_get_folder (to, &folder))
folder_set_debug(folder, debug);
}
if (!rc && ticket)
{
folder_t folder = NULL;
authority_t auth = NULL;
if (!rc)
rc = mailbox_get_folder (to, &folder);
if (!rc)
rc = folder_get_authority (folder, &auth);
/* Authentication-less folders don't have authorities. */
if (!rc && auth)
rc = authority_set_ticket (auth, ticket);
}
if (!rc)
rc = mailbox_open (to, MU_STREAM_WRITE | MU_STREAM_CREAT);
if (!rc)
rc = mailbox_append_message (to, msg);
if ((mu_debug_get_level (d, &level)))
return rc;
if (!rc)
rc = mailbox_close (to);
else
{
mailbox_close (to);
}
if ((rc = mailbox_get_debug (to, &d)))
return rc;
mailbox_destroy (&to);
rc = mu_debug_set_level (d, level);
return rc;
}
#endif
int
sv_mu_mark_deleted (message_t msg, int deleted)
......