In what way can I add properties to nsIMsgHdr and make Gloda reflect those properties?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

In what way can I add properties to nsIMsgHdr and make Gloda reflect those properties?

Lin Han-3
Hi. I am planning some functions that requires me to add some new properties to message headers. I also need to make Gloda reflect those properties so that the e-mails can be displayed real-time in the search folder.  Is there any way I can achieve these?
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: In what way can I add properties to nsIMsgHdr and make Gloda reflect those properties?

Andrew Sutherland-3
On 03/27/2012 12:27 AM, Lin Han wrote:
> Hi. I am planning some functions that requires me to add some new properties to message headers. I also need to make Gloda reflect those properties so that the e-mails can be displayed real-time in the search folder.  Is there any way I can achieve these?

nsIMsgDBHdr instances have get/set property variants:
http://mxr.mozilla.org/comm-central/source/mailnews/base/public/nsIMsgHdr.idl#46

To contribute attributes to gloda representations, you need to define
attributes and associate them with an attribute provider.  Note that if
you aren't intending to surface the properties in the faceted search
results (as a facet) and you aren't intending to use Gloda otherwise,
then you probably don't need to have gloda index the properties you are
adding.

protz's Thunderbird Conversations is probably the only shipping example
of an extension contributing to the gloda representation:
https://github.com/protz/GMail-Conversation-View/blob/master/modules/plugins/glodaAttrProviders.js

The docs on indexing also link to the built-in attribute providers which
may also provide some insight:
https://developer.mozilla.org/en/Thunderbird/Gloda_indexing

And here's the actual registration call and its docs:
http://mxr.mozilla.org/comm-central/source/mailnews/db/gloda/modules/gloda.js#1612


After you manipulate the message header, you may need to kick gloda to
tell it to index a message if an event is not automatically generated
that gloda listens for.  The easiest way is probably to import
index_msg.js and call GlodaMsgIndexer.indexMessages:
http://mxr.mozilla.org/comm-central/source/mailnews/db/gloda/modules/index_msg.js#2012


You will want to turn on gloda's "dump" logging to see what it is up to
and whether your indexer is doing the right thing:
https://developer.mozilla.org/en/Thunderbird/Gloda_debugging


Andrew
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird