added functions to run scripts on new / no new mail... should be working

This commit is contained in:
David Wille 2012-05-13 21:35:42 +02:00
parent 496dce296c
commit 51edcf4377
1 changed files with 32 additions and 0 deletions

View File

@ -138,6 +138,36 @@ firetray.Messaging = {
}
}
},
runNewMailScript: function() {
// create a file for the process
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(firetray.Utils.prefService.getCharPref("new_mail_script"));
// create the process
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
var args = [ ];
process.run(false, args, args.length);
},
runNoNewMailScript: function() {
// create a file for the process
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(firetray.Utils.prefService.getCharPref("no_new_mail_script"));
// create the process
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
var args = [ ];
process.run(false, args, args.length);
},
/**
* computes and display new msg count
@ -168,8 +198,10 @@ firetray.Messaging = {
if (newMsgCount == 0) {
firetray.Handler.setIconImageDefault();
firetray.Handler.setIconTooltipDefault();
this.runNoNewMailScript();
} else if (newMsgCount > 0) {
this.runNewMailScript();
let prefMailNotification = firetray.Utils.prefService.getIntPref('mail_notification_type');
switch (prefMailNotification) {
case FIRETRAY_NOTIFICATION_UNREAD_MESSAGE_COUNT: