doveadm-mail-fetch.c revision c154a05c76d4d83de1cdf9746ce4e2da0869705d
/* Copyright (c) 2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "ostream.h"
#include "str.h"
#include "message-size.h"
#include "imap-utf7.h"
#include "imap-util.h"
#include "mail-user.h"
#include "mail-storage.h"
#include "mail-search.h"
#include "mail-namespace.h"
#include "doveadm-print.h"
#include "doveadm-mail.h"
#include "doveadm-mail-list-iter.h"
#include "doveadm-mail-iter.h"
#include <stdio.h>
struct fetch_cmd_context {
struct doveadm_mail_cmd_context ctx;
const struct fetch_field *cur_field;
bool print_field_prefix;
};
struct fetch_field {
const char *name;
};
{
return 0;
}
{
const char *value;
return -1;
else {
/* not a valid mUTF-7 name, fallback to showing it as-is */
}
return 0;
}
{
return -1;
return 0;
}
{
return 0;
}
{
return 0;
}
{
const char *value;
return -1;
return 0;
}
{
return 0;
}
{
struct message_size hdr_size;
const unsigned char *data;
int ret = 0;
return -1;
while (!i_stream_is_eof(input)) {
break;
if (size == 0)
break;
}
if (input->stream_errno != 0) {
i_error("read() failed: %m");
ret = -1;
}
doveadm_print_stream(NULL, 0);
return ret;
}
{
const char *const *value;
return -1;
if (add_lf)
}
return 0;
}
{
struct message_size hdr_size;
const unsigned char *data;
int ret = 0;
return -1;
while (!i_stream_is_eof(input)) {
break;
if (size == 0)
break;
}
if (input->stream_errno != 0) {
i_error("read() failed: %m");
ret = -1;
}
doveadm_print_stream(NULL, 0);
return ret;
}
{
const unsigned char *data;
int ret = 0;
return -1;
while (!i_stream_is_eof(input)) {
break;
if (size == 0)
break;
}
if (input->stream_errno != 0) {
i_error("read() failed: %m");
ret = -1;
}
doveadm_print_stream(NULL, 0);
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;
}
{
const char *value;
return -1;
return 0;
}
{
const char *value;
return -1;
return 0;
}
{
const char *value;
return -1;
return 0;
}
static const struct fetch_field fetch_fields[] = {
{ "user", 0, fetch_user },
{ "mailbox", 0, fetch_mailbox },
{ "mailbox-guid", 0, fetch_mailbox_guid },
{ "seq", 0, fetch_seq },
{ "uid", 0, fetch_uid },
{ "guid", 0, fetch_guid },
{ "text", MAIL_FETCH_STREAM_HEADER |
};
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(fetch_fields); i++) {
return &fetch_fields[i];
}
return NULL;
}
static void print_fetch_fields(void)
{
unsigned int i;
}
{
const struct fetch_field *field;
struct fetch_field hdr_field;
name += 4;
} else {
}
}
}
}
{
const struct fetch_field *field;
struct mail_storage *storage =
i_error("fetch(%s) failed for box=%s uid=%u: %s",
}
}
}
static int
{
struct doveadm_mail_iter *iter;
struct mailbox_transaction_context *trans;
return -1;
}
T_BEGIN {
} T_END;
}
return doveadm_mail_iter_deinit(&iter);
}
static void
{
const enum mailbox_list_iter_flags iter_flags =
struct doveadm_mail_list_iter *iter;
const struct mailbox_info *info;
} T_END;
}
{
}
const char *const args[])
{
const char *fetch_fields = args[0];
doveadm_mail_help_name("fetch");
}
static struct doveadm_mail_cmd_context *cmd_fetch_alloc(void)
{
struct fetch_cmd_context *ctx;
doveadm_print_init("pager");
}
struct doveadm_mail_cmd cmd_fetch = {
};