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

How to get all messages (headers) in folder or scan through them

38 views
Skip to first unread message

Teemu Hautala

unread,
Apr 22, 2009, 7:08:40 PM4/22/09
to
Hi,

Once again, I hit a kind of a brick wall... How could I go through all
the messages in a given Thunderbird message folder, namely I want to
process their headers (not only new/unread messages, but all of them).

I am developing an extension which will sort and gather information
about messages, but currently it only processes messages which are
received while TB is running. I need functionality to scan for new
messages at startup, and manually scan a folder initiated by user. As a
starting point I just have the nsIMsgFolder element.

nsIMsgFolder has a method getMessages(), but I'm not sure what it
actually does or how you're supposed to use it. Didn't find any good
reference for it so far. Or should I use the search functionality somehow?

Thanks.

Teemu Hautala

unread,
Apr 22, 2009, 7:56:48 PM4/22/09
to
Teemu Hautala wrote:
> Hi,
>
> Once again, I hit a kind of a brick wall... How could I go through all
> the messages in a given Thunderbird message folder, namely I want to
> process their headers (not only new/unread messages, but all of them).

And again, managed to get the getMessages() work just little after
sending a message:

iMessages = aFolders[0].getMessages(null); // get the messages

while(iMessages.hasMoreElements()) {
var iHdr =
iMessages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
// doing something with the hdr
}

Now just have some issues with timing or variable scope, because that
while loop only succeeds to process the first message... but I guess
that will be solved tomorrow, hopefully.


0 new messages