Browse Source

Change p4t and p4tb to pEp4Tb for chrome:, change preferences to pEp, general cleanup.

- Used permanent add-on name in Makefile
- Removed unneeded (empty) background.js
- renamed p4tb.js to pEpController.js
- Added Windows BAT file for zipping up
- Fixed Components.interfaces and friends
- Removed hacks for TB versions less than 68
1.1.101
Jorg Knobloch 2 years ago
parent
commit
dd401b2756
29 changed files with 145 additions and 195 deletions
  1. +2
    -2
      Makefile
  2. +1
    -1
      README.md
  3. +0
    -0
      chrome/background.js
  4. +7
    -7
      chrome/bootstrap.js
  5. +4
    -4
      chrome/chrome.manifest
  6. +1
    -1
      chrome/content/TbContacts.js
  7. +6
    -6
      chrome/content/TbHelper.js
  8. +4
    -5
      chrome/content/detectAdapter.js
  9. +3
    -3
      chrome/content/dialogs/privacy_status.js
  10. +4
    -4
      chrome/content/dialogs/privacy_status.xul
  11. +1
    -4
      chrome/content/modules/pEpFiles.js
  12. +12
    -16
      chrome/content/options.js
  13. +11
    -11
      chrome/content/options.xul
  14. +0
    -30
      chrome/content/p4tb.js
  15. +29
    -0
      chrome/content/pEpController.js
  16. +1
    -1
      chrome/content/pEpFactory.js
  17. +7
    -8
      chrome/content/pEpForThunderbird.js
  18. +4
    -4
      chrome/content/pEpMimeDecrypt.js
  19. +4
    -45
      chrome/content/pEpMimeEncrypt.js
  20. +10
    -8
      chrome/content/pepmessengercompose.js
  21. +8
    -8
      chrome/content/pepmsghdrview.js
  22. +1
    -1
      chrome/content/prefsFactory.js
  23. +6
    -6
      chrome/content/resources/stylesheets/pEp.css
  24. +5
    -0
      chrome/makeXPI.bat
  25. +2
    -8
      chrome/manifest.json
  26. +1
    -1
      package-lock.json
  27. +1
    -1
      package.json
  28. +4
    -4
      tests/runtime/pepmessengercompose.js
  29. +6
    -6
      tests/runtime/pepmsghdrview.js

+ 2
- 2
Makefile View File

@ -1,7 +1,7 @@
xpi:
mkdir -p build
cd chrome; zip -r p4t.xpi . ; cd ..
mv chrome/p4t.xpi build
cd chrome; zip -r pEp4Tb@pEp.security.xpi . ; cd ..
mv chrome/pEp4Tb@pEp.security.xpi build
runtime:
mkdir -p build


+ 1
- 1
README.md View File

@ -7,7 +7,7 @@ Using docker
Using bash
```zip -r build/p4t.xpi chrome```
```zip -r build/pEp4Tb@pEp.security.xpi chrome```
## Check syntax statically


+ 0
- 0
chrome/background.js View File


+ 7
- 7
chrome/bootstrap.js View File

