doveadm-mail-fetch.c revision cdf294e5cceee81d58c8477c7c28d9ad6b55c36a
/* Copyright (c) 2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "ostream.h"
#include "base64.h"
#include "randgen.h"
#include "str.h"
#include "message-size.h"
#include "imap-util.h"
#include "mail-namespace.h"
#include "mail-storage.h"
#include "mail-search-build.h"
#include "mail-search-parser.h"
#include "doveadm-mail.h"
#include "doveadm-mail-list-iter.h"
struct fetch_context {
struct mail_search_args *search_args;
const char *prefix;
};
{
const char *value;
return -1;
return 0;
}
{
return 0;
}
{
return 0;
}
{
const char *value;
return -1;
return 0;
}
{
return 0;
}
{
}
{
struct message_size hdr_size;
int ret = 0;
return -1;
while (!i_stream_is_eof(input)) {
i_fatal("write(stdout) failed: %m");
}
if (input->stream_errno != 0) {
i_error("read() failed: %m");
ret = -1;
}
return ret;
}
{
struct message_size hdr_size;
int ret = 0;
return -1;
while (!i_stream_is_eof(input)) {
i_fatal("write(stdout) failed: %m");
}
if (input->stream_errno != 0) {
i_error("read() failed: %m");
ret = -1;
}
return ret;
}
{
int ret = 0;
return -1;
while (!i_stream_is_eof(input)) {
i_fatal("write(stdout) failed: %m");
}
if (input->stream_errno != 0) {
i_error("read() failed: %m");
ret = -1;
}
return ret;
}
{
return -1;
return 0;
}
{
return -1;
return 0;
}
{
time_t t;
return -1;
return 0;
}
{
time_t t;
int tz;
char chr;
return -1;
return 0;
}
{
time_t t;
return -1;
return 0;
}
struct fetch_field {
const char *name;
};
static const struct fetch_field fetch_fields[] = {
{ "mailbox", 0, fetch_mailbox },
{ "seq", 0, fetch_seq },
{ "uid", 0, fetch_uid },
{ "guid", 0, fetch_guid },
{ "text", MAIL_FETCH_STREAM_HEADER |
};
{
struct mail_search_parser *parser;
struct mail_search_args *sargs;
const char *error;
return sargs;
}
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(fetch_fields); i++) {
return &fetch_fields[i];
}
return NULL;
}
{
const struct fetch_field *field;
}
}
static void
{
struct mailbox_transaction_context *t;
struct mail_search_context *search_ctx;
const struct fetch_field *field;
return;
}
t = mailbox_transaction_begin(box, 0);
i_error("fetch(%s) failed for box=%s uid=%u: %s",
}
}
}
if (mailbox_search_deinit(&search_ctx) < 0) {
i_error("Search failed: %s",
}
(void)mailbox_transaction_commit(&t);
}
{
const enum mailbox_list_iter_flags iter_flags =
const char *fetch_fields = args[0];
struct fetch_context ctx;
struct doveadm_mail_list_iter *iter;
const struct mailbox_info *info;
const char *storage_name;
unsigned char prefix_buf[9];
doveadm_mail_help_name("fetch");
mailbox_free(&box);
} T_END;
}