Browse Source

Read files from imap server using streams

1.1.101
Chris Fuertes 3 years ago
parent
commit
6c97affba1
4 changed files with 389 additions and 146 deletions
  1. +168
    -0
      .hgignore
  2. +4
    -1
      README.md
  3. +5
    -8
      chrome/content/modules/pEpAdapter.js
  4. +212
    -137
      chrome/content/pepmsghdrview.js

+ 168
- 0
.hgignore View File

@ -0,0 +1,168 @@
build
# Created by .ignore support plugin (hsz.mobi)
syntax: glob
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
### macOS template
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

+ 4
- 1
README.md View File

@ -4,4 +4,7 @@
Using docker
```docker build -t <image_tag> . && docker run -v build:/usr/src/app/build <image_tag> ```
Using bash
```zip -r build/p4t.xpi chrome```

+ 5
- 8
chrome/content/modules/pEpAdapter.js View File

@ -9,7 +9,7 @@ const DIR_OUTGOING = 1;
const ENC_FORMAT_PEP = 4;
const PEP_PREFIX = "pEp-";
const RATING_COLOR_GREY = "grey";
const RATING_COLOR_NO_COLOR = "no_color";
const RATING_COLOR_RED = "red";
const RATING_COLOR_GREEN = "green";
const RATING_COLOR_YELLOW = "yellow";
@ -64,10 +64,7 @@ class pEpAdapter {
message.reply_to = replyTo;
}
//message.longmsg = "";
// message.addAttachment(btoa(body), body.length);
//message.addAttachment(body, body.length);
let params = [
message,
@ -145,15 +142,15 @@ class pEpAdapter {
async color_from_rating(rating) {
let color = RATING_COLOR_GREY;
let color = RATING_COLOR_NO_COLOR;
if (rating === -2 || rating === 2) {
color = RATING_COLOR_GREY;
color = RATING_COLOR_NO_COLOR;
}
else if (rating < 0) {
color = RATING_COLOR_RED;
}
else if (rating < 6) {
color = RATING_COLOR_GREY;
color = RATING_COLOR_NO_COLOR;
}
else if (rating >= 7) {
color = RATING_COLOR_GREEN;


+ 212
- 137
chrome/content/pepmsghdrview.js View File

@ -18,7 +18,7 @@ let onLoadListener = (event) => {
console.log("pepmsghdrview.js: onLoadListener()");
let onStartHeadersMessageListener = () => {
let messagePanelFrame = getPanel("messagepane", window);
let messagePanelFrame = window.GetMessagePaneFrame();
console.log("pepmsghdrview.js: onLoadMsgPanelFrameListener(), frame: ", messagePanelFrame);
if (messagePanelFrame != null) {
console.log("pepmsghdrview.js: onLoadListener() added listener");
@ -48,10 +48,11 @@ let onLoadMsgPanelFrameListener = (event) => {
function updateBody(newBody) {
//TODO Not implemented yet
let bodyElement = getPanel("messagepane", window).document.getElementsByTagName("body")[0];
let panel = window.GetMessagePaneFrame();
let bodyElement = panel.document.getElementsByTagName("body")[0];
let node = bodyElement.firstChild;
while (node) {
if(node.nodeName === "DIV" || node.nodeName === "PRE") {
if (node.nodeName === "DIV" || node.nodeName === "PRE") {
if (node.textContent.indexOf("-----BEGIN PGP")) {
node.innerHTML = newBody;
return;
@ -67,148 +68,222 @@ let onLoadMsgPanelFrameListener = (event) => {
}
let messageString;
console.log("pepmsghdrview.js: onLoadMsgPanelFrameListener()");
// read email from tb
// TODO decrypt mail
let messageString = "-----BEGIN PGP MESSAGE-----\n" +
"\n" +
"hQEMA3nTjPcdpPimAQgA2yAWJ7f3UdRvL/D8PI6KgAExPnQ4g8bEOUpwOgmo435x\n" +
"rEKlkP/QMGUWZfliDlhTAugaxqAxzVE4+rfyp9OqQUSj9S5xToIj0/qMa3ae4wLF\n" +
"WUxPksBVbb0r8nPQgGP9cpWa0+MWi3vUWeEvdcpcPCGsgmTKkxOKbqDAOD5GEKxX\n" +
"xj7iodBCevzf+nFtrHoMU56qkdreY/Pw1BTCFUPAUB8cEfqIp58CAfwP+WJUM2LM\n" +
"uMkZ4tq+F+bT5Q6oZUVqwdWeARlD6lu6LYFM/MQTBwHL9vVtpz35e7/yYa0O7lMB\n" +
"ev9ccn2a2qPaCdQt3tGfKREluT4GBhljxR5Oe55SUdJHASOnYNeFd48wfToxkXkv\n" +
"j1urYFxRZmq9atq0upqd2EnWlxq2OitrcG0PM4uuLKsw+vGjkElAqotLxdQqwXMJ\n" +
"jkogthSisZ8=\n" +
"=dTBg\n" +
"-----END PGP MESSAGE-----";
/*
let messageString = "-----BEGIN PGP MESSAGE-----\n" +
"\n" +
"hQIMAwofEBEEk5qCAQ//S/hegAyrCMSsxzgDwYWdZBILgxRvLM3g3ABAoTM8MRRW\n" +
"4hhHalak6Jds4VTtEcMAphcXdZIyI4AOXRLgJxktaiy4JglgPXkUGi0FicXz/UaV\n" +
"niZSOInlgyrPd9S1HUx9SxwI2qbT7inM0jmudwV7T63QOeo/vFahHlQS4N95Zw97\n" +
"cRV64lm/G9qSF6qPdJMDck7kdXIBbCBd/+XHpJ274RYyFnSgiVcUrFycda/QJqcT\n" +
"aSD+jkYTjmiRQJwr8KIrSxAhCH4MVuNT1E61vRDTNKhr8w1wfd6FktRLDxzPVaRi\n" +
"Lzx0d+KPNgWM0PAojJzfk+auptc44qTJeQekGg7KxQtZAyZZrU0+B8Tz9SqGjcXU\n" +
"yx4pdGZ19ivNYZcqDo2EtLpnc58Yy2ut5Ax+l3oyGUdDI8ICBujqnrWvyhVzAHwz\n" +
"5aIf1RUO/MuK96Y3sfECHZMFguEhF5Mdh8wg2pHjOH80Ldvuks95RkrS0MqCdy3I\n" +
"Zrs0NcWuzkHyMu+cX8u4KUD73tl81Dq3MvBQw6lojZYQTKC/atFEYZfVdf6o9npr\n" +
"RwncgxPKMOv6+ZxFv2QicuayhconL37gYFhMe/ZnYDpfNRm7XOO+3C8JY52eGXmI\n" +
"cguNV7+ERyh3W8263OgaL/yJ5NikJN0lovAQXAhWQPMi8wMQBnOX9mGwYRbegc6F\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x27CjTQ+h0+s+viOXBB\n" +
"LTWVi7Mm7bhqYnJz6Zme/gY3Kc6815FxnLR2dILzeZY0vFxFHOOTwrlOxV1jHPOS\n" +
"n2zsAJgoBieSdLqq5zygu8iTVeC1SFT3QNCHrl+UaTylX7T8kWW8eumuU6gRFPaV\n" +
"Sr2kl6sMaEtqKsmobd9KXjgjMZ5iV4v7EDloeBo=\n" +
"=xc3m\n" +
"-----END PGP MESSAGE-----";
*/
pep.decryptMail(messageString, currentHeaderData).then((message) => {
// replace encrypted mail with decrypted from pEpAdapter
updateSubject(message.shortmsg);
updateBody(message.longmsg);
pep.getPrivacyColorFromRating(message.rating).then(
(rating) => updatePrivacy(rating)
let messageStringPlainPGP = `-----BEGIN PGP MESSAGE-----
hQEMA3nTjPcdpPimAQgA2yAWJ7f3UdRvL/D8PI6KgAExPnQ4g8bEOUpwOgmo435x
rEKlkP/QMGUWZfliDlhTAugaxqAxzVE4+rfyp9OqQUSj9S5xToIj0/qMa3ae4wLF
WUxPksBVbb0r8nPQgGP9cpWa0+MWi3vUWeEvdcpcPCGsgmTKkxOKbqDAOD5GEKxX
xj7iodBCevzf+nFtrHoMU56qkdreY/Pw1BTCFUPAUB8cEfqIp58CAfwP+WJUM2LM
uMkZ4tq+F+bT5Q6oZUVqwdWeARlD6lu6LYFM/MQTBwHL9vVtpz35e7/yYa0O7lMB
ev9ccn2a2qPaCdQt3tGfKREluT4GBhljxR5Oe55SUdJHASOnYNeFd48wfToxkXkv
j1urYFxRZmq9atq0upqd2EnWlxq2OitrcG0PM4uuLKsw+vGjkElAqotLxdQqwXMJ
jkogthSisZ8=
=dTBg
-----END PGP MESSAGE-----`;
let messageStringpEpEncrypted = `-----BEGIN PGP MESSAGE-----
4hhHalak6Jds4VTtEcMAphcXdZIyI4AOXRLgJxktaiy4JglgPXkUGi0FicXz/UaV
hQIMAwofEBEEk5qCAQ//S/hegAyrCMSsxzgDwYWdZBILgxRvLM3g3ABAoTM8MRRW
niZSOInlgyrPd9S1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houfvpOQlAj+HD6I5BnHBvwW39clUTlL5b16GLz
rMnYPhyOtLz6w3SUDKMdzwE5ankgp+8ToGc+He3PkJTUWx27CjTQ+h0+s+viOXBB
LTWVi7Mm7bhqYnJz6Zme/gY3Kc6815FxnLR2dILzeZY0vFxFHOOTwrlOxV1jHPOS
n2zsAJgoBieSdLqq5zygu8iTVeC1SFT3QNCHrl+UaTylX7T8kWW8eumuU6gRFPaV
Sr2kl6sMaEtqKsmobd9KXjgjMZ5iV4v7EDloeBo=
=xc3m
-----END PGP MESSAGE-----`;
let currentUri = getCurrentMessageURI();
if (currentUri !== null) {
try {
messageString = readMailFromUri(currentUri);
}
catch (e) {
console.debug("Errors while reading message from uri", e);
}
pep.decryptMail(messageString, currentHeaderData).then((message) => {
// replace encrypted mail with decrypted from pEpAdapter
updateSubject(message.shortmsg);
updateBody(message.longmsg);
pep.getPrivacyColorFromRating(message.rating).then(
(rating) => updatePrivacy(rating)
);
});
}
};
let readMailFromUri = (msgUri) => {
let msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"].createInstance();
msgWindow = msgWindow.QueryInterface(Ci.nsIMsgWindow);
let msgStream = Cc["@mozilla.org/network/sync-stream-listener;1"].createInstance();
msgStream = msgStream.QueryInterface(Ci.nsIInputStream);
let messenger = Cc["@mozilla.org/messenger;1"].getService(Ci.nsIMessenger);
let msgService = messenger.messageServiceFromURI(msgUri);
let scriptInputStream = Cc["@mozilla.org/scriptableinputstream;1"].createInstance();
scriptInputStream = scriptInputStream.QueryInterface(Ci.nsIScriptableInputStream);
scriptInputStream.init(msgStream);
try {
msgService.streamMessage(msgUri, // uri of message to stream
msgStream, // a stream listener listening to the message
msgWindow, // a nsIMsgWindow for progress and status feedback
null, // a nsIUrlListener that is notified when url starts and stops
false, // it will create a stream converter from message rfc2822 to
null // Header added to the URI. e.g., header=filter
);
});
} catch (ex) {
console.debug("Error while reading mail from server", ex);
}
// Get only the PGP message
let keyFound = false;
let content = "";
let str = "";
const PGP_MESSAGE_HEADER = "-----BEGIN PGP MESSAGE-----";
const PGP_MESSAGE_FOOTER = "-----END PGP MESSAGE-----";
const INPUTSTREAM_READING_SIZE = 512;
while (scriptInputStream.available()) {
str = scriptInputStream.read(INPUTSTREAM_READING_SIZE);
let pgpStartIndex = str.indexOf(PGP_MESSAGE_HEADER);
let pgpEndIndex = str.indexOf(PGP_MESSAGE_FOOTER);
if (pgpStartIndex >= 0) {
keyFound = true;
str = str.substring(pgpStartIndex);
} else if (pgpEndIndex >= 0) {
content += str.substring(0, pgpEndIndex + PGP_MESSAGE_FOOTER.length);
break;
}
if (keyFound) {
content += str;
}
}
return content;
};
let getCurrentMessageURI = () => {
if (gFolderDisplay.selectedMessages.length === 1) {
return gFolderDisplay.selectedMessageUris[0];
}
return null;
};
window.addEventListener("load", onLoadListener, false);


Loading…
Cancel
Save