User:Clarkbw/STEEL Examples: Difference between revisions
Jump to navigation
Jump to search
(initial example code) |
(No difference)
|
Revision as of 18:48, 19 March 2008
var steelyournewmail = {
onLoad: function() {
// initialization code
this.initialized = true;
this.strings = document.getElementById("steelyournewmail-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++) {
Application.console.log("looking in account: " + Application.accounts.all[i].displayName);
for (var j = 0; j < Application.accounts.all[i].folders.length; j++) {
Application.console.log("looking in folder: " + Application.accounts.all[i].folders[j].name);
Application.accounts.all[i].folders[j].events.addListener("newMail", steelyournewmailListener);
}
}
},
};
var steelyournewmailListener = {
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.from): " + msg.from);
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);
Application.console.log("handleEvent (msg.unread): " + msg.unread);
Application.console.log("handleEvent (msg.flagged): " + msg.flagged);
Application.console.log("handleEvent (msg.priority): " + msg.priority);
Application.console.log("handleEvent (msg.attachments): " + msg.attachments);
Application.console.log("handleEvent (msg._xpcomMsg): " + msg._xpcomMsg);
},
};
window.addEventListener("load", function(e) { steelyournewmail.onLoad(e); }, false);