cmd-append.c revision 0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834
/* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "commands.h"
#include "imap-parser.h"
#include "imap-date.h"
#include "mail-storage.h"
/* Returns -1 = error, 0 = need more data, 1 = successful. flags and
internal_date may be NULL as a result, but mailbox and msg_size are always
set when successful. */
int *nonsync)
{
/* [<flags>] */
else {
args++;
}
/* [<internal date>] */
*internal_date = NULL;
else {
args++;
}
return FALSE;
return TRUE;
}
{
struct mail_storage *storage;
struct mailbox_status status;
struct mailbox_transaction_context *t;
struct imap_parser *save_parser;
struct imap_arg_list *flags_list;
struct mailbox_custom_flags old_flags;
struct mail_full_flags flags;
const char *mailbox, *internal_date_str;
unsigned int count;
/* <mailbox> */
return FALSE;
return TRUE;
return TRUE;
return TRUE;
}
return TRUE;
}
/* if error occurs, the CRLF is already read. */
count = 0;
for (;;) {
/* [<flags>] [<internal date>] <message literal> */
for (;;) {
&args);
if (ret >= 0)
break;
if (ret == -1) {
break;
}
/* need more data */
if (ret == -2) {
"Too long argument.");
break;
}
if (ret < 0) {
/* disconnected */
break;
}
}
break;
/* last one */
if (count > 0)
break;
}
/* error */
break;
}
if (flags_list != NULL) {
break;
} else {
}
if (internal_date_str == NULL) {
/* no time given, default to now. */
timezone_offset = 0;
} else if (!imap_parse_datetime(internal_date_str,
&timezone_offset)) {
"BAD Invalid internal date.");
break;
}
if (msg_size == 0) {
/* no message data, abort */
break;
}
if (!nonsync) {
}
/* save the mail */
msg_size);
break;
}
break;
count++;
}
if (failed)
else {
if (mailbox_transaction_commit(t) < 0) {
}
}
if (!failed) {
}
return TRUE;
}