Browse Source

P4TB-30 amendments

1.1.101
francesco 3 years ago
parent
commit
ff1568f5e9
5 changed files with 16 additions and 25 deletions
  1. +7
    -17
      chrome/content/modules/pEp.js
  2. +4
    -1
      chrome/content/options.js
  3. +1
    -2
      chrome/content/options.xul
  4. +3
    -4
      chrome/content/pEpMimeEncrypt.js
  5. +1
    -1
      chrome/content/pepmsghdrview.js

+ 7
- 17
chrome/content/modules/pEp.js View File

@ -19,10 +19,7 @@ const EXPORTED_SYMBOLS = ["pEp"];
const DIR_INCOMING = 0;
const DIR_OUTGOING = 1;
// refer to `typedef enum _PEP_enc_format` in `message.h` in
// the engine code for details about these values
const ENC_FORMAT_NONE = 0;
const ENC_FORMAT_S_MIME = 2;
const ENC_FORMAT_PGP_MIME = 3;
const ENC_FORMAT_PEP = 4;
const PEP_PREFIX = "pEp-";
@ -235,13 +232,13 @@ class pEp {
return obj && JSON.parse(JSON.stringify(obj));
}
let clone = new pEp.Message(source.id,
source.shortmsg,
source.longmsg,
deepCopy(source.from),
deepCopy(source.to),
source.dir,
source.enc_format,
deepCopy(source.attachments),
source.shortmsg,
source.longmsg,
deepCopy(source.from),
deepCopy(source.to),
source.dir,
source.enc_format,
deepCopy(source.attachments),
deepCopy(source.opt_fields));
source.cc && clone.setCc(source.cc);
source.bcc && clone.setBcc(source.bcc);
@ -433,13 +430,6 @@ pEp.Message = class {
let met = (this.enc_format === 0) ? this.fromUnencrypted.bind(this) : this.fromEncrypted.bind(this);
return met(atob, boundary);
}
isEncrypted() {
const formats = [ENC_FORMAT_S_MIME,
ENC_FORMAT_PGP_MIME,
ENC_FORMAT_PEP];
return formats.filter(format => format === this.enc_format).length > 0;
}
};


+ 4
- 1
chrome/content/options.js View File

@ -4,7 +4,6 @@ Preferences.addAll([
{ id: "extensions.p4tb.warnUnencrypted", type: "bool" },
{ id: "extensions.p4tb.unprotectedSubjects", type: "bool" },
{ id: "extensions.p4tb.storeProtectedOptions", type: "bool" },
{ id: "extensions.p4tb.securityLossWarning", type: "bool" },
{ id: "extensions.p4tb.pEpSync", type: "bool" },
// examples with different types
//{ id: "extensions.nameOfAddon.pref2", type: "string" },
@ -20,9 +19,13 @@ window.addEventListener('load', function () {
document.getElementById('storeAllSecurely').checked = Prefs.isStoreAllSecurely();
document.getElementById('warnUnencrypted').checked = Prefs.isWarnUnencrypted();
let acceptButton = document.querySelector('button#accept');
let cancelButton = document.querySelector('button#cancel');
acceptButton.addEventListener('click', function () {
Prefs.setIsStoreAllSecurely(document.getElementById('storeAllSecurely').checked);
Prefs.setWarnUnencrypted(document.getElementById('warnUnencrypted').checked);
window.close();
});
cancelButton.addEventListener('click', function () {
window.close();
});
});

+ 1
- 2
chrome/content/options.xul View File

@ -36,11 +36,10 @@
<checkbox id="warnUnencrypted" preference="extensions.p4tb.warnUnencrypted" label="Warn me when a conversation gets to a lower level of privacy" tooltiptext="p≡p will ask you for confirmation before sending a plain message in a conversation which was formerly encrypted" />
<checkbox disabled="true" id="unprotectedSubjects" preference="extensions.p4tb.unprotectedSubjects" label="Enable unprotected message subjects" tooltiptext="" />
<checkbox disabled="true" id="storeProtectedOptions" preference="extensions.p4tb.storeProtectedOptions" label="Show store protected options" tooltiptext="" />
<checkbox disabled="true" id="securityLossWarning" preference="extensions.p4tb.securityLossWarning" label="Show a warning message when a message loses security through reply or forward" tooltiptext="" />
<checkbox disabled="true" id="pEpSync" preference="extensions.p4tb.pEpSync" label="Enable p≡p Sync" tooltiptext="" />
</groupbox>
<hbox>
<html:button>
<html:button id="cancel">
Cancel
</html:button>
<html:button id="accept">


+ 3
- 4
chrome/content/pEpMimeEncrypt.js View File

@ -4,7 +4,7 @@
"use strict";
const { jsmime } = ChromeUtils.import("resource:///modules/jsmime.jsm");
const jsmime = ChromeUtils.import("resource:///modules/jsmime.jsm").jsmime;
const {classes: Cc, results: Cr, interfaces: Ci} = Components;
const maxBufferLen = 102400;
@ -25,9 +25,7 @@ function isMessageUriInPgpMime() {
return ("messageURI" in gPgpMimeObj);
}
function PgpMimeEncrypt(originalMessage, sMimeSecurityInfo) {
this.originalMessage = originalMessage;
function PgpMimeEncrypt(sMimeSecurityInfo) {
console.log("pEp PgpMimeEncrypt CONSTRUCTOR");
this.wrappedJSObject = this;
@ -382,6 +380,7 @@ PgpMimeEncrypt.prototype = {
let resultMessage = this.pEp.cloneMessage(resultObj);
this.outQueue = this.pEpController.mimeFromMessage(resultMessage);
} else if (requireEncryption) {
// Open Dialog and ask user to send mail unencrypted
throw Cr.NS_ERROR_FAILURE;
}


+ 1
- 1
chrome/content/pepmsghdrview.js View File

@ -122,7 +122,7 @@ var ColumnOverlay = {
var pEpHdrView = {
init: function (window) {
init: function () {
console.debug("pEpHdrView: init()", this, window);
this.onLoadListener();
pEpController.addFactory();


Loading…
Cancel
Save