From 764b6162b99c53cbd9d127edf54ae06c8af1fdbc Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Thu, 1 Jul 2004 02:43:02 +0000 Subject: [PATCH] Bug #216133 --> port thunderbird changes for the new content policy manager from the branch to the trunk. --- mail/app/profile/thunderbird.js | 2 + mail/base/content/mailWindow.js | 1 + mail/base/content/mailWindowOverlay.js | 52 ++++++++++++++-- mail/base/content/mailWindowOverlay.xul | 7 +++ mail/base/content/messageWindow.xul | 1 + mail/base/content/messenger.xul | 1 + mail/base/content/msgHdrViewOverlay.js | 14 ++++- mail/base/content/msgMail3PaneWindow.js | 1 + mail/base/locale/messenger.dtd | 4 ++ .../resources/content/msgHdrViewOverlay.js | 4 ++ mailnews/base/src/nsMsgContentPolicy.cpp | 62 +++++++++++++++++++ .../src/nsBayesianFilter.cpp | 6 ++ mailnews/mime/public/nsIMimeMiscStatus.idl | 3 + 13 files changed, 151 insertions(+), 7 deletions(-) diff --git a/mail/app/profile/thunderbird.js b/mail/app/profile/thunderbird.js index 90edf3d90f9..0609d200cd3 100644 --- a/mail/app/profile/thunderbird.js +++ b/mail/app/profile/thunderbird.js @@ -108,6 +108,8 @@ pref("mailnews.hints_and_tips.url","chrome://messenger-region/locale/region.prop pref("compose.throbber.url","chrome://messenger-region/locale/region.properties"); pref("addressbook.throbber.url","chrome://messenger-region/locale/region.properties"); +pref("network.image.imageBehavior", 2); + ///////////////////////////////////////////////////////////////// // End seamonkey suite mailnews.js pref overrides ///////////////////////////////////////////////////////////////// diff --git a/mail/base/content/mailWindow.js b/mail/base/content/mailWindow.js index 0d13e5aac33..23f4399c880 100644 --- a/mail/base/content/mailWindow.js +++ b/mail/base/content/mailWindow.js @@ -459,6 +459,7 @@ function loadStartPage() { try { // collapse the junk bar SetUpJunkBar(null); + SetUpRemoteContentBar(null); var startpageenabled = pref.getBoolPref("mailnews.start_page.enabled"); diff --git a/mail/base/content/mailWindowOverlay.js b/mail/base/content/mailWindowOverlay.js index e81eb2a72eb..1611e336638 100644 --- a/mail/base/content/mailWindowOverlay.js +++ b/mail/base/content/mailWindowOverlay.js @@ -34,6 +34,14 @@ const kClassicMailLayout = 0; const kWideMailLayout = 1; const kVerticalMailLayout = 2; +// Per message headder flags to keep track of whether the user is allowing remote +// content for a particular message. +// if you change or add more values to these constants, be sure to modify +// the corresponding definitions in nsMsgContentPolicy.cpp +const kNoRemoteContentPolicy = 0; +const kBlockRemoteContent = 1; +const kAllowRemoteContent = 2; + var gMessengerBundle; var gPromptService; var gOfflinePromptsBundle; @@ -2048,6 +2056,41 @@ function SetUpJunkBar(aMsgHdr) return (isJunk && isAlreadyCollapsed) || (!isJunk && !isAlreadyCollapsed); } +// hides or shows the remote content bar based on the property in the msg hdr +function SetUpRemoteContentBar(aMsgHdr) +{ + var showRemoteContentBar = false; + if (aMsgHdr && aMsgHdr.getUint32Property("remoteContentPolicy") == kBlockRemoteContent) + showRemoteContentBar = true; + + var remoteContentBar = document.getElementById("remoteContentBar"); + + if (showRemoteContentBar) + remoteContentBar.removeAttribute("collapsed"); + else + remoteContentBar.setAttribute("collapsed","true"); +} + +function LoadMsgWithRemoteContent() +{ + // we want to get the msg hdr for the currently selected message + // change the "remoteContentBar" property on it + // then reload the message + + var msgURI = GetLoadedMessage(); + var msgHdr = null; + + if (msgURI && !(/type=x-message-display/.test(msgURI))) + { + msgHdr = messenger.messageServiceFromURI(msgURI).messageURIToMsgHdr(msgURI); + if (msgHdr) + { + msgHdr.setUint32Property("remoteContentPolicy", kAllowRemoteContent); + MsgReload(); + } + } +} + function MarkCurrentMessageAsRead() { gDBView.doCommand(nsMsgViewCommandType.markMessagesRead); @@ -2082,13 +2125,10 @@ function OnMsgLoaded(aUrl) if (!folder || !msgURI) return; - if (/type=x-message-display/.test(msgURI)) - SetUpJunkBar(null); - else - { + if (!(/type=x-message-display/.test(msgURI))) msgHdr = messenger.messageServiceFromURI(msgURI).messageURIToMsgHdr(msgURI); - SetUpJunkBar(msgHdr); - } + + SetUpJunkBar(msgHdr); // we just finished loading a message. set a timer to actually mark the message is read after n seconds // where n can be configured by the user. diff --git a/mail/base/content/mailWindowOverlay.xul b/mail/base/content/mailWindowOverlay.xul index ae4ac96eef5..aeb46a7d41e 100644 --- a/mail/base/content/mailWindowOverlay.xul +++ b/mail/base/content/mailWindowOverlay.xul @@ -1837,6 +1837,13 @@