From de2a756fc8ddbaf389174d1688e278e5b6930adb Mon Sep 17 00:00:00 2001 From: foudfou Date: Tue, 4 Sep 2012 10:50:17 +0200 Subject: [PATCH] enable Chat only in Thunderbird (not Seamonkey!) --- TODO | 2 -- src/modules/FiretrayHandler.jsm | 7 +++++-- src/modules/FiretrayMessaging.jsm | 10 ++++++---- src/modules/linux/FiretrayWindow.jsm | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index 5ae95ff..861ada5 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,6 @@ TODO ---- -* no Chat in Seamonkey ! - WONTFIX ------- diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm index af7226d..0e7d83f 100644 --- a/src/modules/FiretrayHandler.jsm +++ b/src/modules/FiretrayHandler.jsm @@ -33,6 +33,7 @@ firetray.Handler = { initialized: false, inBrowserApp: false, inMailApp: false, + appHasChat: false, appStarted: false, windows: {}, windowsCount: 0, @@ -59,7 +60,7 @@ firetray.Handler = { // version checked during install, so we shouldn't need to care let xulVer = Services.appinfo.platformVersion; // Services.vc.compare(xulVer,"2.0a")>=0 - log.debug("OS=" + this.runtimeOS + ", ABI=" + this.runtimeABI + ", XULrunner=" + xulVer); + log.info("OS=" + this.runtimeOS + ", ABI=" + this.runtimeABI + ", XULrunner=" + xulVer); switch (this.runtimeOS) { case "Linux": Cu.import("resource://firetray/linux/FiretrayStatusIcon.jsm"); @@ -76,7 +77,9 @@ firetray.Handler = { this.inMailApp = true; if (this.appId === FIRETRAY_FIREFOX_ID || this.appId === FIRETRAY_SEAMONKEY_ID) this.inBrowserApp = true; - log.debug('inMailApp: '+this.inMailApp+', inBrowserApp: '+this.inBrowserApp); + if (this.appId === FIRETRAY_THUNDERBIRD_ID && Services.vc.compare(xulVer,"15.0")>=0) + this.appHasChat = true; + log.info('inMailApp='+this.inMailApp+', inBrowserApp='+this.inBrowserApp+', appHasChat='+this.appHasChat); this.appStartupTopic = this.getAppStartupTopic(this.appId); diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm index 742e131..84e425b 100644 --- a/src/modules/FiretrayMessaging.jsm +++ b/src/modules/FiretrayMessaging.jsm @@ -10,7 +10,6 @@ Cu.import("resource:///modules/mailServices.js"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/PluralForm.jsm"); Cu.import("resource://firetray/commons.js"); -Cu.import("resource://firetray/FiretrayChat.jsm"); const FLDRS_UNINTERESTING = { Archive: Ci.nsMsgFolderFlags.Archive, @@ -47,10 +46,13 @@ firetray.Messaging = { MailServices.mailSession.AddFolderListener(that.mailSessionListener, that.mailSessionListener.notificationFlags); - if (Services.prefs.getBoolPref("mail.chat.enabled") && + if (firetray.Handler.appHasChat && + Services.prefs.getBoolPref("mail.chat.enabled") && firetray.Utils.prefService.getBoolPref("chat_icon_enable") && - this.existsChatAccount()) + this.existsChatAccount()) { + Cu.import("resource://firetray/FiretrayChat.jsm"); firetray.Chat.init(); + } this.initialized = true; }, @@ -59,7 +61,7 @@ firetray.Messaging = { if (!this.initialized) return; log.debug("Disabling Messaging"); - if (firetray.hasOwnProperty('Chat')) firetray.Chat.shutdown(); + if (firetray.Handler.appHasChat) firetray.Chat.shutdown(); MailServices.mailSession.RemoveFolderListener(this.mailSessionListener); diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm index 6c43ac3..1f3163f 100644 --- a/src/modules/linux/FiretrayWindow.jsm +++ b/src/modules/linux/FiretrayWindow.jsm @@ -588,7 +588,7 @@ firetray.Handler.registerWindow = function(win) { this.windows[xid].filterWindowCb = gdk.GdkFilterFunc_t(firetray.Window.filterWindow); gdk.gdk_window_add_filter(gdkWin, this.windows[xid].filterWindowCb, null); - if (firetray.Handler.inMailApp && firetray.Chat.initialized) { // missing import ok + if (firetray.Handler.appHasChat && firetray.Chat.initialized) { // missing import ok Cu.import("resource://firetray/linux/FiretrayChatStatusIcon.jsm"); firetray.ChatStatusIcon.attachOnFocusInCallback(xid); }