diff --git a/UI/MailPartViewers/UIxMailPartSignedViewer.m b/UI/MailPartViewers/UIxMailPartSignedViewer.m index e707c4a27..34a8110a7 100644 --- a/UI/MailPartViewers/UIxMailPartSignedViewer.m +++ b/UI/MailPartViewers/UIxMailPartSignedViewer.m @@ -38,6 +38,11 @@ @implementation UIxMailPartSignedViewer : UIxMailPartMixedViewer #ifdef HAVE_OPENSSL +- (BOOL) supportsSMIME +{ + return YES; +} + - (X509_STORE *) _setupVerify { X509_STORE *store; @@ -189,6 +194,11 @@ return validationMessage; } #else +- (BOOL) supportsSMIME +{ + return NO; +} + - (BOOL) validSignature { return NO; @@ -196,7 +206,7 @@ - (NSString *) validationMessage { - return @"Signature verification is not implemented when using GnuTLS"; + return nil; } #endif diff --git a/UI/Templates/MailPartViewers/UIxMailPartSignedViewer.wox b/UI/Templates/MailPartViewers/UIxMailPartSignedViewer.wox index 7733e0d60..d6b959239 100644 --- a/UI/Templates/MailPartViewers/UIxMailPartSignedViewer.wox +++ b/UI/Templates/MailPartViewers/UIxMailPartSignedViewer.wox @@ -7,6 +7,7 @@ xmlns:label="OGo:label" class="signed" const:id="signedMessage" + var:supports-smime="supportsSMIME" var:valid="validSignature" var:error="validationMessage"> diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index a2adc5885..8c8d21fbd 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -325,18 +325,18 @@ function mailListToggleMessagesFlagged(row) { if (selectedRowsId.length > 0) { var td = row.down("td.messageFlagColumn"); var img = td.childElements().first(); - + var action = "markMessageFlagged"; var flagged = true; if (img.hasClassName("messageIsFlagged")) { action = "markMessageUnflagged"; flagged = false; } - + for (var i = 0; i < selectedRowsId.length; i++) { var msguid = selectedRowsId[i].split("_")[1]; flagMailInWindow(window, msguid, flagged); - + var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/" + msguid + "/" + action; var data = { "msguid": msguid }; @@ -537,7 +537,7 @@ function deleteSelectedMessagesCallback(http) { if (http.status == 200) { // The answer contains quota information var rdata = http.responseText.evalJSON(true); - if (rdata.quotas && data["mailbox"].startsWith('/0/')) + if (rdata.quotas && data["mailbox"].startsWith('/0/')) updateQuotas(rdata.quotas); } if (data["refreshUnseenCount"]) @@ -746,7 +746,7 @@ function refreshMailbox() { topWindow.refreshCurrentFolder(); topWindow.refreshUnseenCounts(); } - + return false; } @@ -1036,7 +1036,7 @@ function onMessageContextMenu(event) { onRowClick(event, target); selectedNodes = topNode.getSelectedRowsId(); } - + if (selectedNodes.length > 1) popupMenu(event, "messagesListMenu", selectedNodes); else if (selectedNodes.length == 1) @@ -1186,7 +1186,7 @@ function onMessageSelectionChange(event) { // Update rows selection onRowClick(event, t); - + var messageContent = $("messageContent"); var rows = this.getSelectedRowsId(); if (rows.length == 1) { @@ -1282,30 +1282,36 @@ function configureLoadImagesButton() { function configureSignatureFlagImage() { var signedPart = $("signedMessage"); if (signedPart) { - var loadImagesButton = $("loadImagesButton"); - var parentNode = loadImagesButton.parentNode; - var valid = parseInt(signedPart.getAttribute("valid")); - var flagImage; + var supportsSMIME + = parseInt(signedPart.getAttribute("supports-smime")); - if (valid) - flagImage = "signature-ok.png"; - else - flagImage = "signature-not-ok.png"; + if (supportsSMIME) { + var loadImagesButton = $("loadImagesButton"); + var parentNode = loadImagesButton.parentNode; - var error = signedPart.getAttribute("error"); - var newImg = createElement("img", "signedImage", null, null, - { src: ResourcesURL + "/" + flagImage }); + var valid = parseInt(signedPart.getAttribute("valid")); + var flagImage; - var msgDiv = $("signatureFlagMessage"); - if (msgDiv && error) { - // First line in a h1, others each in a p - var formattedMessage = "

" + error.replace(/\n/, "

"); - formattedMessage = formattedMessage.replace(/\n/g, "

") + "

"; - msgDiv.innerHTML = "
" + formattedMessage + "
"; - newImg.observe("mouseover", showSignatureMessage); - newImg.observe("mouseout", hideSignatureMessage); + if (valid) + flagImage = "signature-ok.png"; + else + flagImage = "signature-not-ok.png"; + + var error = signedPart.getAttribute("error"); + var newImg = createElement("img", "signedImage", null, null, + { src: ResourcesURL + "/" + flagImage }); + + var msgDiv = $("signatureFlagMessage"); + if (msgDiv && error) { + // First line in a h1, others each in a p + var formattedMessage = "

" + error.replace(/\n/, "

"); + formattedMessage = formattedMessage.replace(/\n/g, "

") + "

"; + msgDiv.innerHTML = "
" + formattedMessage + "
"; + newImg.observe("mouseover", showSignatureMessage); + newImg.observe("mouseout", hideSignatureMessage); + } + loadImagesButton.parentNode.insertBefore(newImg, loadImagesButton.nextSibling); } - loadImagesButton.parentNode.insertBefore(newImg, loadImagesButton.nextSibling); } } @@ -1644,7 +1650,7 @@ function loadMessageCallback(http) { document.messageAjaxRequest = null; var msguid = http.callbackData.msguid; var mailbox = http.callbackData.mailbox; - if (Mailer.currentMailbox == mailbox && + if (Mailer.currentMailbox == mailbox && Mailer.currentMessages[Mailer.currentMailbox] == msguid) { div.innerHTML = http.responseText; configureLinksInMessage(); @@ -2396,7 +2402,7 @@ function onMenuEmptyTrashCallback(http) { var data = http.responseText.evalJSON(true); // We currently only show the quota for the first account (0). if (data.quotas && http.callbackData.mailbox.startsWith('/0/')) - updateQuotas(data.quotas); + updateQuotas(data.quotas); } } else