Forum

Share

Please consider registering
guest

Log In RegisterMembers
Or log in with

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Tag thread parent message?
December 7, 2010
12:19 pm
Member
Forum Posts: 4
Member Since:
December 7, 2010
Offline

Hello rkentjames!

 

Thanl you for the great plugin. It looks like the plugin should allow me to implement my old dream — to tag the root message of the thread based on the message received.

 

I am ready to spend some time and learning TB object model, but may be you have some ready code which would save me hours of learning? It would be greate to have something to start from. All what I need is to find the root message of the thread where the current message is and add/remove the pre-defined tag to the root message.

 

Thank you!

Maxim

Share
December 7, 2010
12:41 pm
Member
Forum Posts: 4
Member Since:
December 7, 2010
Offline

As I can see, in filter context that is simple:

try {
          thread = message.folder.msgDatabase.GetThreadContainingMsgHdr(message);
          rootHdr = thread.getChildHdrAt(0);
} catch (e) {
          rootHdr = message;
}

But message does not look to be available in action context :-(

Share
December 7, 2010
1:49 pm
Member
Forum Posts: 4
Member Since:
December 7, 2010
Offline

Looks to be so:

for (let index = 0; index < msgHdrs.length; index++) {
  let hdr = msgHdrs.queryElementAt(index, Ci.nsIMsgDBHdr);
  try{
    let rootMsg = hdr.folder.msgDatabase.GetThreadContainingMsgHdr(hdr).getChildHdrAt(0);
    if (hdr.messageId != rootMsg.messageId){
      rootMsg.setStringProperty('keywords', 'key-for-new-tag-here');
    }
  }
  catch(e){
    ;
  }
}

The last issue is what the code above works in context of folder, but if I move the message to the folder where I have the threaded view (with other filter), my new filder is not applied automatically. Probably I should combine these filters (though I wouldn't like that) — need to try.

Share
December 7, 2010
5:25 pm
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

The handling of a move combined with other filter actions is indeed frequently quite difficult, and is a common source of frustration.

For IMAP, I believe that it is possible to set a folder flag to allow message filters to run on those other folders, but you have to be careful of filter loops. That is, you might need to detect if the message is in the inbox and not apply the filter.

For non-IMAP types, what you would have to do in the filter action is to define a multiple step listener that performs the action in the new folder when the move is complete.  Within the FiltaQuilla code, there is the example copyAsRead which does this. But if you check the code (in file filtaquilla.js) you will see it gets fairly complex.

Share
December 8, 2010
7:24 am
Member
Forum Posts: 4
Member Since:
December 7, 2010
Offline

I tried to set the Apply Incoming Fields setting for the IMAP destination folder where the new message is moved, but failed to get even a simple "alert" code. I wrote 2 rules, one moved the message to the destination folder, other displayed the alert for the new message, but the 2nd rule did not work.

For now I run the filter manually, that is much better than nothing, but I will check your advises too.

Thank you!

Share
Forum Timezone: UTC -8

Most Users Ever Online: 18

Currently Online:
10 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

bobkatz: 8

BigMike: 8

t2m: 7

zabolyx: 7

taa: 6

onlyme: 6

Member Stats:

Guest Posters: 130

Members: 565

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 7

Topics: 231

Posts: 802

Moderators: rkent (323)

Administrators: rkent (323)