|
|
@ -1056,65 +1056,61 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (tmp = list->child; tmp; tmp = tmp->next) { |
|
|
|
for (tmp = list->child; tmp; tmp = tmp->next) { |
|
|
|
if (is_atom( tmp )) { |
|
|
|
if (!is_atom( tmp )) |
|
|
|
if (!strcmp( "UID", tmp->val )) { |
|
|
|
continue; |
|
|
|
tmp = tmp->next; |
|
|
|
if (!strcmp( "UID", tmp->val )) { |
|
|
|
if (!is_atom( tmp ) || (uid = strtoul( tmp->val, &ep, 10 ), *ep)) { |
|
|
|
tmp = tmp->next; |
|
|
|
error( "IMAP error: unable to parse UID\n" ); |
|
|
|
if (!is_atom( tmp ) || (uid = strtoul( tmp->val, &ep, 10 ), *ep)) { |
|
|
|
goto ffail; |
|
|
|
error( "IMAP error: unable to parse UID\n" ); |
|
|
|
} |
|
|
|
goto ffail; |
|
|
|
continue; // This *is* the UID.
|
|
|
|
} |
|
|
|
} else if (!strcmp( "FLAGS", tmp->val )) { |
|
|
|
continue; // This *is* the UID.
|
|
|
|
tmp = tmp->next; |
|
|
|
} else if (!strcmp( "FLAGS", tmp->val )) { |
|
|
|
if (is_list( tmp )) { |
|
|
|
tmp = tmp->next; |
|
|
|
if (!parse_fetched_flags( tmp->child, &mask, &status )) |
|
|
|
if (!is_list( tmp )) { |
|
|
|
goto ffail; |
|
|
|
error( "IMAP error: unable to parse FLAGS\n" ); |
|
|
|
continue; // This may legitimately come without UID.
|
|
|
|
goto ffail; |
|
|
|
} else { |
|
|
|
} |
|
|
|
error( "IMAP error: unable to parse FLAGS\n" ); |
|
|
|
if (!parse_fetched_flags( tmp->child, &mask, &status )) |
|
|
|
goto ffail; |
|
|
|
goto ffail; |
|
|
|
} |
|
|
|
continue; // This may legitimately come without UID.
|
|
|
|
} else if (!strcmp( "INTERNALDATE", tmp->val )) { |
|
|
|
} else if (!strcmp( "INTERNALDATE", tmp->val )) { |
|
|
|
tmp = tmp->next; |
|
|
|
tmp = tmp->next; |
|
|
|
if (is_atom( tmp )) { |
|
|
|
if (!is_atom( tmp )) { |
|
|
|
if ((date = parse_date( tmp->val )) == -1) { |
|
|
|
error( "IMAP error: unable to parse INTERNALDATE\n" ); |
|
|
|
error( "IMAP error: unable to parse INTERNALDATE format\n" ); |
|
|
|
goto ffail; |
|
|
|
goto ffail; |
|
|
|
} |
|
|
|
} |
|
|
|
if ((date = parse_date( tmp->val )) == -1) { |
|
|
|
} else { |
|
|
|
error( "IMAP error: unable to parse INTERNALDATE format\n" ); |
|
|
|
error( "IMAP error: unable to parse INTERNALDATE\n" ); |
|
|
|
goto ffail; |
|
|
|
goto ffail; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (!strcmp( "RFC822.SIZE", tmp->val )) { |
|
|
|
} else if (!strcmp( "RFC822.SIZE", tmp->val )) { |
|
|
|
tmp = tmp->next; |
|
|
|
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[]", tmp->val )) { |
|
|
|
tmp = tmp->next; |
|
|
|
tmp = tmp->next; |
|
|
|
if (!is_atom( tmp )) { |
|
|
|
if (is_atom( tmp )) { |
|
|
|
error( "IMAP error: unable to parse BODY[]\n" ); |
|
|
|
body = tmp; |
|
|
|
goto ffail; |
|
|
|
} else { |
|
|
|
} |
|
|
|
error( "IMAP error: unable to parse BODY[]\n" ); |
|
|
|
body = tmp; |
|
|
|
goto ffail; |
|
|
|
} else if (!strcmp( "BODY[HEADER.FIELDS", tmp->val )) { |
|
|
|
} |
|
|
|
tmp = tmp->next; |
|
|
|
} else if (!strcmp( "BODY[HEADER.FIELDS", tmp->val )) { |
|
|
|
if (!is_list( tmp )) { |
|
|
|
tmp = tmp->next; |
|
|
|
bfail: |
|
|
|
if (is_list( tmp )) { |
|
|
|
error( "IMAP error: unable to parse BODY[HEADER.FIELDS ...]\n" ); |
|
|
|
tmp = tmp->next; |
|
|
|
goto ffail; |
|
|
|
if (!is_atom( tmp ) || strcmp( tmp->val, "]" )) |
|
|
|
|
|
|
|
goto bfail; |
|
|
|
|
|
|
|
tmp = tmp->next; |
|
|
|
|
|
|
|
if (!is_atom( tmp )) |
|
|
|
|
|
|
|
goto bfail; |
|
|
|
|
|
|
|
parse_fetched_header( tmp->val, uid, &tuid, &msgid ); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
bfail: |
|
|
|
|
|
|
|
error( "IMAP error: unable to parse BODY[HEADER.FIELDS ...]\n" ); |
|
|
|
|
|
|
|
goto ffail; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
tmp = tmp->next; |
|
|
|
|
|
|
|
if (!is_atom( tmp ) || strcmp( tmp->val, "]" )) |
|
|
|
|
|
|
|
goto bfail; |
|
|
|
|
|
|
|
tmp = tmp->next; |
|
|
|
|
|
|
|
if (!is_atom( tmp )) |
|
|
|
|
|
|
|
goto bfail; |
|
|
|
|
|
|
|
parse_fetched_header( tmp->val, uid, &tuid, &msgid ); |
|
|
|
} |
|
|
|
} |
|
|
|
need_uid = 1; |
|
|
|
need_uid = 1; |
|
|
|
} |
|
|
|
} |
|
|
|