ignore user-defined flags (for now).

also, split off the backslash from the "core" flag names.
This commit is contained in:
Oswald Buddenhagen 2004-10-17 15:34:53 +00:00
parent e75ebf75f6
commit e8c769ea76

View File

@ -174,11 +174,11 @@ static int get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd );
static const char *Flags[] = { static const char *Flags[] = {
"\\Draft", "Draft",
"\\Flagged", "Flagged",
"\\Answered", "Answered",
"\\Seen", "Seen",
"\\Deleted", "Deleted",
}; };
#if HAVE_LIBSSL #if HAVE_LIBSSL
@ -730,16 +730,18 @@ parse_fetch( imap_t *imap, char *cmd ) /* move this down */
if (is_list( tmp )) { if (is_list( tmp )) {
for (flags = tmp->child; flags; flags = flags->next) { for (flags = tmp->child; flags; flags = flags->next) {
if (is_atom( flags )) { if (is_atom( flags )) {
if (!strcmp( "\\Recent", flags->val )) { if (flags->val[0] == '\\') { /* ignore user-defined flags for now */
if (!strcmp( "Recent", flags->val + 1)) {
status |= M_RECENT; status |= M_RECENT;
goto flagok; goto flagok;
} }
for (i = 0; i < as(Flags); i++) for (i = 0; i < as(Flags); i++)
if (!strcmp( Flags[i], flags->val )) { if (!strcmp( Flags[i], flags->val + 1 )) {
mask |= 1 << i; mask |= 1 << i;
goto flagok; goto flagok;
} }
fprintf( stderr, "IMAP warning: unknown flag %s\n", flags->val ); fprintf( stderr, "IMAP warning: unknown system flag %s\n", flags->val );
}
flagok: ; flagok: ;
} else } else
fprintf( stderr, "IMAP error: unable to parse FLAGS list\n" ); fprintf( stderr, "IMAP error: unable to parse FLAGS list\n" );
@ -1480,6 +1482,7 @@ imap_make_flags( int flags, char *buf )
for (i = d = 0; i < as(Flags); i++) for (i = d = 0; i < as(Flags); i++)
if (flags & (1 << i)) { if (flags & (1 << i)) {
buf[d++] = ' '; buf[d++] = ' ';
buf[d++] = '\\';
for (s = Flags[i]; *s; s++) for (s = Flags[i]; *s; s++)
buf[d++] = *s; buf[d++] = *s;
} }