Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Message-ID header to CSV export #602

Open
wants to merge 2 commits into
base: v14.1.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/chrome/content/mboximport/exportTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ function createIndexCSV(type, file2, hdrArray, msgFolder, addBody) {
hasAtt = " ";
}

var body = addBody ? hdrs[8] : "";
var body = addBody ? hdrs[9] : "";

// Utilize index format for CSV
// https://github.com/thundernest/import-export-tools-ng/issues/161
Expand All @@ -1282,7 +1282,13 @@ function createIndexCSV(type, file2, hdrArray, msgFolder, addBody) {
accountFolderCol = '"' + hdrs[5] + '"' + sep;
}

var record = accountFolderCol + '"' + subj.replace(/\"/g, '""') + '"' + sep + '"'
// Add experimental message ID
let messageIdCol = "";
if (IETprefs.getBoolPref("extensions.importexporttoolsng.experimental.csv.message_id_col")) {
messageIdCol = '"' + hdrs[8].replace(/\"/g, '""') + '"' + sep;
}

var record = accountFolderCol + messageIdCol + '"' + subj.replace(/\"/g, '""') + '"' + sep + '"'
+ auth.replace(/\"/g, '""') + '"' + sep + '"' + recc.replace(/\"/g, '""') +
'"' + sep + csvDate + sep + hasAtt + sep + size + sep + body + "\r\n";

Expand Down Expand Up @@ -2440,6 +2446,7 @@ function IETstoreHeaders(msg, msguri, subfile, addBody) {
} catch (e) {
recipients = "***";
}
var msgid = msg.messageId;
author = author.replace("<", "&lt;");
author = author.replace(">", "&gt;");
author = author.replace(/\"/, "");
Expand Down Expand Up @@ -2473,19 +2480,19 @@ function IETstoreHeaders(msg, msguri, subfile, addBody) {
// will insert §][§^^§ in subject....but why should (s)he write it???
switch (IETsortType) {
case 1:
hdrStr = realsubject + "§][§^^§" + recipients + "§][§^^§" + author + "§][§^^§" + time + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + body;
hdrStr = realsubject + "§][§^^§" + recipients + "§][§^^§" + author + "§][§^^§" + time + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + msgid + "§][§^^§" + body;
break;

case 2:
hdrStr = author + "§][§^^§" + realsubject + "§][§^^§" + recipients + "§][§^^§" + time + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + body;
hdrStr = author + "§][§^^§" + realsubject + "§][§^^§" + recipients + "§][§^^§" + time + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + msgid + "§][§^^§" + body;
break;

case 3:
hdrStr = recipients + "§][§^^§" + realsubject + "§][§^^§" + author + "§][§^^§" + time + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + body;
hdrStr = recipients + "§][§^^§" + realsubject + "§][§^^§" + author + "§][§^^§" + time + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + msgid + "§][§^^§" + body;
break;

default:
hdrStr = time + "§][§^^§" + realsubject + "§][§^^§" + recipients + "§][§^^§" + author + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + body;
hdrStr = time + "§][§^^§" + realsubject + "§][§^^§" + recipients + "§][§^^§" + author + "§][§^^§" + subject + "§][§^^§" + msguri + "§][§^^§" + hasAtt + "§][§^^§" + size + "§][§^^§" + msgid + "§][§^^§" + body;
}
// If the subject begins with a lowercase letter, the sorting will be wrong
// so it is changed in uppercase. To track this and restore the original
Expand Down
1 change: 1 addition & 0 deletions src/defaults/preferences/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pref("extensions.importexporttoolsng.experimental.hot_keys", "");
pref("extensions.importexporttoolsng.experimental.index_short1", false);
pref("extensions.importexporttoolsng.experimental.printPDF.use_global_preferences", true);
pref("extensions.importexporttoolsng.experimental.csv.account_folder_col", false);
pref("extensions.importexporttoolsng.experimental.csv.message_id_col", false);
pref("extensions.importexporttoolsng.export.strip_CR_for_EML_exports", false);
pref("extensions.importexporttoolsng.help.showOnInstallAndUpdate", true);
pref("extensions.importexporttoolsng.help.openInWindow", false);
Expand Down