Confirmed users
1,059
edits
No edit summary |
|||
| Line 4: | Line 4: | ||
# [[User:Clarkbw/Install_STEEL_Extension|Install the STEEL Extension]] | # [[User:Clarkbw/Install_STEEL_Extension|Install the STEEL Extension]] | ||
# Write Extensions that use the [[User:Jminta/Steel|STEEL API]] | # Write Extensions that use the [[User:Jminta/Steel|STEEL API]] | ||
''I recommend using the [http://ted.mielczarek.org/code/mozilla/extensionwiz/ extension wizard] to create your base extension, then copy / paste the example code.'' | |||
'''Here are some working examples of code using the STEEL API.''' | '''Here are some working examples of code using the STEEL API.''' | ||
| Line 44: | Line 46: | ||
Application.console.log("handleEvent (msg.flagged): " + msg.flagged); | Application.console.log("handleEvent (msg.flagged): " + msg.flagged); | ||
Application.console.log("handleEvent (msg.priority): " + msg.priority); | Application.console.log("handleEvent (msg.priority): " + msg.priority); | ||
Application.console.log("handleEvent (msg._xpcomMsg): " + msg._xpcomMsg); | Application.console.log("handleEvent (msg._xpcomMsg): " + msg._xpcomMsg); | ||
}, | }, | ||
| Line 53: | Line 54: | ||
''The [http://developer.mozilla.org/en/docs/Extensions:Thunderbird:HowTos#How_do_I_watch_for_new_Mail.3F old version of watching for new mail] still works'' | ''The [http://developer.mozilla.org/en/docs/Extensions:Thunderbird:HowTos#How_do_I_watch_for_new_Mail.3F old version of watching for new mail] still works'' | ||
== Watch for Sent Mail == | |||
<pre> | |||
var steelyoursentmail = { | |||
onLoad: function() { | |||
// initialization code | |||
this.initialized = true; | |||
this.strings = document.getElementById("steelyoursentmail-strings"); | |||
// FIXME: currently we have to add our listener for new mail arriving in all folders | |||
for (var i = 0; i < Application.accounts.all.length; i++) { | |||
for (var j = 0; j < Application.accounts.all[i].folders.length; j++) { | |||
if ( Application.accounts.all[i].folders[j].name == "Sent" ) { | |||
Application.console.log("looking in folder: " + Application.accounts.all[i].folders[j].name); | |||
Application.accounts.all[i].folders[j].events.addListener("newMail", steelyoursentmailListener); | |||
} | |||
} | |||
} | |||
}, | |||
}; | |||
var steelyoursentmailListener = { | |||
handleEvent : function (event) { | |||
var msg = event.data; | |||
Application.console.log("handleEvent: " + event.type); // newMail | |||
Application.console.log("handleEvent (msg.id): " + msg.id); | |||
Application.console.log("handleEvent (msg.to): " + msg.to); | |||
Application.console.log("handleEvent (msg.cc): " + msg._xpcomMsg.ccList); | |||
Application.console.log("handleEvent (msg.date): " + msg.date); | |||
Application.console.log("handleEvent (msg.subject): " + msg.subject); | |||
// Now we could file this into different directories | |||
}, | |||
}; | |||
window.addEventListener("load", function(e) { steelyoursentmail.onLoad(e); }, false); | |||
</pre> | |||