@ -1,12 +1,12 @@
// TODO: Implement for restartless app https://developer.mozilla.org/en-US/docs/Archive/Add-ons/How_to_convert_an_overlay_extension_to_restartless#Step_9_bootstrap.js
/* globals Components, Services */
/* globals Services */
/* exported install, uninstall, startup, shutdown */
const {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
function loadStylesheets(styleSheets) {
// Load stylesheets
const styleSheetService = Components.classes['@mozilla.org/content/style-sheet-service;1']
.getService(Components.interfaces.nsIStyleSheetService);
const styleSheetService = Cc['@mozilla.org/content/style-sheet-service;1']
.getService(Ci.nsIStyleSheetService);
for (let i = 0, len = styleSheets.length; i < len; i++) {
const styleSheetURI = Services.io.newURI(styleSheets[i], null, null);
styleSheetService.loadAndRegisterSheet(styleSheetURI, styleSheetService.AUTHOR_SHEET);
@ -52,11 +52,11 @@ function setPrefs(prefBranch) {
function startup() {
console.debug('bootstrap.js: Startup');
windowObserver.init();
const styleSheets = ['chrome://p4t/content/resources/stylesheets/pEp.css'];
const styleSheets = ['chrome://pEp4Tb/content/resources/stylesheets/pEp.css'];
loadStylesheets(styleSheets);
// Define default preferences.
setPrefs(Services.prefs.getDefaultBranch('extensions.p4tb.'));
setPrefs(Services.prefs.getDefaultBranch('extensions.pEp.'));
}
function shutdown() {
@ -106,12 +106,12 @@ let windowObserver = {
case 'chrome://messenger/content/messenger.xhtml':
case 'chrome://messenger/content/messengercompose/messageWindow.xul':
case 'chrome://messenger/content/messengercompose/messageWindow.xhtml':
script = 'chrome://p4t/content/pepmsghdrview.js';
script = 'chrome://pEp4Tb/content/pepmsghdrview.js';
break;
case 'chrome://messenger/content/messengercompose/messengercompose.xul':
case 'chrome://messenger/content/messengercompose/messengercompose.xhtml':
script = 'chrome://p4t/content/pepmessengercompose.js';
script = 'chrome://pEp4Tb/content/pepmessengercompose.js';
break;
default:


+ 4
- 4
chrome/chrome.manifest View File

@ -1,5 +1,5 @@
content p4t content/
content pEp4Tb content/
overlay chrome://messenger/content/messageWindow.xul chrome://p4t/content/pepmsghdrview.xul
overlay chrome://messenger/content/messenger.xul chrome://p4t/content/columnOverlay.xul
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://p4t/content/pepmessengercompose.xul
overlay chrome://messenger/content/messageWindow.xul chrome://pEp4Tb/content/pepmsghdrview.xul
overlay chrome://messenger/content/messenger.xul chrome://pEp4Tb/content/columnOverlay.xul
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://pEp4Tb/content/pepmessengercompose.xul

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

@ -1,6 +1,6 @@
const {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
const {MailServices} = ChromeUtils.import('resource:///modules/MailServices.jsm');
const {pEp} = ChromeUtils.import('chrome://p4t/content/modules/pEp.js');
const {pEp} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEp.js');
const TbContacts = {
getCardForEmail(emailAddress) {
// copied from msgHdrViewOverlay.js


+ 6
- 6
chrome/content/TbHelper.js View File

@ -120,7 +120,7 @@ const TbHelper = {
if (iid.equals(Ci.nsIMsgCopyServiceListener) || iid.equals(Ci.nsISupports)) {
return this;
}
throw Components.results.NS_NOINTERFACE;
throw Cr.NS_NOINTERFACE;
},
GetMessageId(messageId) {
},
@ -273,9 +273,9 @@ const TbHelper = {
},
getAccountOptions() {
const {AccountOptions} = ChromeUtils.import('chrome://p4t/content/modules/AccountOptions.js');
const Prefs = ChromeUtils.import('chrome://p4t/content/prefsFactory.js').prefsFactory();
const Helper = ChromeUtils.import('chrome://p4t/content/TbHelper.js').TbHelper;
const {AccountOptions} = ChromeUtils.import('chrome://pEp4Tb/content/modules/AccountOptions.js');
const Prefs = ChromeUtils.import('chrome://pEp4Tb/content/prefsFactory.js').prefsFactory();
const Helper = ChromeUtils.import('chrome://pEp4Tb/content/TbHelper.js').TbHelper;
const serialised = Prefs.getAccountOptions();
const accountOptions = AccountOptions.parse(serialised);
accountOptions.updateAccounts(Helper.getAccounts());
@ -283,7 +283,7 @@ const TbHelper = {
},
decryptForSelectedAccount(gFolderDisplay) {
const Helper = ChromeUtils.import('chrome://p4t/content/TbHelper.js').TbHelper;
const Helper = ChromeUtils.import('chrome://pEp4Tb/content/TbHelper.js').TbHelper;
const accountOptions = Helper.getAccountOptions();
const account = Helper.getSelectedAccount(gFolderDisplay);
return accountOptions.forAccount(account).decrypt();
@ -292,7 +292,7 @@ const TbHelper = {
// `privateOriginal` can be `null` if there are no originals, see
// `getOriginalRating` in `pepmessengercompose`
encryptForAccount(gCurrentIdentity, privateOriginal) {
const Helper = ChromeUtils.import('chrome://p4t/content/TbHelper.js').TbHelper;
const Helper = ChromeUtils.import('chrome://pEp4Tb/content/TbHelper.js').TbHelper;
const accountOptions = Helper.getAccountOptions();
const account = Helper.getAccountWithIdentity(gCurrentIdentity);
const current = accountOptions.forAccount(account);


+ 4
- 5
chrome/content/detectAdapter.js View File

@ -1,10 +1,9 @@
const {classes: Cc, interfaces: Ci} = Components;
const {
ENV_PEPHOME, ENV_USER, ENV_HOME, ENV_APPDATA, LEVEL_ALL,
} = ChromeUtils.import('chrome://p4t/content/constants.js');
const {pEpFiles} = ChromeUtils.import('chrome://p4t/content/modules/pEpFiles.js');
const {pEpOs} = ChromeUtils.import('chrome://p4t/content/modules/pEpOs.js');
const {pEpLogger} = ChromeUtils.import('chrome://p4t/content/pEpLogger.js');
} = ChromeUtils.import('chrome://pEp4Tb/content/constants.js');
const {pEpFiles} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEpFiles.js');
const {pEpOs} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEpOs.js');
const {pEpLogger} = ChromeUtils.import('chrome://pEp4Tb/content/pEpLogger.js');
/**


+ 3
- 3
chrome/content/dialogs/privacy_status.js View File

@ -1,6 +1,6 @@
const {pEpController} = ChromeUtils.import('chrome://p4t/content/p4tb.js');
const {Handshake} = ChromeUtils.import('chrome://p4t/content/modules/handshake.js');
const utils = ChromeUtils.import('chrome://p4t/content/modules/utils.js').pEpUtils;
const {pEpController} = ChromeUtils.import('chrome://pEp4Tb/content/pEpController.js');
const {Handshake} = ChromeUtils.import('chrome://pEp4Tb/content/modules/handshake.js');
const utils = ChromeUtils.import('chrome://pEp4Tb/content/modules/utils.js').pEpUtils;
const ownIdentity = window.arguments[0];
const allIdentities = window.arguments[1];


+ 4
- 4
chrome/content/dialogs/privacy_status.xul View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin/global.css"?>
<?xml-stylesheet type="text/css" href="chrome://p4t/content/dialogs/privacy_status.css"?>
<?xml-stylesheet type="text/css" href="chrome://pEp4Tb/content/dialogs/privacy_status.css"?>
<dialog title="Handshake"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
@ -8,7 +8,7 @@
buttons="accept"
buttonlabelaccept="Close">
<script type="application/javascript" src="chrome://p4t/content/dialogs/privacy_status.js"/>
<script type="application/javascript" src="chrome://pEp4Tb/content/dialogs/privacy_status.js"/>
<html:div id="intro">
You communication will be completely Secure &amp; Trusted by comparing the trustwords below with your communication partners, for example by making a phone call.
</html:div>
@ -16,7 +16,7 @@
<!-- templates below -->
<html:div class="identity template" id="untrusted">
<html:div class="name">
<html:img src="chrome://p4t/content/resources/images/yellow-shield.png"/>
<html:img src="chrome://pEp4Tb/content/resources/images/yellow-shield.png"/>
<html:span data-field="full-name">full-name</html:span>
</html:div>
<html:div class="trustwords" data-field="trustwords">
@ -31,7 +31,7 @@
</html:div>
<html:div class="identity template" id="trusted">
<html:div class="name">
<html:img src="chrome://p4t/content/resources/images/yellow-shield.png"/>
<html:img src="chrome://pEp4Tb/content/resources/images/yellow-shield.png"/>
<html:span data-field="full-name">full-name</html:span>
</html:div>
<html:div class="actions">


+ 1
- 4
chrome/content/modules/pEpFiles.js View File

@ -1,9 +1,6 @@
const EXPORTED_SYMBOLS = ['pEpFiles'];
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = ChromeUtils;
const {OS} = Cu.import('resource://gre/modules/osfile.jsm', {});
const {OS} = ChromeUtils.import('resource://gre/modules/osfile.jsm', {});
class pEpFiles {
constructor() {}


+ 12
- 16
chrome/content/options.js View File

@ -1,26 +1,22 @@
// see developer.thunderbird.net/add-ons/updates/tb68
// i got an exception when trying to access preferences before this call
// Add preferences info (see developer.thunderbird.net/add-ons/updates/tb68).
Preferences.addAll([
{id: 'extensions.p4tb.storeAllSecurely', type: 'bool'},
{id: 'extensions.p4tb.warnUnencrypted', type: 'bool'},
{id: 'extensions.p4tb.unprotectedSubjects', type: 'bool'},
{id: 'extensions.p4tb.storeProtectedOptions', type: 'bool'},
{id: 'extensions.p4tb.pEpSync', type: 'bool'},
{id: 'extensions.p4tb.disclaimerMode', type: 'string'},
{id: 'extensions.p4tb.disclaimer', type: 'string'},
// `initialised` is used only by us in order to provide defaults,
// see `options.js`
{id: 'extensions.p4tb.initialised', type: 'bool'},
{id: 'extensions.pEp.storeAllSecurely', type: 'bool'},
{id: 'extensions.pEp.warnUnencrypted', type: 'bool'},
{id: 'extensions.pEp.unprotectedSubjects', type: 'bool'},
{id: 'extensions.pEp.storeProtectedOptions', type: 'bool'},
{id: 'extensions.pEp.pEpSync', type: 'bool'},
{id: 'extensions.pEp.disclaimerMode', type: 'string'},
{id: 'extensions.pEp.disclaimer', type: 'string'},
// examples with different types
// { id: "extensions.nameOfAddon.pref2", type: "string" },
// { id: "extensions.nameOfAddon.pref3", type: "int" },
]);
const Prefs = ChromeUtils.import('chrome://p4t/content/prefsFactory.js')
const Prefs = ChromeUtils.import('chrome://pEp4Tb/content/prefsFactory.js')
.prefsFactory();
const {AccountOptions} = ChromeUtils.import('chrome://p4t/content/modules/AccountOptions.js');
const utils = ChromeUtils.import('chrome://p4t/content/modules/utils.js').pEpUtils;
const helper = ChromeUtils.import('chrome://p4t/content/TbHelper.js').TbHelper;
const {AccountOptions} = ChromeUtils.import('chrome://pEp4Tb/content/modules/AccountOptions.js');
const utils = ChromeUtils.import('chrome://pEp4Tb/content/modules/utils.js').pEpUtils;
const helper = ChromeUtils.import('chrome://pEp4Tb/content/TbHelper.js').TbHelper;
function update() {
const hidden = document.querySelector('#disclaimerMode').value === 'disclaimer-none';


+ 11
- 11
chrome/content/options.xul View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin/global.css"?>
<?xml-stylesheet type="text/css" href="chrome://messenger/skin/preferences/preferences.css"?>
<?xml-stylesheet type="text/css" href="chrome://p4t/resources/stylesheets/options.css"?>
<?xml-stylesheet type="text/css" href="chrome://p4t/resources/stylesheets/pEp.css"?>
<?xml-stylesheet type="text/css" href="chrome://pEp4Tb/resources/stylesheets/options.css"?>
<?xml-stylesheet type="text/css" href="chrome://pEp4Tb/resources/stylesheets/pEp.css"?>
<?xml-stylesheet type="text/css" href="chrome://messenger/skin/messenger.css"?>
<window id="appPreferences"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
@ -10,7 +10,7 @@
title="pEp Preferences">
<script src="chrome://global/content/preferencesBindings.js"
type="application/javascript"/>
<script src="chrome://p4t/content/options.js"
<script src="chrome://pEp4Tb/content/options.js"
type="application/javascript"/>
<tabbox class="prefPanel">
<tabs>
@ -28,16 +28,16 @@
<label class="header">Store messages securely for these accounts</label>
</hbox>
<select disabled="true" id=""><option value="">select account</option></select>
<checkbox disabled="true" id="" preference="extensions.p4tb." label="Store messages securely" tooltiptext="" />
<checkbox disabled="true" id="" preference="extensions.p4tb." label="Enable privacy protection" tooltiptext="" />
<checkbox disabled="true" id="" preference="extensions.pEp." label="Store messages securely" tooltiptext="" />
<checkbox disabled="true" id="" preference="extensions.pEp." label="Enable privacy protection" tooltiptext="" />
</groupbox>
-->
<groupbox>
<checkbox id="storeAllSecurely" preference="extensions.p4tb.storeAllSecurely" label="Store messages securely for all accounts" tooltiptext="Uncheck this if you trust the server to keep an unencrypted version of your mails" />
<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="pEpSync" preference="extensions.p4tb.pEpSync" label="Enable p≡p Sync" tooltiptext="" />
<checkbox id="storeAllSecurely" preference="extensions.pEp.storeAllSecurely" label="Store messages securely for all accounts" tooltiptext="Uncheck this if you trust the server to keep an unencrypted version of your mails" />
<checkbox id="warnUnencrypted" preference="extensions.pEp.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.pEp.unprotectedSubjects" label="Enable unprotected message subjects" tooltiptext="" />
<checkbox disabled="true" id="storeProtectedOptions" preference="extensions.pEp.storeProtectedOptions" label="Show store protected options" tooltiptext="" />
<checkbox disabled="true" id="pEpSync" preference="extensions.pEp.pEpSync" label="Enable p≡p Sync" tooltiptext="" />
</groupbox>
<groupbox>
<hbox class="groupbox-title">
@ -74,7 +74,7 @@
<html:div id="about">
<html:div class="section">
<html:div class="head">
<html:img src="chrome://p4t/content/resources/images/logo.png" alt="pEp logo"/>
<html:img src="chrome://pEp4Tb/content/resources/images/logo.png" alt="pEp logo"/>
</html:div>
<html:div class="body">
<html:p>p≡p for Thunderbird</html:p>


+ 0
- 30
chrome/content/p4tb.js View File

@ -1,30 +0,0 @@
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const {pEpAdapter} = ChromeUtils.import('chrome://p4t/content/modules/pEpAdapter.js');
const {pEpOs} = ChromeUtils.import('chrome://p4t/content/modules/pEpOs.js');
const {pEpCore} = ChromeUtils.import('chrome://p4t/content/modules/pEpCore.js');
const {pEpFiles} = ChromeUtils.import('chrome://p4t/content/modules/pEpFiles.js');
const {pEpServer} = ChromeUtils.import('chrome://p4t/content/modules/pEpServer.js');
const {XhrQueue} = ChromeUtils.import('chrome://p4t/content/modules/xhrQueue.js');
const {pEpLogger} = ChromeUtils.import('chrome://p4t/content/pEpLogger.js');
const {detectAdapter} = ChromeUtils.import('chrome://p4t/content/detectAdapter.js');
const {pEpMimeEncrypt} = ChromeUtils.import('chrome://p4t/content/pEpMimeEncrypt.js');
const {pEpMimeDecrypt} = ChromeUtils.import('chrome://p4t/content/pEpMimeDecrypt.js');
const {pEpForThunderbird} = ChromeUtils.import('chrome://p4t/content/pEpForThunderbird.js');
const {LEVEL_ALL} = ChromeUtils.import('chrome://p4t/content/constants.js');
const {MimeEmitter} = ChromeUtils.import('chrome://p4t/content/modules/MimeEmitter.js');
Cu.importGlobalProperties(['XMLHttpRequest']);
const env = Cc['@mozilla.org/process/environment;1'].getService(Ci.nsIEnvironment);
const logger = new pEpLogger(LEVEL_ALL);
const server = new pEpServer(logger, detectAdapter, new XhrQueue(logger, XMLHttpRequest));
const adapter = new pEpAdapter(logger, server);
const files = new pEpFiles();
const os = new pEpOs(Cc, Ci);
const pEpController = new pEpForThunderbird(env, logger, adapter, files, os);
const EXPORTED_SYMBOLS = ['pEpController'];

+ 29
- 0
chrome/content/pEpController.js View File

@ -0,0 +1,29 @@
const {pEpAdapter} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEpAdapter.js');
const {pEpOs} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEpOs.js');
const {pEpCore} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEpCore.js');
const {pEpFiles} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEpFiles.js');
const {pEpServer} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEpServer.js');
const {XhrQueue} = ChromeUtils.import('chrome://pEp4Tb/content/modules/xhrQueue.js');
const {pEpLogger} = ChromeUtils.import('chrome://pEp4Tb/content/pEpLogger.js');
const {detectAdapter} = ChromeUtils.import('chrome://pEp4Tb/content/detectAdapter.js');
const {pEpMimeEncrypt} = ChromeUtils.import('chrome://pEp4Tb/content/pEpMimeEncrypt.js');
const {pEpMimeDecrypt} = ChromeUtils.import('chrome://pEp4Tb/content/pEpMimeDecrypt.js');
const {pEpForThunderbird} = ChromeUtils.import('chrome://pEp4Tb/content/pEpForThunderbird.js');
const {LEVEL_ALL} = ChromeUtils.import('chrome://pEp4Tb/content/constants.js');
const {MimeEmitter} = ChromeUtils.import('chrome://pEp4Tb/content/modules/MimeEmitter.js');
Cu.importGlobalProperties(['XMLHttpRequest']);
const env = Cc['@mozilla.org/process/environment;1'].getService(Ci.nsIEnvironment);
const logger = new pEpLogger(LEVEL_ALL);
const server = new pEpServer(logger, detectAdapter, new XhrQueue(logger, XMLHttpRequest));
const adapter = new pEpAdapter(logger, server);
const files = new pEpFiles();
const os = new pEpOs(Cc, Ci);
const pEpController = new pEpForThunderbird(env, logger, adapter, files, os);
const EXPORTED_SYMBOLS = ['pEpController'];

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

@ -1,4 +1,4 @@
const {interfaces: Ci, manager: Cm, results: Cr} = Components;
const Cm = Components.manager;
Cm.QueryInterface(Ci.nsIComponentRegistrar);


+ 7
- 8
chrome/content/pEpForThunderbird.js View File

@ -1,11 +1,10 @@
/* global Components, ChromeUtils */
const {classes: Cc, interfaces: Ci} = Components;
const {pEp} = ChromeUtils.import('chrome://p4t/content/modules/pEp.js');
const {pEpFactory} = ChromeUtils.import('chrome://p4t/content/pEpFactory.js');
const {pEpMimeDecrypt} = ChromeUtils.import('chrome://p4t/content/pEpMimeDecrypt.js');
const {pEpMimeEncrypt} = ChromeUtils.import('chrome://p4t/content/pEpMimeEncrypt.js');
const {pEpUtils} = ChromeUtils.import('chrome://p4t/content/modules/utils.js');
const {MimeEmitter} = ChromeUtils.import('chrome://p4t/content/modules/MimeEmitter.js');
/* global ChromeUtils */
const {pEp} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEp.js');
const {pEpFactory} = ChromeUtils.import('chrome://pEp4Tb/content/pEpFactory.js');
const {pEpMimeDecrypt} = ChromeUtils.import('chrome://pEp4Tb/content/pEpMimeDecrypt.js');
const {pEpMimeEncrypt} = ChromeUtils.import('chrome://pEp4Tb/content/pEpMimeEncrypt.js');
const {pEpUtils} = ChromeUtils.import('chrome://pEp4Tb/content/modules/utils.js');
const {MimeEmitter} = ChromeUtils.import('chrome://pEp4Tb/content/modules/MimeEmitter.js');
const {jsmime} = ChromeUtils.import('resource:///modules/jsmime.jsm');
class pEpForThunderbird extends pEp {


+ 4
- 4
chrome/content/pEpMimeDecrypt.js View File

@ -12,7 +12,7 @@ function makeComponent(controller) {
onStartRequest(request/* , ctxt */) {
this.decoder = request
.QueryInterface(Components.interfaces.nsIPgpMimeProxy);
.QueryInterface(Ci.nsIPgpMimeProxy);
this.boundary = getBoundary(request.contentType);
function getBoundary(contentType) {
@ -26,9 +26,9 @@ function makeComponent(controller) {
this.data += read(stream);
function read(stream) {
const reader = Components
.classes['@mozilla.org/scriptableinputstream;1']
.createInstance(Components.interfaces.nsIScriptableInputStream);
const reader =
Cc['@mozilla.org/scriptableinputstream;1']
.createInstance(Ci.nsIScriptableInputStream);
reader.init(stream);
return reader.read(count);
}


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

@ -6,13 +6,12 @@
/* global gPgpMimeObj, Components, ChromeUtils */
const {jsmime} = ChromeUtils.import('resource:///modules/jsmime.jsm');
const {classes: Cc, results: Cr, interfaces: Ci} = Components;
const {pEp} = ChromeUtils.import('chrome://p4t/content/modules/pEp.js');
const {TbContacts} = ChromeUtils.import('chrome://p4t/content/TbContacts.js');
const {pEp} = ChromeUtils.import('chrome://pEp4Tb/content/modules/pEp.js');
const {TbContacts} = ChromeUtils.import('chrome://pEp4Tb/content/TbContacts.js');
const {
ENC_FORMAT_NONE, ENC_FORMAT_PGP_MIME, ENC_FORMAT_PEP,
} = ChromeUtils.import('chrome://p4t/content/constants.js');
} = ChromeUtils.import('chrome://pEp4Tb/content/constants.js');
const maxBufferLen = 102400;
const MIME_SIGNED = 1;
@ -21,18 +20,6 @@ const MIME_ENCRYPTED = 2;
let gDebugLogLevel = 0;
function isMessageUriInPgpMime() {
return true;
if (typeof gPgpMimeObj === 'undefined') {
// eslint-disable-next-line no-global-assign
gPgpMimeObj = Cc['@mozilla.org/mime/pgp-mime-decrypt;1'].createInstance(Ci.nsIPgpMimeProxy);
}
return ('messageURI' in gPgpMimeObj);
}
function PgpMimeEncrypt(sMimeSecurityInfo) {
console.log('pEp PgpMimeEncrypt CONSTRUCTOR');
this.wrappedJSObject = this;
@ -49,18 +36,8 @@ function PgpMimeEncrypt(sMimeSecurityInfo) {
this.bccRecipients = '';
this.originalSubject = null;
this.keyMap = {};
if (isMessageUriInPgpMime()) {
this.onDataAvailable = this.onDataAvailable68;
} else {
this.onDataAvailable = this.onDataAvailable60;
}
try {
if (sMimeSecurityInfo) {
if ('nsIMsgSMIMECompFields' in Ci) {
sMimeSecurityInfo = sMimeSecurityInfo.QueryInterface(Ci.nsIMsgSMIMECompFields);
}
this.signMessage = sMimeSecurityInfo.signMessage;
this.requireEncryptMessage = sMimeSecurityInfo.requireEncryptMessage;
}
@ -79,16 +56,11 @@ PgpMimeEncrypt.prototype = {
classDescription: 'pEp JS Encryption Handler',
classID: PGPMIME_ENCRYPT_CID,
get contractID() {
if (Components.classesByID && Components.classesByID[kSmimeComposeSecureCID]) {
// hack needed for TB < 62: we overwrite the S/MIME encryption handler
return SMIME_ENCRYPT_CONTRACTID;
}
return SMIME_ENCRYPT_CONTRACTID;
},
QueryInterface: ChromeUtils.generateQI([
'nsIMsgComposeSecure',
'nsIStreamListener',
'nsIMsgSMIMECompFields', // TB < 64
]),
signMessage: false,
@ -134,20 +106,7 @@ PgpMimeEncrypt.prototype = {
console.log('mimeEncrypt.js: onStopRequest\n');
},
/**
* onDataAvailable for TB <= 66
*/
onDataAvailable60(req, ctxt, stream, offset, count) {
console.log('mimeEncrypt.js: onDataAvailable\n');
this.inStream.init(stream);
const data = this.inStream.read(count);
},
/**
* onDataAvailable for TB >= 67
*/
onDataAvailable68(req, stream, offset, count) {
onDataAvailable(req, stream, offset, count) {
console.log('mimeEncrypt.js: onDataAvailable\n');
this.inStream.init(stream);
const data = this.inStream.read(count);


+ 10
- 8
chrome/content/pepmessengercompose.js View File

@ -1,17 +1,17 @@
/* global gCurrentIdentity, gMsgCompose, ChromeUtils, Cc, Ci, Recipients2CompFields, Services */
const {pEpController} = ChromeUtils.import('chrome://p4t/content/p4tb.js');
const {Handshake} = ChromeUtils.import('chrome://p4t/content/modules/handshake.js');
const helper = ChromeUtils.import('chrome://p4t/content/TbHelper.js').TbHelper;
const {prefsFactory} = ChromeUtils.import('chrome://p4t/content/prefsFactory.js');
const {pEpController} = ChromeUtils.import('chrome://pEp4Tb/content/pEpController.js');
const {Handshake} = ChromeUtils.import('chrome://pEp4Tb/content/modules/handshake.js');
const helper = ChromeUtils.import('chrome://pEp4Tb/content/TbHelper.js').TbHelper;
const {prefsFactory} = ChromeUtils.import('chrome://pEp4Tb/content/prefsFactory.js');
const {TbContacts} = ChromeUtils.import('chrome://p4t/content/TbContacts.js');
const {TbContacts} = ChromeUtils.import('chrome://pEp4Tb/content/TbContacts.js');
const {
PEP_ENCRYPTED_SUBJECT, RATING_COLOR_NO_COLOR,
} = ChromeUtils.import('chrome://p4t/content/constants.js');
} = ChromeUtils.import('chrome://pEp4Tb/content/constants.js');
// Abstract Thunderbird methods
const TbAbstraction = {
@ -179,9 +179,11 @@ const pEpComposer = {
getMsgCompose().RegisterStateListener(stateListener);
/* TODO
document
.getElementById('p4tb_pep_security-composeAction-toolbarbutton')
.getElementById('need to define an Id')
.addEventListener('click', this.toggleProtection.bind(this));
*/
},
fromChangedListener(event) {
@ -298,7 +300,7 @@ const pEpComposer = {
const handshake = new Handshake(pEpController);
handshake.init(from, receivers).then(() => {
const [currentIdentity, identities] = handshake.showPrivacyStatusDialog();
const xul = 'chrome://p4t/content/dialogs/privacy_status.xul';
const xul = 'chrome://pEp4Tb/content/dialogs/privacy_status.xul';
const id = 'privacy-status-dialog-id';
const position = 'chrome,centerscreen';
window.openDialog(xul, id, position, currentIdentity, identities);


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

@ -1,22 +1,22 @@
/* global gFolderDisplay, gDBView, Cc, Ci, ChromeUtils */
const {pEpController} = ChromeUtils.import('chrome://p4t/content/p4tb.js');
const {pEpUtils} = ChromeUtils.import('chrome://p4t/content/modules/utils.js');
const Helper = ChromeUtils.import('chrome://p4t/content/TbHelper.js').TbHelper;
const MessageView = ChromeUtils.import('chrome://p4t/content/TbMessageView.js').TbMessageView;
const Prefs = ChromeUtils.import('chrome://p4t/content/prefsFactory.js')
const {pEpController} = ChromeUtils.import('chrome://pEp4Tb/content/pEpController.js');
const {pEpUtils} = ChromeUtils.import('chrome://pEp4Tb/content/modules/utils.js');
const Helper = ChromeUtils.import('chrome://pEp4Tb/content/TbHelper.js').TbHelper;
const MessageView = ChromeUtils.import('chrome://pEp4Tb/content/TbMessageView.js').TbMessageView;
const Prefs = ChromeUtils.import('chrome://pEp4Tb/content/prefsFactory.js')
.prefsFactory();
const PEP_COLUMN_NAME = 'pEpStatusCol';
const IMG_FOLDER = 'chrome://p4t/content/resources/images';
const IMG_FOLDER = 'chrome://pEp4Tb/content/resources/images';
const {
RATING_COLOR_RED,
RATING_COLOR_GREEN,
RATING_COLOR_YELLOW,
RATING_COLOR_NO_COLOR,
} = ChromeUtils.import('chrome://p4t/content/constants.js');
} = ChromeUtils.import('chrome://pEp4Tb/content/constants.js');
/**
@ -86,7 +86,7 @@ const columnHandler = {
};
const dbObserver = {
// Components.interfaces.nsIObserver
// Ci.nsIObserver
observe(aMsgFolder, aTopic, aData) {
try {
gDBView.addColumnHandler(PEP_COLUMN_NAME, columnHandler);


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

@ -1,7 +1,7 @@
const {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
function prefsFactory() {
const prefs = Services.prefs.getBranch('extensions.p4tb.');
const prefs = Services.prefs.getBranch('extensions.pEp.');
return {
isStoreAllSecurely: () => prefs.getBoolPref('storeAllSecurely'),


+ 6
- 6
chrome/content/resources/stylesheets/pEp.css View File

@ -4,35 +4,35 @@ tabbox#prefPanel {
}
.green {
background: url('chrome://p4t/content/resources/images/green-shield-white.png') #59b753;
background: url('chrome://pEp4Tb/content/resources/images/green-shield-white.png') #59b753;
border-color: #468f41;
}
.yellow {
background: url('chrome://p4t/content/resources/images/yellow-shield-white.png') #e3d02e;
background: url('chrome://pEp4Tb/content/resources/images/yellow-shield-white.png') #e3d02e;
border-color: #c7b729;
color: black;
}
.red {
background: url('chrome://p4t/content/resources/images/red-shield-white.png') #fc625d;
background: url('chrome://pEp4Tb/content/resources/images/red-shield-white.png') #fc625d;
border-color: #c35855;
}
.green-disabled {
background: url('chrome://p4t/content/resources/images/green-shield.png') #ffffff;
background: url('chrome://pEp4Tb/content/resources/images/green-shield.png') #ffffff;
border: 1px solid #468f41;
color: black;
}
.yellow-disabled {
background: url('chrome://p4t/content/resources/images/yellow-shield.png') #ffffff;
background: url('chrome://pEp4Tb/content/resources/images/yellow-shield.png') #ffffff;
border: 1px solid #c7b729;
color: black;
}
.no-color {
background: url('chrome://p4t/content/resources/images/no-color-shield-white.png') #dddddd;
background: url('chrome://pEp4Tb/content/resources/images/no-color-shield-white.png') #dddddd;
border-color: #959595;
color: black;
}


+ 5
- 0
chrome/makeXPI.bat View File

@ -0,0 +1,5 @@
REM Handy script to create the XPI on Windows
zip -r pEp4Tb@pEp.security.xpi . -x makeXPI.bat
REM Jörg's personal use:
copy pEp4Tb@pEp.security.xpi C:\Users\jorgk\AppData\Roaming\Thunderbird\Profiles\qciyaj3h.off42-peptest.ch\extensions\pEp4Tb@pEp.security.xpi

+ 2
- 8
chrome/manifest.json View File

@ -1,5 +1,3 @@
{
"manifest_version": 2,
"name": "p≡p for Thunderbird",
@ -7,7 +5,7 @@
"version": "1.0.0-beta2",
"applications": {
"gecko": {
"id": "p4tb@pEp.security",
"id": "pEp4Tb@pEp.security",
"strict_min_version": "68.0a1"
}
},
@ -20,10 +18,6 @@
"64": "content/resources/images/logo.png"
},
"background": {
"scripts": ["background.js"]
},
"compose_action": {
"default_area": "formattoolbar",
"default_title": "Disable Protection",
@ -35,7 +29,7 @@
"legacy": {
"type": "bootstrap",
"options": {
"page": "chrome://p4t/content/options.xul"
"page": "chrome://pEp4Tb/content/options.xul"
}
}
}

+ 1
- 1
package-lock.json View File

@ -1,5 +1,5 @@
{
"name": "p4t",
"name": "pEp4Tb",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,


+ 1
- 1
package.json View File

@ -1,5 +1,5 @@
{
"name": "p4t",
"name": "pEp4Tb",
"version": "1.0.0",
"dependencies": {
"upgrade": "^1.1.0"


+ 4
- 4
tests/runtime/pepmessengercompose.js View File

@ -1,8 +1,8 @@
var pEpController = ChromeUtils.import("chrome://p4t/content/p4tb.js").pEpController;
var Handshake = ChromeUtils.import("chrome://p4t/content/modules/handshake.js").Handshake;
var helper = ChromeUtils.import("chrome://p4t/content/TbHelper.js").TbHelper;
var view = ChromeUtils.import("chrome://p4t/content/TbMessageView.js").TbMessageView;
var pEpController = ChromeUtils.import("chrome://pEp4Tb/content/pEp4Tbb.js").pEpController;
var Handshake = ChromeUtils.import("chrome://pEp4Tb/content/modules/handshake.js").Handshake;
var helper = ChromeUtils.import("chrome://pEp4Tb/content/TbHelper.js").TbHelper;
var view = ChromeUtils.import("chrome://pEp4Tb/content/TbMessageView.js").TbMessageView;
function isObject(candidate) {
return typeof candidate == "object";


+ 6
- 6
tests/runtime/pepmsghdrview.js View File

@ -1,10 +1,10 @@
var pEpController = ChromeUtils.import("chrome://p4t/content/p4tb.js").pEpController;
var Helper = ChromeUtils.import("chrome://p4t/content/TbHelper.js").TbHelper;
var utils = ChromeUtils.import("chrome://p4t/content/modules/utils.js").pEpUtils;
var view = ChromeUtils.import("chrome://p4t/content/TbMessageView.js").TbMessageView;
var Prefs = ChromeUtils.import("chrome://p4t/content/prefsFactory.js")
var pEpController = ChromeUtils.import("chrome://pEp4Tb/content/pEp4Tbb.js").pEpController;
var Helper = ChromeUtils.import("chrome://pEp4Tb/content/TbHelper.js").TbHelper;
var utils = ChromeUtils.import("chrome://pEp4Tb/content/modules/utils.js").pEpUtils;
var view = ChromeUtils.import("chrome://pEp4Tb/content/TbMessageView.js").TbMessageView;
var Prefs = ChromeUtils.import("chrome://pEp4Tb/content/prefsFactory.js")
.prefsFactory();
var pEpMimeDecrypt = ChromeUtils.import("chrome://p4t/content/pEpMimeDecrypt.js")
var pEpMimeDecrypt = ChromeUtils.import("chrome://pEp4Tb/content/pEpMimeDecrypt.js")
.pEpMimeDecrypt;
function isObject(candidate) {


Loading…
Cancel
Save