Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Thunderbird Message - Junk Flag

20 views
Skip to first unread message

Matt

unread,
Jul 7, 2009, 11:01:42 AM7/7/09
to
I am new to mozilla development so I will go ahead an apologize. I
have looked through MDC for a several days looking to see how to read
a junk flag on a message and have found nothing. Let me explain. I
have added a listener to notify me when new messages arrive in the
inbox, like so:

var msgFolderNotificationService = Components.classes["@mozilla.org/
messenger/msgnotificationservice;1"].
getService
(Components.interfaces.nsIMsgFolderNotificationService);
msgFolderNotificationService.addListener(myInboxListener);

The listener appears to be working fine. I created a variable called
myInboxListener and added an alert to the itemAdded function. The
alert pops up fine to tell me I have a new message. I am trying to
determine if Thunderbird has marked this message as junk. When the
alert first pops up, I can see that the message is sitting in the
inbox. I can also see that Thunderbird has already marked this message
as junk. It just has not moved it to the junk folder yet. I have found
an isRead property for the message that can tell me if the message has
been read or not. Code for variable like so:

var mgFolderListener = {
itemAdded: function(item)
{

if (item instanceof Components.interfaces.nsIMsgDBHdr)
{
alert("Has message been read" + item.isRead);
}
}

}

My question, is there a property to see if Thunderbird has marked this
as junk or not? I would greatly appreciate any help. Thanks in
advance.
Matthew Grant

Matt

unread,
Jul 7, 2009, 11:41:01 AM7/7/09
to

Kent James

unread,
Jul 7, 2009, 12:04:38 PM7/7/09
to

That article is correct. But to clarify, junk status is determined by
the message header property "junkscore". It can have one of three string
values: "100" means the message is junk, "0" means not junk, and null or
blank means the message has not been evaluated. From your previous code
example, where "item" is an nsIMsgDBHdr object, you read the junkscore
in js using:

junkscore = item.getStringProperty("junkscore");

It's a little confusing, because the property was defined long ago as a
string, and given numerical "values", but it is really a tristate.

rkent

0 new messages