b=139561 Implement S/Mime "on demand verification" for IMAP messages

r=javi/cotter sr=bienvenu
This commit is contained in:
kaie%netscape.com 2002-05-29 04:44:50 +00:00
Родитель a67cfbacc5
Коммит 5ed1bb1f08
8 изменённых файлов: 71 добавлений и 1 удалений

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

@ -278,6 +278,7 @@ interface nsIMsgDBView : nsISupports
readonly attribute nsIMsgDBHdr hdrForFirstSelectedMessage;
void loadMessageByMsgKey (in nsMsgKey aMsgKey);
void reloadMessage();
void reloadMessageWithAllParts();
void reloadFolderAfterQuickSearch();
readonly attribute unsigned long numSelected;

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

@ -1207,6 +1207,11 @@ function SelectMessage(messageUri)
gDBView.selectMsgByKey(msgHdr.messageKey);
}
function ReloadWithAllParts()
{
gDBView.reloadMessageWithAllParts();
}
function ReloadMessage()
{
gDBView.reloadMessage();

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

@ -846,13 +846,23 @@ NS_IMETHODIMP nsMsgDBView::SetSelection(nsITreeSelection * aSelection)
return NS_OK;
}
NS_IMETHODIMP nsMsgDBView::ReloadMessageWithAllParts()
{
return ReloadMessageHelper(PR_TRUE);
}
NS_IMETHODIMP nsMsgDBView::ReloadMessage()
{
return ReloadMessageHelper(PR_FALSE);
}
nsresult nsMsgDBView::ReloadMessageHelper(PRBool forceAllParts)
{
if (!mSuppressMsgDisplay && m_currentlyDisplayedMsgKey != nsMsgKey_None)
{
nsMsgKey currentMsgToReload = m_currentlyDisplayedMsgKey;
m_currentlyDisplayedMsgKey = nsMsgKey_None;
LoadMessageByMsgKey(currentMsgToReload);
LoadMessageByMsgKeyHelper(currentMsgToReload, forceAllParts);
}
return NS_OK;
@ -881,6 +891,11 @@ nsresult nsMsgDBView::UpdateDisplayMessage(nsMsgKey aMsgKey)
// given a msg key, we will load the message for it.
NS_IMETHODIMP nsMsgDBView::LoadMessageByMsgKey(nsMsgKey aMsgKey)
{
return LoadMessageByMsgKeyHelper(aMsgKey, PR_FALSE);
}
nsresult nsMsgDBView::LoadMessageByMsgKeyHelper(nsMsgKey aMsgKey, PRBool forceAllParts)
{
NS_ASSERTION(aMsgKey != nsMsgKey_None,"trying to load nsMsgKey_None");
if (aMsgKey == nsMsgKey_None) return NS_ERROR_UNEXPECTED;
@ -890,6 +905,10 @@ NS_IMETHODIMP nsMsgDBView::LoadMessageByMsgKey(nsMsgKey aMsgKey)
nsXPIDLCString uri;
nsresult rv = GenerateURIForMsgKey(aMsgKey, m_folder, getter_Copies(uri));
NS_ENSURE_SUCCESS(rv,rv);
if (forceAllParts)
{
uri.Append("?fetchCompleteMessage=true");
}
mMessengerInstance->OpenURL(uri);
m_currentlyDisplayedMsgKey = aMsgKey;
UpdateDisplayMessage(aMsgKey);

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

@ -299,6 +299,8 @@ protected:
PRInt32 GetLevelInUnreadView(nsIMsgDBHdr *msgHdr, nsMsgViewIndex startOfThread, nsMsgViewIndex viewIndex);
nsresult GetImapDeleteModel(nsIMsgFolder *folder);
nsresult UpdateDisplayMessage(nsMsgKey aMsgKey);
nsresult LoadMessageByMsgKeyHelper(nsMsgKey aMsgKey, PRBool forceAllParts);
nsresult ReloadMessageHelper(PRBool forceAllParts);
PRBool AdjustReadFlag(nsIMsgDBHdr *msgHdr, PRUint32 *msgFlags);
void FreeAll(nsVoidArray *ptrs);

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

@ -19,6 +19,7 @@ en-US.jar:
locale/en-US/messenger-smime/msgCompSMIMEOverlay.dtd (resources/locale/en-US/msgCompSMIMEOverlay.dtd)
locale/en-US/messenger-smime/msgCompSMIMEOverlay.properties (resources/locale/en-US/msgCompSMIMEOverlay.properties)
locale/en-US/messenger-smime/msgReadSMIMEOverlay.dtd (resources/locale/en-US/msgReadSMIMEOverlay.dtd)
locale/en-US/messenger-smime/msgReadSMIMEOverlay.properties (resources/locale/en-US/msgReadSMIMEOverlay.properties)
locale/en-US/messenger-smime/msgCompSecurityInfo.dtd (resources/locale/en-US/msgCompSecurityInfo.dtd)
locale/en-US/messenger-smime/msgCompSecurityInfo.properties (resources/locale/en-US/msgCompSecurityInfo.properties)
locale/en-US/messenger-smime/msgReadSecurityInfo.dtd (resources/locale/en-US/msgReadSecurityInfo.dtd)

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

@ -39,12 +39,50 @@ var gEncryptionStatus = -1;
var gSignatureStatus = -1;
var gSignerCert = null;
var gEncryptionCert = null;
var gBundle;
var gBrandBundle;
const nsPKIParamBlock = "@mozilla.org/security/pkiparamblock;1";
const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
function setupBundles()
{
if (gBundle && gBrandBundle)
return;
if (!gBundle) {
gBundle = document.getElementById("bundle_read_smime");
gBrandBundle = document.getElementById("bundle_brand");
}
}
function showImapSignatureUnknown()
{
var ifps = Components.interfaces.nsIPromptService;
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
promptService = promptService.QueryInterface(ifps);
setupBundles();
if (promptService && gBundle && gBrandBundle) {
if (promptService.confirm(window,
gBrandBundle.getString("brandShortName"),
gBundle.getString("ImapOnDemand"))) {
ReloadWithAllParts();
}
}
}
function showMessageReadSecurityInfo()
{
var gSignedUINode = document.getElementById('signedHdrIcon');
if (gSignedUINode) {
if (gSignedUINode.getAttribute("signed") == "unknown") {
showImapSignatureUnknown();
return;
}
}
var pkiParams = Components.classes[nsPKIParamBlock].createInstance(nsIPKIParamBlock);
// isupport array starts with index 1

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

@ -57,6 +57,9 @@
id="signed-status" collapsed="true" oncommand="showMessageReadSecurityInfo();"/>
<statusbarpanel insertbefore="offline-status" class="statusbarpanel-iconic"
id="encrypted-status" collapsed="true" oncommand="showMessageReadSecurityInfo();"/>
<stringbundle id="bundle_read_smime" src="chrome://messenger-smime/locale/msgReadSMIMEOverlay.properties"/>
<stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
</hbox>
</overlay>

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

@ -0,0 +1 @@
ImapOnDemand=The displayed message has been digitally signed, but not all its attachments have been downloaded yet. Therefore, the signature cannot be validated. Click OK to download the complete message and validate the signature.