Skip to content

Instantly share code, notes, and snippets.

@shirosaki
Created August 31, 2011 12:56
Show Gist options
  • Save shirosaki/1183468 to your computer and use it in GitHub Desktop.
Save shirosaki/1183468 to your computer and use it in GitHub Desktop.
fix inline PGP quoted text
--- origin/modules/plugins/enigmail.js 2011-08-29 09:48:13.000000000 +0900
+++ gconversation@xulforum.org/modules/plugins/enigmail.js 2011-08-31 21:37:11.000000000 +0900
@@ -179,6 +179,7 @@
"<div class='moz-text-plain' wrap='true' graphical-quote='true'>"
+ EnigmailFuncs.formatPlaintextMsg(msgRfc822Text)
+ "</div>";
+ replaceTextNodeToPre(bodyElement);
}
return statusFlagsObj.value;
}
@@ -189,6 +190,27 @@
}
}
+// Fix incorrect quoted text
+function replaceTextNodeToPre(bodyElement) {
+ let pgpPartMark = false;
+ for each (let [, x] in Iterator(bodyElement.childNodes[0].childNodes)) {
+ if (x.nodeType == x.TEXT_NODE) {
+ let pre = x.ownerDocument.createElement("pre");
+ pre.setAttribute("wrap", "");
+ if (pgpPartMark) {
+ pre.style.display = "inline";
+ pgpPartMark = false;
+ }
+ if (x.nextSibling && x.nextSibling.classList.contains("moz-txt-star")) {
+ pre.style.display = "inline";
+ pgpPartMark = true;
+ }
+ pre.textContent = x.textContent;
+ x.parentNode.replaceChild(pre, x);
+ }
+ }
+}
+
let enigmailHook = {
_domNode: null,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment