Closed gekrap closed 1 year ago
Thanks for the detailed report. Probably you are right, there must be a notification mechanism in the IMAP. That's something I have to deal with - not a trivial change. Let me finish adding the tests for the MIME format, release the new version, and I am starting with this and few other IMAP features.
I think I found the reason for the tag mismatch:
search()
throws an imap_error("Search mailbox failure.")
when encountering the EXISTS
response, because obviously there's no SEARCH
keyword. That means that in the buffer for receive()
there's still the tag OK
response that doesn't get read, but is left for the next receive()
call to read, which then happens to expect the responses to the next SEARCH
request, but gets responses to the last one, which again leads to an error being thrown, which leads to even more uncared-for responses clogging the receiving buffer.
Thanks for the info, I will investigate it.
I managed to reproduce the issue and the fix is here. It is not related to the missing idle feature.
Affected version:
I was trying the new UNSEEN search condition branch in a client, and added some very rough logging of the lines that are actually transmitted between server and client. patch file
Steps to reproduce:
Expected result:
After the next call of
imap::search
(see above), return that new message inunseen_msg_numbers
. Compliance with RFC 3501 would also mean that I somehow get notified of the EXISTS response as a user or application build with mailio as a library. (Maybe related to #46?)Observed result:
This is the complete log of server-client communication plus any mailio errors that are thrown on the way:
The 'tag mismatch' between SEARCH command and response will go on like this forever, and increment with every unsolicited response, be it another EXISTS, RECENT, or FETCH response (the latter e.g. after an old message is marked unread with another client.) I've tested a second server more or less with the same result, other than the fact that the second server sends an EXISTS and a RECENT response for every received message, so each increments the tag mismatch by 2.