diff --git a/core/ftn_mail_packet.js b/core/ftn_mail_packet.js index c8312eeb..25d2d6be 100644 --- a/core/ftn_mail_packet.js +++ b/core/ftn_mail_packet.js @@ -169,8 +169,10 @@ exports.PacketHeader = PacketHeader; // * Writeup on differences between type 2, 2.2, and 2+: // http://walon.org/pub/fidonet/FTSC-nodelists-etc./pkt-types.txt // -function Packet() { +function Packet(options) { var self = this; + + this.options = options || {}; this.parsePacketHeader = function(packetBuffer, cb) { assert(Buffer.isBuffer(packetBuffer)); @@ -574,6 +576,10 @@ function Packet() { if(messageBodyData.tearLine) { msg.meta.FtnProperty.ftn_tear_line = messageBodyData.tearLine; + + if(self.options.keepTearAndOrigin) { + msg.message += `\r\n${messageBodyData.tearLine}\r\n`; + } } if(messageBodyData.seenBy.length > 0) { @@ -586,6 +592,10 @@ function Packet() { if(messageBodyData.originLine) { msg.meta.FtnProperty.ftn_origin = messageBodyData.originLine; + + if(self.options.keepTearAndOrigin) { + msg.message += `${messageBodyData.originLine}\r\n`; + } } const nextBuf = packetBuffer.slice(read); diff --git a/core/message_area.js b/core/message_area.js index 4d47b31e..97565416 100644 --- a/core/message_area.js +++ b/core/message_area.js @@ -69,6 +69,8 @@ function getSortedAvailMessageConferences(client, options) { // Return an *object* of available areas within |confTag| function getAvailableMessageAreasByConfTag(confTag, options) { options = options || {}; + + // :TODO: confTag === "" then find default if(_.has(Config.messageConferences, [ confTag, 'areas' ])) { const areas = Config.messageConferences[confTag].areas; diff --git a/core/multi_line_edit_text_view.js b/core/multi_line_edit_text_view.js index cfc6341f..63c5e20b 100644 --- a/core/multi_line_edit_text_view.js +++ b/core/multi_line_edit_text_view.js @@ -266,24 +266,21 @@ function MultiLineEditTextView(options) { } return lines; }; - - this.getOutputText = function(startIndex, endIndex, includeEol) { - var lines = self.getTextLines(startIndex, endIndex); - - // - // Convert lines to contiguous string -- all expanded - // tabs put back to single '\t' characters. - // - var text = ''; - var re = new RegExp('\\t{1,' + (self.tabWidth) + '}', 'g'); - for(var i = 0; i < lines.length; ++i) { - text += lines[i].text.replace(re, '\t'); - if(includeEol && lines[i].eol) { - text += '\n'; - } - } - return text; - }; + + this.getOutputText = function(startIndex, endIndex, eolMarker) { + let lines = self.getTextLines(startIndex, endIndex); + let text = ''; + var re = new RegExp('\\t{1,' + (self.tabWidth) + '}', 'g'); + + lines.forEach(line => { + text += line.text.replace(re, '\t'); + if(eolMarker && line.eol) { + text += eolMarker; + } + }); + + return text; + } this.getContiguousText = function(startIndex, endIndex, includeEol) { var lines = self.getTextLines(startIndex, endIndex); @@ -1018,7 +1015,7 @@ MultiLineEditTextView.prototype.addText = function(text) { }; MultiLineEditTextView.prototype.getData = function() { - return this.getOutputText(0, this.textLines.length, true); + return this.getOutputText(0, this.textLines.length, '\r\n'); }; MultiLineEditTextView.prototype.setPropertyValue = function(propName, value) { diff --git a/core/scanner_tossers/ftn_bso.js b/core/scanner_tossers/ftn_bso.js index 6414ee35..b674a833 100644 --- a/core/scanner_tossers/ftn_bso.js +++ b/core/scanner_tossers/ftn_bso.js @@ -806,7 +806,9 @@ function FTNMessageScanTossModule() { this.importMessagesFromPacketFile = function(packetPath, password, cb) { let packetHeader; - new ftnMailPacket.Packet().read(packetPath, (entryType, entryData, next) => { + const packetOpts = { keepTearAndOrigin : true }; + + new ftnMailPacket.Packet(packetOpts).read(packetPath, (entryType, entryData, next) => { if('header' === entryType) { packetHeader = entryData;