Mailnews New Management: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 13: Line 13:
m_saveNewMsgs is "previous set of new msgs, which we might want to run junk controls on. This is in addition to "new" hdrs
m_saveNewMsgs is "previous set of new msgs, which we might want to run junk controls on. This is in addition to "new" hdrs
in the db, which might get cleared because the user clicked away from the folder." That is, the concept of "new" is overloaded to mean both 1) messages that should count as "new" as displayed by the UI, and 2) recent messages that still need processing. Seems to me these concepts ought to be better separated.
in the db, which might get cleared because the user clicked away from the folder." That is, the concept of "new" is overloaded to mean both 1) messages that should count as "new" as displayed by the UI, and 2) recent messages that still need processing. Seems to me these concepts ought to be better separated.
The folder attribute numNewMessages (which is the folder object mNumNewBiffMessages) could be replaced perhaps by a pending count of undownloaded messages plus the count of the database m_newList. As far as I can tell, this is mostly used in the folder tray icon. Most (all?) other uses of GetNumNewMessages are associated with maintaining that count, that is are followed by SetNumNewMessages with a delta value.

Revision as of 20:15, 16 June 2014

The folder m_newMsgs array stores the items from the database m_newSet during the time when the database is unloaded.

The folder hasNewMessages is the main item that the UI looks at to set the New decoration on the folder. Method UpdateNewMessages, which only gets called when the database is first opened in Local and Imap folder, also does SetHasNewMessages based on the contents of m_newMsgs. I suspect that hasNewMessages is meant as a way to retrieve whether there are new messages without opening the database. That implies that when the database IS open, it is appropriate to SetHasNewMessages to match the m_newList in the database.

nsMsgDBFolder has this cryptic code and comment:

 //GGGG       check for new mail here and call SetNewMessages...?? -- ONE OF THE 2 PLACES
 if(mDatabase)
   m_newMsgs.Clear();

What I believe the code is doing is, if the database is open, there is no need for m_newMsgs, so clear it to free up memory.

m_saveNewMsgs is "previous set of new msgs, which we might want to run junk controls on. This is in addition to "new" hdrs in the db, which might get cleared because the user clicked away from the folder." That is, the concept of "new" is overloaded to mean both 1) messages that should count as "new" as displayed by the UI, and 2) recent messages that still need processing. Seems to me these concepts ought to be better separated.

The folder attribute numNewMessages (which is the folder object mNumNewBiffMessages) could be replaced perhaps by a pending count of undownloaded messages plus the count of the database m_newList. As far as I can tell, this is mostly used in the folder tray icon. Most (all?) other uses of GetNumNewMessages are associated with maintaining that count, that is are followed by SetNumNewMessages with a delta value.