b=137071 [UE] Replies to or forwarding S/MIME encrypted mail should default to encrypt

r=ducarroz sr=mscott
This commit is contained in:
kaie%netscape.com 2002-06-19 13:46:10 +00:00
Родитель 4a91b4198d
Коммит e76855a8f6
12 изменённых файлов: 130 добавлений и 2 удалений

Просмотреть файл

@ -64,4 +64,12 @@
0xd57d928c, 0x60e4, 0x4f81, \
{0x99, 0x9d, 0x5c, 0x76, 0x2e, 0x61, 0x12, 0x05 }}
#define NS_SMIMEENCRYPTURISERVICE_CONTRACTID \
"@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"
#define NS_SMIMEENCRYPTURISERVICE_CID \
{ /* a0134d58-018f-4d40-a099-fa079e5024a6 */ \
0xa0134d58, 0x018f, 0x4d40, \
{0xa0, 0x99, 0xfa, 0x07, 0x9e, 0x50, 0x24, 0xa6 }}
#endif // nsMsgSMIMECID_h__

Просмотреть файл

@ -51,10 +51,12 @@
/* Include all of the interfaces our factory can generate components for */
#include "nsMsgComposeSecure.h"
#include "nsSMimeJSHelper.h"
#include "nsEncryptedSMIMEURIsService.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgComposeSecure);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgSMIMEComposeFields);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSMimeJSHelper);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEncryptedSMIMEURIsService);
////////////////////////////////////////////////////////////
//
@ -73,7 +75,11 @@ static const nsModuleComponentInfo components[] =
{ "SMIME JS Helper",
NS_SMIMEJSJELPER_CID,
NS_SMIMEJSHELPER_CONTRACTID,
nsSMimeJSHelperConstructor }
nsSMimeJSHelperConstructor },
{ "SMIME Encrypted URI Cache Service",
NS_SMIMEENCRYPTURISERVICE_CID,
NS_SMIMEENCRYPTURISERVICE_CONTRACTID,
nsEncryptedSMIMEURIsServiceConstructor }
};

Просмотреть файл

@ -710,6 +710,13 @@
</VALUE></PANELDATA>
</SETTINGLIST>
<FILELIST>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEncryptedSMIMEURIsSrvc.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIMsgSMIMECompFields.idl</PATH>
@ -733,6 +740,11 @@
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEncryptedSMIMEURIsSrvc.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIMsgSMIMECompFields.idl</PATH>
@ -1407,6 +1419,13 @@
</VALUE></PANELDATA>
</SETTINGLIST>
<FILELIST>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEncryptedSMIMEURIsSrvc.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIMsgSMIMECompFields.idl</PATH>
@ -1430,6 +1449,11 @@
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEncryptedSMIMEURIsSrvc.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIMsgSMIMECompFields.idl</PATH>
@ -1455,6 +1479,12 @@
</TARGETORDER>
<GROUPLIST>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEncryptedSMIMEURIsSrvc.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

Просмотреть файл

@ -962,6 +962,13 @@
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEncryptedSMIMEURIsService.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsMsgComposeSecure.cpp</PATH>
@ -1015,6 +1022,11 @@
<PATH>xpcomDebug.shlb</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEncryptedSMIMEURIsService.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsMsgComposeSecure.cpp</PATH>
@ -1941,6 +1953,13 @@
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEncryptedSMIMEURIsService.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsMsgComposeSecure.cpp</PATH>
@ -1994,6 +2013,11 @@
<PATH>xpcom.shlb</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEncryptedSMIMEURIsService.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsMsgComposeSecure.cpp</PATH>
@ -2020,6 +2044,12 @@
<GROUPLIST>
<GROUP><NAME>src</NAME>
<FILEREF>
<TARGETNAME>msgsmimeDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEncryptedSMIMEURIsService.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>msgsmimeDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

Просмотреть файл

@ -3,3 +3,4 @@
#
nsIMsgSMIMEHeaderSink.idl
nsIEncryptedSMIMEURIsSrvc.idl

Просмотреть файл

@ -32,6 +32,7 @@ XPIDLSRCS = \
nsIMsgSMIMECompFields.idl \
nsIMsgSMIMEHeaderSink.idl \
nsISMimeJSHelper.idl \
nsIEncryptedSMIMEURIsSrvc.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -26,6 +26,7 @@ XPIDLSRCS = \
.\nsIMsgSMIMECompFields.idl \
.\nsIMsgSMIMEHeaderSink.idl \
.\nsISMimeJSHelper.idl \
.\nsIEncryptedSMIMEURIsSrvc.idl \
$(NULL)
################################################################################

Просмотреть файл

