keyconfigなどのコマンドとして使う。
if (gFolderDisplay.selectedMessage) {
MsgHdrToMimeMessage(gFolderDisplay.selectedMessage, null,
function (aMsgHdr, aMimeMessage) {
var getFirstPlaintext = function f(ms) {
for (var i = 0; i < ms.length; i++) {
if (ms[i].contentType == "text/plain") {
return ms[i].body;
} else if (ms[i].contentType.startsWith("multipart/")) {
var t = f(ms[i].parts);
if (t) {
return t;
}
} }
};
var t = getFirstPlaintext(aMimeMessage.parts);
if (t) {
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyString(t);
}
} );
}