Counting unread messages problem with uncommon IMAP folder structure #44

vimftw opened this Issue Jun 3, 2012 · 7 comments


None yet

3 participants

vimftw commented Jun 3, 2012

My system:
Debian Wheezy x86
Thunderbird 12.0.1
FireTray 0.4.2

First of all, thank you very much to foudfou and the other contributors for this rewrite of a great extension. You've done a great job so far!

I've been noticing a small bug with accounts that have this uncommon IMAP folder structure: Everything is a subfolder of Inbox, including Drafts, Sent, Junk, etc., see this screenshot:


(Don't ask me why one of my ISPs has this uncommon type of structure -- I'm not able to change it unfortunately. Maybe I should ask them if they could change it for me...)

For the sake of completeness, in my view a common structure (which doesn't cause the problem described in the following paragraph) should look like this :


Anyway, the problem is that -- although I have, e.g., unchecked Drafts in the included special folders list -- unread messages in this subfolder are still counted. There is one restriction though: The counter is not updated until a new message comes in or I mark a message as unread in any of the folders that are not in the excluded folders list. Same applies for the inverse direction, i.e., if I mark the message in the Drafts subfolder as read again, the counter won't be updated (decreased by one) until something has changed in the other folders that are not in the excluded folders list.

If I check Drafts in the included special folders list, the event for updating the message count fires immediately when messages inside Drafts are marked as unread. Hence, in this case, the Drafts folder is recognized as such although it's still a subfolder of Inbox.

I've already had a look at the source code but I'm still not sure what causes this bug.

Any clues?

Cybso commented Jun 7, 2012

The reason is that the check for excludedFoldersFlags is done in countMessages() for each parent folder. If a parent folder is excluded, all of it's childs would be excluded, too (even with my patch from #21). If a parent folder is included, the check won't be repeated for any child folder.

vimftw commented Jun 7, 2012

Oh yes, got it, of course you're right and you've even fixed it already. Thank you!

foudfou commented Jun 13, 2012

Sorry I haven't looked closely at this issue yet, but you may be interested about:
Account settings > Server Settings > Advanced > IMAP server directory: [Gmail]
This produces a "flat" structure, with all folders included in Inbox at the same level.

vimftw commented Jun 14, 2012

No worries!

Thanks for the tip -- doesn't seem to work with the particular IMAP server I use, though (it just has no effect).

foudfou commented Jul 9, 2012

Fixed by Cybso. I hope to be able to include the patch on #45 soon.

foudfou commented Sep 4, 2012

I merged Cybso's fix but worked further on the message counting. I believe it's working correctly, so I'll close this issue. If you feel otherwise, please re-open it.

@foudfou foudfou closed this Sep 4, 2012
vimftw commented Sep 4, 2012

I'll check it out soon, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment