views:

25

answers:

1

I want to make a thunderbird extension. So the first question is where to get started. Can you point me to some sample extensions in which I can plug in my code? This will significantly reduce the effort. I presume what we would write some javascript files along with some configuration files for writing an extension. Is that write?

That said, I want to invoke a Java program in a class file/jar from the extension. The extension should be able to pass a specific email in the inbox (with all the headers) to the java method.

In addition I want to return some value from the java method to my extension.

How can this be achieved?

+1  A: 

Writing an extension is more than writing some JS files and configuration. Depending upon what you want to do, you'll need to call the underlying Mozilla XPCOM APIs. Mozilla has some great documentation, references and tutorials for getting started with extensions development at https://developer.mozilla.org/En.

Coming to the Java issue, there is a project called JavaXPCOM which provided capability to access Java programs from XPCOM and vice-versa. So you need to follow the documentation provided there to call your Java code from JavaScript. However note that, JavaXPCOM was included in XULRunner up through version 1.9.2 and it has been removed in XULRunner 2. Thunderbird 3 series is built upon XULRunner 1.9.2, but the future series will be build upon XULRunner 2. So in future, you'll need to build and ship JavaXPCOM with your extension itself.

So my suggestion is, go through the documentation and reference for the extension development and see if your Java code can be translated to JavaScript using the Mozilla APIs provided. If it is not possible, try to write it in C++ as Mozilla has built-in support for C++ XPCOM components. Given the large number of APIs provided, it should be possible for do so.

abhin4v