S22.Imap icon indicating copy to clipboard operation
S22.Imap copied to clipboard

Reader.SkipUntil/ReadUntil considered harmful

Open jstedfast opened this issue 12 years ago • 3 comments

First off, I want to say that S22.Imap is one of the better IMAP client libraries I've looked over, so I want to offer some friendly help even though I am writing my own IMAP library.

Your body[structure] reader is the right sort of approach, but the use of things like Reader.SkipUntil(')') and Reader.ReadUntil (')') can easily be faulty if there is a quoted string token containing the character you are scanning for.

A better approach is to have your Reader class return tokens. An entire quoted-string would be a single token. An atom would be a token. A '(' would be a token. A ')' would be a token. And so on...

This will help make your parser a whole lot more robust and it wouldn't be all that difficult to implement.

Hopefully you find my advice helpful.

jstedfast avatar Jan 28 '14 20:01 jstedfast

Hello,

ah I hadn't thought of that. Thanks for the heads-up, I'll look into it.

cheers, smiley22

smiley22 avatar Jan 28 '14 21:01 smiley22

Glad to help!

jstedfast avatar Jan 28 '14 21:01 jstedfast

Good working together for community, thanks a lot.

Pavel from Imapx will be use ANTLR. Maybe better use MimeKit and MailKit for parsing.

kiquenet avatar Jan 28 '14 21:01 kiquenet