maildir-index.c revision cec40012f7a3088c266823b54a017537453034fe
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3Timo Sirainen/* Copyright (C) 2002 Timo Sirainen */
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo SirainenMailFlags maildir_filename_get_flags(const char *fname, MailFlags default_flags)
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen if (info == NULL || info[1] != '2' || info[2] != ',')
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen /* custom flag */
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen /* unknown flag - ignore */
00a50d6dc74e15b5b83afcb8c12c2109a2ca376dTimo Sirainenconst char *maildir_filename_set_flags(const char *fname, MailFlags flags)
00a50d6dc74e15b5b83afcb8c12c2109a2ca376dTimo Sirainen /* remove the old :info from file name, and get the old flags */
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen if (info != NULL && strrchr(fname, '/') > info)
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen /* insert the new flags between old flags. flags must be sorted by
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen their ASCII code. unknown flags are kept. */
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen flags_buf = t_malloc(MAIL_FLAGS_COUNT+strlen(oldflags)+1);
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen /* skip all known flags */
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen while (*oldflags == 'D' || *oldflags == 'F' ||
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen (unsigned char) *oldflags;
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen if ((flags & MAIL_FLAGGED) && nextflag > 'F') {
for (i = 0; i < MAIL_CUSTOM_FLAGS_COUNT; i++) {
*p++ = *oldflags++;
int len;
int external_change)
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return TRUE;