Browse Source

Another installment in the never ending Re: processing litany.

1.1.101
Jorg Knobloch 2 years ago
parent
commit
28e97bbf7b
3 changed files with 13 additions and 17 deletions
  1. +2
    -4
      chrome/content/TbHelper.js
  2. +8
    -10
      chrome/content/TbMessageView.js
  3. +3
    -3
      chrome/content/pepmessengercompose.js

+ 2
- 4
chrome/content/TbHelper.js View File

@ -11,10 +11,8 @@ const TbHelper = {
copyMessageToFolder(msgHdr, newSubject, content) {
// Setting the subject here to the version where the Re: prefix was removed,
// as returned from `updateSubject()`, seems to have a positive effect.
// This is the result of quite some experimentation. In reality
// this appears to be another workaround for
// https://bugzilla.mozilla.org/show_bug.cgi?id=1629555
// as the correct subject should have already been stored in that function.
// This is the result of quite some experimentation.
// Ideally the correct subject should have already been stored in that function.
if (newSubject) msgHdr.subject = newSubject;
// Copy copied form Header Tools Lite. There is a variation in Enigmail.


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

@ -23,7 +23,8 @@ const TbMessageView = {
}
for (let p of prefixes) {
let regEx = new RegExp(`^(${p}: )+`, "i");
subject = subject.replace(regEx, ""); // Remove prefix.
// Remove prefix.
subject = subject.replace(regEx, "");
}
let hadRe = (subject != content);
@ -33,22 +34,19 @@ const TbMessageView = {
// The database doesn't like raw UTF apparently.
subject = jsmime.headeremitter.emitStructuredHeader("subject", subject, {}).substring(9);
// We should store the subject without any Re: prefix, but
// https://bugzilla.mozilla.org/show_bug.cgi?id=1629555
// gets in the way. So the correct code is commented out for now.
// Correct would be these two lines ...
// if (hadRe) msgHdr.flags |= Ci.nsMsgMessageFlags.HasRe;
// msgHdr.subject = subject;
// ... and replace the if-else below.
if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe) {
// If the flag is already set, we can just store the subject.
msgHdr.subject = subject;
} else {
// This is WRONG. Should not prepend "Re: " but instead set the flag. See above.
// It would be nice to store the subject without the "Re:" prefix and set
// the HasRe flag instead. That works when calling
// tree.view.db.NotifyHdrChangeAll(msgHdr, msgHdr.flags | Ci.nsMsgMessageFlags.HasRe, msgHdr.flags, {});
// but sadly the solution falls apart when copying messages between
// IMAP folders or between local and IMAP folders.
// eslint-disable-next-line prefer-template
msgHdr.subject = hadRe ? "Re: " + subject : subject;
}
if (tree) tree.invalidate();
if (tree && tree.view && tree.view.selection) tree.invalidateRow(tree.view.selection.currentIndex);
return subject;
},


+ 3
- 3
chrome/content/pepmessengercompose.js View File

@ -235,9 +235,9 @@ var pEpComposer = {
};
}
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1629555
// that doesn't allow us to correctly store the HasRe flag.
// So now we need to fix the side effects :-(
// Workaround for the fact that some messages have a "Re:" stored
// in the subject and don't have the HasRe flag set. In that case
// we receive a doubled up "Re:".
let subjElem = document.getElementById("msgSubject");
if (subjElem) {
let prefixes = Services.prefs.getStringPref("mailnews.localizedRe", "");


Loading…
Cancel
Save