maildir-index.c revision a8767e3a8dd08bb782f05dacf2c8877f3cba644e
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "temp-string.h"
#include "maildir-index.h"
#include "mail-index-data.h"
#include "mail-index-util.h"
#include <stdio.h>
extern MailIndex maildir_index;
{
const char *info;
return default_flags;
flags = 0;
switch (*info) {
case 'R': /* replied */
flags |= MAIL_ANSWERED;
break;
case 'S': /* seen */
break;
case 'T': /* trashed */
flags |= MAIL_DELETED;
break;
case 'D': /* draft */
flags |= MAIL_DRAFT;
break;
case 'F': /* flagged */
flags |= MAIL_FLAGGED;
break;
default:
/* custom flag */
*info-'a');
break;
}
/* unknown flag - ignore */
break;
}
}
return flags;
}
{
int i, nextflag;
/* remove the old :info from file name, and get the old flags */
oldflags = "";
}
/* insert the new flags between old flags. flags must be sorted by
their ASCII code. unknown flags are kept. */
for (;;) {
/* skip all known flags */
*oldflags == 'T' ||
oldflags++;
(unsigned char) *oldflags;
flags &= ~MAIL_DRAFT;
}
flags &= ~MAIL_FLAGGED;
}
flags &= ~MAIL_ANSWERED;
}
}
flags &= ~MAIL_DELETED;
}
for (i = 0; i < MAIL_CUSTOM_FLAGS_COUNT; i++) {
}
}
break;
oldflags++;
}
if (*oldflags == ',') {
/* another flagset, we don't know about these, just keep them */
while (*oldflags != '\0')
}
}
{
return index;
}
{
}
{
const char *fname;
/* try getting it from cache */
return date;
/* stat() gives it */
return (time_t)-1;
}
return (time_t)-1;
}
}
int external_change)
{
/* we need to update the flags in the file name */
return FALSE;
}
/* minor problem: new_path is overwritten if it exists.. */
"rename(%s, %s) failed: %m",
return FALSE;
}
/* update the filename in index */
return FALSE;
}
return FALSE;
return TRUE;
}
};