Closed
Bug 366676
Opened 18 years ago
Closed 14 years ago
I am missing a real "New Mail" mail session/folder event
Categories
(Thunderbird :: General, enhancement)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: kenoa, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 Build Identifier: version 1.5.0.9 (20061207) I am the maintainer of the Spamato spam filter extension. As I have to check incoming emails to detect spam messages, it is necessary to be notified about such events. However, there is just no event that really works! WHAT I WANT: A "New Mail" event that is triggered exactly once for each incoming email and has the new email as a parameter. It would also be great to know whether the email has already been downloaded and stored on disk or not. So a second parameter might be necessary. In this case, it is ok two fire the event twice, once for "new mail detected" and once for "new mail completely downloaded." Note that this is almost similar to what the OnItemAdded event is doing. However, as I have explained in more detail in the mozilla.dev.extensions newsgroup: http://groups-beta.google.com/group/mozilla.dev.extensions/browse_thread/thread/1dd4b2ea5c298cab http://groups-beta.google.com/group/mozilla.dev.extensions/browse_thread/thread/d301f86ac666f816 there are many problems with this event. For instance, the OnItemAdded event is also fired when a mail-thread is update, which is very ugly. And sometimes it is not fired at all (I suppose this is another bug by the way...). So all I'm asking for is an event that works correctly :-)! Thanks! Reproducible: Always Expected Results: Fire "OnNewMailArrived" with parameters "newMail" (nsIMsgDBHdr) and boolean "complete" (mainly for IMAP/POP with "headers only": false if mail has not been downloaded yet, true if stored on disk). I'm working on Windows XP but think this is a general problem. I've also tested the OnItemAdded issues on TB 2.0b1 with similar results.
Reporter | ||
Updated•18 years ago
|
Version: unspecified → 1.5
Comment 1•18 years ago
|
||
see https://bugzilla.mozilla.org/attachment.cgi?id=251119 in bug 290057
Reporter | ||
Comment 2•18 years ago
|
||
Looks very interesting (although not completely what I was looking for), would like to test it. Is it part of TB 2.0b1?
Comment 3•18 years ago
|
||
no, it hasn't been checked in anywhere yet. I'm hoping to get it into beta2 I believe you would just want the deal with the itemAdded notifications, QI the item to make sure it's an nsIMsgDBHdr, and go from there. It should only get called when new headers are added to a db from a mail server, but not by a move. (except IMAP is always special, since we don't know why a new header shows up in an IMAP folder). Checking the "new" flag on the header should also tell you if this is a newly arrived message.
Reporter | ||
Comment 4•18 years ago
|
||
Have you been able to put it into beta2?
Comment 5•18 years ago
|
||
Yes, I think it was in beta 2. It's in 2.0 nightly builds for sure.
Reporter | ||
Comment 6•18 years ago
|
||
OK, thanks. I'll give it a try and report back.
Reporter | ||
Comment 7•17 years ago
|
||
I found some time to try it out -- and it works great :-)! I have used the following code to receive "added" events (just for the record): ***************************** var myMsgFolderListener = { itemAdded: function(item) { if (item instanceof Components.interfaces.nsIMsgDBHdr) { if (isMessageNew(item)) { handleNewMessage(item); } } }, itemDeleted: function(item) {}, itemMoveCopyCompleted: function(isMove,srcItems,destFolder) {}, folderRenamed: function(origFolder,newFolder) {}, itemEvent: function(item,event,data) {} } try { var msgFolderNotificationService = Components.classes["@mozilla.org/messenger/msgnotificationservice;1"].getService(Components.interfaces.nsIMsgFolderNotificationService); msgFolderNotificationService.addListener(myMsgFolderListener); } catch (ex) { } ***************************** Is there any reason why the service is not at @mozilla.org/messenger/services/...? Thanks for the new event :-).
Updated•16 years ago
|
Assignee: mscott → nobody
Comment 8•14 years ago
|
||
> I found some time to try it out -- and it works great
=> WFM per reporter
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•