logview.c revision cb734ee76eb480d14a59899a412e1238d2843b7b
/* Copyright (C) 2007 Timo Sirainen */
#include "lib.h"
#include "mail-index-private.h"
#include "mail-transaction-log.h"
#include <stdio.h>
static struct mail_transaction_ext_intro prev_intro;
{
return 0;
}
{
struct mail_transaction_log_header hdr;
}
}
static const char *log_record_type(unsigned int type)
{
const char *name;
switch (type & MAIL_TRANSACTION_TYPE_MASK) {
name = "expunge";
break;
case MAIL_TRANSACTION_APPEND:
name = "append";
break;
name = "flag-update";
break;
name = "header-update";
break;
name = "ext-intro";
break;
name = "ext-reset";
break;
name = "ext-hdr";
break;
name = "ext-rec";
break;
name = "keyword-update";
break;
name = "keyword-reset";
break;
default:
break;
}
if (type & MAIL_TRANSACTION_EXTERNAL)
return name;
}
{
size_t i;
for (i = 0; i < size; i++)
if (size == 4) {
printf(" (dec=%u)", *n);
}
}
const void *data)
{
printf(" -");
}
printf("\n");
break;
}
case MAIL_TRANSACTION_APPEND: {
printf(" - ");
printf(",");
}
printf("\n");
break;
}
case MAIL_TRANSACTION_FLAG_UPDATE: {
const struct mail_transaction_flag_update *u = data;
u->add_flags, u->remove_flags);
}
break;
}
case MAIL_TRANSACTION_HEADER_UPDATE: {
const struct mail_transaction_header_update *u = data;
printf("\n");
break;
}
case MAIL_TRANSACTION_EXT_INTRO: {
prev_intro = *intro;
printf(" - name = '%.*s'\n",
}
break;
}
case MAIL_TRANSACTION_EXT_RESET: {
break;
}
break;
case MAIL_TRANSACTION_EXT_REC_UPDATE: {
printf("\n");
}
break;
}
case MAIL_TRANSACTION_KEYWORD_UPDATE: {
const struct mail_transaction_keyword_update *u = data;
unsigned int uid_offset;
printf(" - modify=%d, name=%.*s, ",
uid_offset = sizeof(*u) + u->name_size +
size -= uid_offset;
}
printf("\n");
break;
}
case MAIL_TRANSACTION_KEYWORD_RESET: {
const struct mail_transaction_keyword_reset *u = data;
printf(" - ");
}
printf("\n");
break;
}
default:
break;
}
}
static int dump_record(int fd)
{
struct mail_transaction_header hdr;
unsigned int orig_size;
if (ret == 0)
return 0;
}
"type=%s, size=broken (%x)\n",
return 0;
}
}
} else {
}
return 1;
}
{
int fd;
lib_init();
if (argc < 2)
i_fatal("Usage: logview dovecot.index.log");
if (fd < 0) {
i_error("open(): %m");
return 1;
}
for (;;) {
t_push();
if (!dump_record(fd))
break;
t_pop();
}
t_pop();
return 0;
}