Topic RSS
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
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.
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.
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!
Most Users Ever Online: 18
Currently Online:
10 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Member Stats:
Guest Posters: 130
Members: 565
Moderators: 1
Admins: 1
Forum Stats:
Groups: 1
Forums: 7
Topics: 231
Posts: 802
Newest Members: Matteo, p.dobrogost, gaute, Mythobeast, terry, Livraria Notre Dame
Moderators: rkent (323)
Administrators: rkent (323)
Log In
Register
Members
Home
Add Reply
Add Topic
Offline
Quote

Recent Comments