@ -28,6 +28,7 @@ var gNextSecurityButtonCommand = "";
var gBundle;
var gBrandBundle;
var gSMFields;
var gEncryptedURIService = null;
function onComposerClose()
@ -70,6 +71,15 @@ function onComposerReOpen()
gSMFields.signMessage = gCurrentIdentity.getBoolAttribute("sign_mail");
if (gEncryptedURIService && !gSMFields.requireEncryptMessage)
{
if (gEncryptedURIService.isEncrypted(gMsgCompose.originalMsgURI))
{
// Override encryption setting if original is known as encrypted.
gSMFields.requireEncryptMessage = true;
}
}
if (gSMFields.requireEncryptMessage)
{
setEncryptionUI();
@ -95,6 +105,13 @@ function onComposerReOpen()
// but only on first open, not on composer recycling
function smimeComposeOnLoad()
{
if (!gEncryptedURIService)
{
gEncryptedURIService =
Components.classes["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
.getService(Components.interfaces.nsIEncryptedSMIMEURIsService);
}
onComposerReOpen();
}

Просмотреть файл

@ -26,6 +26,9 @@ var gStatusBar = null;
var gSignedStatusPanel = null;
var gEncryptedStatusPanel = null;
var gEncryptedURIService = null;
var gMyLastEncryptedURI = null;
// manipulates some globals from msgReadSMIMEOverlay.js
const nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;
@ -92,6 +95,12 @@ var smimeHeaderSink =
gEncryptedUINode.setAttribute("encrypted", "notok");
gStatusBar.setAttribute("encrypted", "notok");
}
if (gEncryptedURIService)
{
gMyLastEncryptedURI = GetLoadedMessage();
gEncryptedURIService.rememberEncrypted(gMyLastEncryptedURI);
}
},
QueryInterface : function(iid)
@ -102,6 +111,15 @@ var smimeHeaderSink =
}
};
function forgetEncryptedURI()
{
if (gMyLastEncryptedURI && gEncryptedURIService)
{
gEncryptedURIService.forgetEncrypted(gMyLastEncryptedURI);
gMyLastEncryptedURI = null;
}
}
function onSMIMEStartHeaders()
{
gEncryptionStatus = -1;
@ -121,6 +139,8 @@ function onSMIMEStartHeaders()
gEncryptedUINode.collapsed = true;
gEncryptedUINode.removeAttribute("encrypted");
gStatusBar.removeAttribute("encrypted");
forgetEncryptedURI();
}
function onSMIMEEndHeaders()
@ -145,6 +165,16 @@ function msgHdrViewSMIMEOnLoad(event)
listener.onStartHeaders = onSMIMEStartHeaders;
listener.onEndHeaders = onSMIMEEndHeaders;
gMessageListeners.push(listener);
gEncryptedURIService =
Components.classes["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
.getService(Components.interfaces.nsIEncryptedSMIMEURIsService);
}
function msgHdrViewSMIMEOnUnload(event)
{
forgetEncryptedURI();
}
addEventListener('messagepane-loaded', msgHdrViewSMIMEOnLoad, true);
addEventListener('messagepane-unloaded', msgHdrViewSMIMEOnUnload, true);

Просмотреть файл

@ -43,11 +43,13 @@ REQUIRES = xpcom \
CPPSRCS = \
nsMsgComposeSecure.cpp \
nsSMimeJSHelper.cpp \
nsEncryptedSMIMEURIsService.cpp \
$(NULL)
EXPORTS = \
nsMsgComposeSecure.h \
nsSMimeJSHelper.h \
nsEncryptedSMIMEURIsService.h \
$(NULL)
EXTRA_COMPONENTS = smime-service.js

Просмотреть файл

@ -67,6 +67,7 @@ include <$(DEPTH)\config\config.mak>
EXPORTS= nsMsgComposeSecure.h \
nsSMimeJSHelper.h \
nsEncryptedSMIMEURIsService.h \
$(NULL)
################################################################################
@ -76,6 +77,7 @@ LIBRARY_NAME=msgsmime_s
CPP_OBJS= .\$(OBJDIR)\nsMsgComposeSecure.obj \
.\$(OBJDIR)\nsSMimeJSHelper.obj \
.\$(OBJDIR)\nsEncryptedSMIMEURIsService.obj \
$(NULL)

Просмотреть файл

@ -37,7 +37,7 @@
#ifndef _nsEncryptedSMIMEURIsService_H_
#define _nsEncryptedSMIMEURIsService_H_
#include "nsIEncryptedSMIMEURIsService.h"
#include "nsIEncryptedSMIMEURIsSrvc.h"
#include "nsVoidArray.h"
class nsEncryptedSMIMEURIsService : public nsIEncryptedSMIMEURIsService