nojb / ocaml-imap

Lwt-compatible IMAP4rev1 client library for OCaml
https://nojb.github.io/ocaml-imap/imap
Other
40 stars 17 forks source link

Parse envelope address lists without spaces #24

Closed phi-gamma closed 9 years ago

phi-gamma commented 9 years ago

Address issue #22

The IMAP spec doesn’t allow spaces between address elements. Example envelope-to input from Cyrus:

``((NIL NIL "undisclosed-recipients" NIL)(NIL NIL NIL NIL))``

The parser trips over the second element:

IMAP Error: Decode error: Unexpected character '('
print_objs: internal error, uncaught exception:
            Failure("imap error")

because it expects a space or closing paren. This commit adds a labeled delim argument to the p_list pattern which specifies the (optional) delimiter byte. This then forms the base for both the p_list and p_address_list patterns.

phi-gamma commented 9 years ago

This derives both the spaced and unspaced list patterns from a common one which takes an optional delimiter argument (char, because that’s what’s needed at the moment).

nojb commented 9 years ago

Looks good, thanks a lot for your contribution!

phi-gamma commented 9 years ago

···<date: 2015-07-29, Wednesday>······

Looks good, thanks a lot for your contribution!

Thanks for writing the module in the first place ;)