+// Compose a references string using existing references plus the message being replied to
+function compose_references(references, msgid) {
+ if (references.includes("@")) {
+ refs = references + "|";
+ }
+ else {
+ refs = "";
+ }
+ refs += msgid;
+
+ console.log("initial len: " + refs.length);
+ // If the resulting string is too big, we can trim it here
+ while (refs.length > 900) {
+ r = refs.split("|");
+ r.splice(1,1); // remove the second element so we keep the root
+ refs = r.join("|");
+ console.log("split len: " + refs.length);
+ }
+
+
+ return refs;
+}
+
+