de-duplicate FETCH response data item traversal somewhat
This commit is contained in:
parent
8acf56b311
commit
503478533c
|
@ -1060,15 +1060,15 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED )
|
||||||
error( "IMAP error: bogus item name in FETCH response\n" );
|
error( "IMAP error: bogus item name in FETCH response\n" );
|
||||||
goto ffail;
|
goto ffail;
|
||||||
}
|
}
|
||||||
if (!strcmp( "UID", tmp->val )) {
|
const char *name = tmp->val;
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
|
if (!strcmp( "UID", name )) {
|
||||||
if (!is_atom( tmp ) || (uid = strtoul( tmp->val, &ep, 10 ), *ep)) {
|
if (!is_atom( tmp ) || (uid = strtoul( tmp->val, &ep, 10 ), *ep)) {
|
||||||
error( "IMAP error: unable to parse UID\n" );
|
error( "IMAP error: unable to parse UID\n" );
|
||||||
goto ffail;
|
goto ffail;
|
||||||
}
|
}
|
||||||
continue; // This *is* the UID.
|
continue; // This *is* the UID.
|
||||||
} else if (!strcmp( "FLAGS", tmp->val )) {
|
} else if (!strcmp( "FLAGS", name )) {
|
||||||
tmp = tmp->next;
|
|
||||||
if (!is_list( tmp )) {
|
if (!is_list( tmp )) {
|
||||||
error( "IMAP error: unable to parse FLAGS\n" );
|
error( "IMAP error: unable to parse FLAGS\n" );
|
||||||
goto ffail;
|
goto ffail;
|
||||||
|
@ -1076,8 +1076,7 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED )
|
||||||
if (!parse_fetched_flags( tmp->child, &mask, &status ))
|
if (!parse_fetched_flags( tmp->child, &mask, &status ))
|
||||||
goto ffail;
|
goto ffail;
|
||||||
continue; // This may legitimately come without UID.
|
continue; // This may legitimately come without UID.
|
||||||
} else if (!strcmp( "INTERNALDATE", tmp->val )) {
|
} else if (!strcmp( "INTERNALDATE", name )) {
|
||||||
tmp = tmp->next;
|
|
||||||
if (!is_atom( tmp )) {
|
if (!is_atom( tmp )) {
|
||||||
error( "IMAP error: unable to parse INTERNALDATE\n" );
|
error( "IMAP error: unable to parse INTERNALDATE\n" );
|
||||||
goto ffail;
|
goto ffail;
|
||||||
|
@ -1086,21 +1085,18 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED )
|
||||||
error( "IMAP error: unable to parse INTERNALDATE format\n" );
|
error( "IMAP error: unable to parse INTERNALDATE format\n" );
|
||||||
goto ffail;
|
goto ffail;
|
||||||
}
|
}
|
||||||
} else if (!strcmp( "RFC822.SIZE", tmp->val )) {
|
} else if (!strcmp( "RFC822.SIZE", name )) {
|
||||||
tmp = tmp->next;
|
|
||||||
if (!is_atom( tmp ) || (size = strtoul( tmp->val, &ep, 10 ), *ep)) {
|
if (!is_atom( tmp ) || (size = strtoul( tmp->val, &ep, 10 ), *ep)) {
|
||||||
error( "IMAP error: unable to parse RFC822.SIZE\n" );
|
error( "IMAP error: unable to parse RFC822.SIZE\n" );
|
||||||
goto ffail;
|
goto ffail;
|
||||||
}
|
}
|
||||||
} else if (!strcmp( "BODY[]", tmp->val )) {
|
} else if (!strcmp( "BODY[]", name )) {
|
||||||
tmp = tmp->next;
|
|
||||||
if (!is_atom( tmp )) {
|
if (!is_atom( tmp )) {
|
||||||
error( "IMAP error: unable to parse BODY[]\n" );
|
error( "IMAP error: unable to parse BODY[]\n" );
|
||||||
goto ffail;
|
goto ffail;
|
||||||
}
|
}
|
||||||
body = tmp;
|
body = tmp;
|
||||||
} else if (!strcmp( "BODY[HEADER.FIELDS", tmp->val )) {
|
} else if (!strcmp( "BODY[HEADER.FIELDS", name )) {
|
||||||
tmp = tmp->next;
|
|
||||||
if (!is_list( tmp )) {
|
if (!is_list( tmp )) {
|
||||||
bfail:
|
bfail:
|
||||||
error( "IMAP error: unable to parse BODY[HEADER.FIELDS ...]\n" );
|
error( "IMAP error: unable to parse BODY[HEADER.FIELDS ...]\n" );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user