GNOME Bugzilla – Bug 621842
imapx fetches flags for non-existent mails.
Last modified: 2010-06-17 09:51:46 UTC
adding command, fmt = 'SELECT %f' got folder 'Deleted Items' completing command buffer is [22] 'SELECT "Deleted Items"' Staring command (active=1,) B00706 SELECT "Deleted Items" camel_imapx_write: 'B00706 SELECT "Deleted Items" ' camel_imapx_read: buffer is '* 0 EXISTS * 0 RECENT * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent) * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags * OK [UIDVALIDITY 777] UIDVALIDITY value * OK [UIDNEXT 185] The next unique identifier value B00706 OK [READ-WRITE] SELECT completed. ' got untagged response Have token 'EXISTS' id 0 exists: 0 got untagged response Have token 'RECENT' id 0 recent: 0 got untagged response Have token 'FLAGS' id 0 flags: 0000001f got untagged response Have token 'OK' id 0 got untagged response Have token 'OK' id 0 got untagged response Have token 'OK' id 0 Got completion response for command 00706 'SELECT' Select ok! ** Starting next command - we're selected on 'Deleted Items', current jobs? -- Checking job queue -- 0 'FETCH'? --> starting 'FETCH' Staring command (active=1,) B00705 FETCH 1:* (UID FLAGS) camel_imapx_write: 'B00705 FETCH 1:* (UID FLAGS) ' [Thread 0x7fff92c54710 (LWP 4192) exited] camel_imapx_read: buffer is 'B00705 NO The specified message set is invalid. ' Yeah, '0 EXISTS' is a bit of a hint that 'FETCH 1:*' isn't going to do anything useful.
Created attachment 163884 [details] [review] 3am patch I think this probably fixes it; if not it's a step in the right direction. It also fixes bug #621765 while I'm at it. We were explicitly selecting a folder before issuing STATUS on it, despite that being forbidden by RFC3501. This fixes the code to update ifolder->exists_on_server according to the STATUS response, which was missed before. Then when the STATUS indicates that there are no messages in the folder; don't bother issuing the offending FETCH 1:* command -- just empty the folder summary. We do need to double-check that that code path will only be reached if there are _really_ no messages on the server (hence the change to the condition for running the STATUS command). I need to think harder about whether that's sufficient, when it's not 3am. That change also fixes the fact that we were fetching the full set of flags at startup, even when nothing had changed. However, we ought to be (asking for and) comparing UIDNEXT too, just to make sure we're not missing a change.
Looks like we need to add UIDNEXT (and UIDVALIDITY!!!) to CamelIMAPXSummary?
Oh, alternatively we could just use UID FETCH instead of FETCH. That is required by RFC3501 to just give empty results rather than bitching. The rest of the patch is still useful though. Will sort it out in the morning.
To ssh://dwmw2@git.gnome.org/git/evolution-data-server a447772..4d07423 gnome-2-30 -> gnome-2-30 87186ef..fcbb042 master -> master