mbox-index.c revision d14de73e30d5d0e06a5b28508b6a44e888edd2d1
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "iobuffer.h"
#include "rfc822-tokenize.h"
#include "mbox-index.h"
#include "mail-index-util.h"
#include "mail-index-data.h"
#include "mail-custom-flags.h"
extern MailIndex mbox_index;
{
return FALSE;
}
{
}
{
}
{
size_t i;
flags = 0;
for (i = 0; i < len; i++) {
switch (value[i]) {
case 'A':
flags |= MAIL_ANSWERED;
break;
case 'F':
flags |= MAIL_FLAGGED;
break;
case 'D':
flags |= MAIL_DRAFT;
break;
case 'R':
break;
case 'T':
flags |= MAIL_DELETED;
break;
}
}
return flags;
}
{
if (index >= 0)
}
static MailFlags
const char *custom_flags[MAIL_CUSTOM_FLAGS_COUNT])
{
flags = 0;
return flags;
}
{
const char **custom_flags, **old_flags;
/* skip <uid validity> and <last uid> fields */
spaces = 0;
if (++spaces == 2)
break;
}
}
return TRUE;
t_push();
/* we're at the 3rd field now, which begins the list of custom flags */
/* need more memory */
max *= 2;
sizeof(const char *) * idx);
}
custom_flags[idx++] =
}
break;
}
}
custom_flags, idx);
ctx->custom_flags =
t_pop();
return ret > 0;
}
void *context)
{
/* Pretty much copy&pasted from popa3d by Solar Designer */
switch (*name) {
case 'R':
case 'r':
}
break;
case 'D':
case 'd':
if (name_len == 12)
else if (name_len == 4) {
/* Received-header contains date too,
and more trusted one */
}
break;
case 'M':
case 'm':
if (name_len == 10) {
/* Received-header contains unique ID too,
and more trusted one */
}
break;
case 'S':
case 's':
/* update message flags */
}
break;
case 'X':
case 'x':
if (name_len == 13) {
/* Let the local delivery agent help generate unique
ID's but don't blindly trust this header alone as
it could just as easily come from the remote. */
} else if (name_len == 8 &&
/* update message flags */
} else if (name_len == 10 &&
/* update custom message flags */
ctx->custom_flags);
} else if (name_len == 10 &&
/* update list of custom message flags */
}
break;
}
if (fixed)
}
const char *custom_flags[MAIL_CUSTOM_FLAGS_COUNT],
void *context)
{
int i;
for (i = 0; i < MAIL_CUSTOM_FLAGS_COUNT; i++) {
strlen(custom_flags[i]) : 0;
}
for (;;) {
/* skip whitespace */
value++;
len--;
}
if (len == 0)
break;
/* find the length of the item */
break;
}
/* check if it's found */
for (i = 0; i < MAIL_CUSTOM_FLAGS_COUNT; i++) {
if (custom_len[i] == item_len &&
break;
}
if (i == MAIL_CUSTOM_FLAGS_COUNT)
i = -1;
}
}
{
unsigned char *data;
pos = 0;
if (pos == 0) {
if (data[0] == '\n') {
return TRUE;
}
if (data[0] != '\r')
return FALSE;
pos++;
}
return FALSE;
return TRUE;
}
}
/* end of file */
return TRUE;
}
{
unsigned char *data;
/* skip empty lines at beginning */
}
}
{
unsigned char *msg;
i = startpos;
for (; i < size; i++) {
if (msg[i] == '\n') {
i -= startpos;
}
}
}
return FALSE;
}
{
unsigned char *msg;
int lastmsg;
/* read until "[\r]\nFrom " is found */
/* See if it's space after "From" */
/* check still that the From-line looks
actually valid, in outbox there
might be some lines beginning with
From. */
/* see if we had \r too */
i -= 5;
i--;
break;
}
}
}
}
if (i < size) {
startpos = i;
break;
}
i -= startpos;
io_buffer_skip(inbuf, i);
}
/* end of file, remove the last [\r]\n */
startpos--;
startpos--;
}
}
}
{
*offset = 0;
return FALSE;
*offset = 0;
return FALSE;
} else {
return TRUE;
}
}
{
int len;
}
{
}
int external_change)
{
return FALSE;
if (!external_change) {
}
return TRUE;
}
MailIndex mbox_index = {
};