Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error on Office365 accounts #15

Open
fegu opened this issue Jan 15, 2014 · 4 comments
Open

Parse error on Office365 accounts #15

fegu opened this issue Jan 15, 2014 · 4 comments
Labels

Comments

@fegu
Copy link
Contributor

fegu commented Jan 15, 2014

At the end of a FETCH reply, just before the terminating ), Office365 accounts have an added line of the format UID nn FLAGS (\Seen). This results in a parse error: expected space or ).

Example very last few lines of reply which does not fail:

\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n)\r\n000004 OK FETCH completed.\r\n

Example very last few lines of Office365 reply which fails:

\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\nUID 12 FLAGS (\Seen))\r\n000004 OK FETCH completed.\r\n

@jtdaugherty
Copy link
Collaborator

Thanks for the report! Do you have time to write a patch?

@fegu
Copy link
Contributor Author

fegu commented Jan 15, 2014

I am motivated to do some work, but I would need to spend some time to get into the parser library first. I might not get time in a while. Is the
parser the same, or based on, or not related to Text.GrammarCombinators.Parser.Packrat from grammar-combinators?

For my application all I need is to ditch this flag and make it work, so perhaps a dirty fix first.

:: Finn Espen Gundersen

On 15 Jan 2014, at 21:55, Jonathan Daugherty [email protected] wrote:

Thanks for the report! Do you have time to write a patch?


Reply to this email directly or view it on GitHub.

@dkov01
Copy link

dkov01 commented Jun 2, 2016

This bug also occurs on MS Exchange Server 2010+ as reported.

@farrellm
Copy link

farrellm commented Sep 5, 2019

I can't make a pull request at the moment, but here's a patch to fix this (though someone should test it does not break non-MS emails):

index 0d790d2..06fe900 100644
--- a/src/Network/HaskellNet/IMAP/Parsers.hs
+++ b/src/Network/HaskellNet/IMAP/Parsers.hs
@@ -325,6 +325,7 @@ pFetchLine =
        string " FETCH" >> spaces
        char '('
        pairs <- pPair `sepBy` space
+       optional (string "UID " >> many1 digit >> string " FLAGS (\\Seen)")
        char ')'
        crlfP
        return $ Right $ (read num, pairs)```

@qnikst qnikst added the bug label Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants