I use Indy 5499. After installing and compiling it, first thing I noticed is that right clicking on
dclIndyCore140.dpk and selecting
Install reports an error. This wasn't the case in earlier versions, however,
Install on
dclIndyProtocols140.dpk works fine. I assume this is some change since earlier release and that it is now enough to install just
dclIndyProtocols140.dpk
Anyway, onto the main problem - when downloading message list from IMAP, using
UIDRetrieveAllEnvelopes
I get a list which contains subjects like (reply log from server):
Quote:* 1760 FETCH (UID 12777 FLAGS (\Seen) ENVELOPE ("5 May 2019 07:50:59 +0200" "Test \"quoted text\", more text" (("test" NIL "test" "test.com")) (("test" NIL "test" "test.com")) (("test" NIL "test" "test.com")) ((NIL NIL "test2" "test2.com")) NIL NIL NIL "<msgid@test.com>"))
The list is from Gmail if that is of any relevance.
The problem is the
\" escaping of quotes - Indy doesn't seem to decode this properly and the text ends up as
Test \
It should be decoded as
Test "quoted text", more text
Is this a known bug?
(05-27-2019, 05:38 PM)johnmay Wrote: [ -> ]I use Indy 5499. After installing and compiling it, first thing I noticed is that right clicking on dclIndyCore140.dpk and selecting Install reports an error.
Can you be more specific? What is the actual error? And, just to confirm, you are using RAD Studio 2010, correct?
(05-27-2019, 05:38 PM)johnmay Wrote: [ -> ]This wasn't the case in earlier versions, however, Install on dclIndyProtocols140.dpk works fine. I assume this is some change since earlier release and that it is now enough to install just dclIndyProtocols140.dpk
No, you still need to install the dclIndyCore package first.
(05-27-2019, 05:38 PM)johnmay Wrote: [ -> ]when downloading message list from IMAP, using UIDRetrieveAllEnvelopes
I get a list which contains subjects like (reply log from server):
Quote:* 1760 FETCH (UID 12777 FLAGS (\Seen) ENVELOPE ("5 May 2019 07:50:59 +0200" "Test \"quoted text\", more text" (("test" NIL "test" "test.com")) (("test" NIL "test" "test.com")) (("test" NIL "test" "test.com")) ((NIL NIL "test2" "test2.com")) NIL NIL NIL "<msgid@test.com>"))
The problem is the \" escaping of quotes - Indy doesn't seem to decode this properly and the text ends up as Test \
It should be.
UIDRetrieveAllEnvelopes() calls
ParseLastCmdResult(), which calls
ParseIntoBrackettedQuotedAndUnquotedParts() to parse the text inside the outer parenthesis, and that does decode escaped characters. If it is not, I'll have to trace through the parser to find out why not.
(05-27-2019, 05:38 PM)johnmay Wrote: [ -> ]Is this a known bug?
Maybe. It might be a variation of this bug, since it uses the same parser:
#112: TIdIMAP4.ListMailBoxes() does not handle escaped characters
If not, feel free to file a separate bug report for this issue.
Yes RAD Studio 2010, planning upgrade soon. Please ignore the dclIndyCore140.dpk. I tried to recompile and now it worked fine. I probably made a mistake somewhere.
The UIDRetrieveAllEnvelopes() problem is still there though. To be sure, I assigned it to UnicodeStrings and checked their contents directly after downloading - to avoid a problem in my code.
it is easy to produce:
Code:
IMAPClient->SelectMailBox("Inbox");
boost::scoped_ptr<TIdMessageCollection> idmc(new TIdMessageCollection);
IMAPClient->UIDRetrieveAllEnvelopes(idmc.get());
idmc->Messages[0]->Subject // -> contains <Test \> instead of <Test "quoted text"...>
(05-29-2019, 05:00 PM)johnmay Wrote: [ -> ]it is easy to produce:
Maybe for you, but I don't have a working development system right now to run/debug code with. The best I can do right now is review TIdIMAP4's source code (when time permits, which it hasn't lately) looking for any logic errors in the parsing that are not following the rules of
RFC 3501.
UPDATE: I stepped through the logic for parsing the example envelope you posted earlier. In
IdIMAP4.pas, on line 5811 in
ParseIntoBrackettedQuotedAndUnquotedParts(), change this:
AParams.Add(LParamater);
To this:
AParams.Add(ResolveQuotedSpecials(LParamater));
And see if it solves your problem.
You might also need to make a similar change on lines 5700 and 5853, too.