Thunderbid扩展名:打开EML文件 [英] Thunderbid extension: open eml file
问题描述
我已经创建了执行以下操作的扩展程序:
I already created an extension that does the following:
当我使用命令行thunderbird -MyCustomParam1 "12345"
运行Thinderbird时,我的扩展程序将打开一个撰写窗口,并将参数"12345"
添加到该窗口中.
When I run Thinderbird with the command line thunderbird -MyCustomParam1 "12345"
my extension will open a compose window and add the parameter "12345"
to the window.
我使用的一些代码:
// In the calling code
var args = {
param1: 12345,
};
args.wrappedJSObject = args;
var watcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
watcher.openWindow(null, url, windowName, features, args);
// In the window code
var args = window.arguments[0].wrappedJSObject;
当然要使用正确的网址和功能.
Of course using the correct url and features.
现在,我想做同样的事情,但是对于消息窗口和选择的eml
文件.
Now I want to do the same, but for the message window and with am eml
file that is choose.
您可以从命令行打开eml
文件,如下所示:Thunderbird test.eml
(这将在新窗口中打开邮件).
You can open an eml
file from the command line like this: Thunderbird test.eml
(this will open the mail in a new window).
我想要的是以下内容:
Thunderbird test.eml -MycustomParam1 "1234"
应该打开邮件,并将参数"1234"
添加到屏幕上,以便我可以在文档窗口中访问它,就像示例1一样.
Thunderbird test.eml -MycustomParam1 "1234"
should open the mail, and add the param "1234"
to screen, so I can access it in the document window, just like example 1.
所以基本上我想要类似watcher.openWindow
的东西,但是要有给定的eml
文件.
So basically I want something like watcher.openWindow
, but with a given eml
file.
有什么想法吗?
推荐答案
您可以在eml文件(从文件路径中获取nsIFile实例),将其转换为URI ,然后进行更改打开消息窗口之前的查询字符串:
You can see how this is done in the MsgOpenFromFile
function, it is being called for the File / Open Saved Message menu item. You basically have to take the eml
file (get an nsIFile instance from file path), turn it into a URI and then change the query string before opening a message window:
uri.QueryInterface(Components.interfaces.nsIURL);
uri.query = "type=application/x-message-display";
watcher.openWindow(null, "chrome://messenger/content/messageWindow.xul", "_blank",
"all,chrome,dialog=no,status,toolbar", uri);
这篇关于Thunderbid扩展名:打开EML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!