From e861607330909b8ef91a4e05520e8164fbb94fa8 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 9 Aug 2019 23:17:10 -0600 Subject: [PATCH 1/6] Update .gitignore slightly --- .gitignore | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 28a19883..b55cbcfa 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,13 @@ *.pem # Various directories -config/config.hjson -logs/ +config/ db/ -dropfiles/ +drop/ +file_base/ +logs/ +mail/ node_modules/ docs/_site/ docs/.sass-cache/ -` \ No newline at end of file +.vscode/ From 8fde4ccd60d39a9e359197f020383b7fcd1d58b0 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 9 Aug 2019 23:17:41 -0600 Subject: [PATCH 2/6] Initial auto-signature support --- art/themes/luciano_blocktronics/autosig.ans | Bin 0 -> 407 bytes art/themes/luciano_blocktronics/theme.hjson | 14 ++++ core/autosig_edit.js | 76 ++++++++++++++++++++ core/fse.js | 18 +++-- core/user_property.js | 1 + 5 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 art/themes/luciano_blocktronics/autosig.ans create mode 100644 core/autosig_edit.js diff --git a/art/themes/luciano_blocktronics/autosig.ans b/art/themes/luciano_blocktronics/autosig.ans new file mode 100644 index 0000000000000000000000000000000000000000..1af14a63ea6d4c7d6ff9f751b661d819980920fb GIT binary patch literal 407 zcmcJLF%N<;5QWRyxVhP-F<~@b3xdc5NC*Q#1zb8A;^z7PC*!pk^#|w;&3o^@v@aC~ z(h$-hMlOX>X`t~zB8V^>`gYaTl`Qvl-=1tpJ7EBY2{*+HE;~{I;M%Q^mIB;4Lz*tu zI9~4K^~O1cF-l1>J>wui={LRNUm;PHexSd2VPa)#N9gChwtd3Le!=7b`J&5)q6DBK dzZwlHfh{CUk1@|Xuo-hRuk%Kpt88-b^9jBcQ2hV^ literal 0 HcmV?d00001 diff --git a/art/themes/luciano_blocktronics/theme.hjson b/art/themes/luciano_blocktronics/theme.hjson index 86f1ed3b..6d8490dc 100644 --- a/art/themes/luciano_blocktronics/theme.hjson +++ b/art/themes/luciano_blocktronics/theme.hjson @@ -447,6 +447,20 @@ } } + editAutoSignature: { + 0: { + mci: { + MT1: { + height: 8 + width: 73 + } + BT2: { + focusTextStyle: upper + } + } + } + } + messageSearch: { 0: { mci: { diff --git a/core/autosig_edit.js b/core/autosig_edit.js new file mode 100644 index 00000000..c9995280 --- /dev/null +++ b/core/autosig_edit.js @@ -0,0 +1,76 @@ +/* jslint node: true */ +'use strict'; + +// ENiGMA½ +const { MenuModule } = require('./menu_module.js'); +const UserProps = require('./user_property.js'); + +// deps +const async = require('async'); +const _ = require('lodash'); + +exports.moduleInfo = { + name : 'User Auto-Sig Editor', + desc : 'Module for editing auto-sigs', + author : 'NuSkooler', +}; + +const FormIds = { + edit : 0, +}; + +const MciViewIds = { + editor : 1, + save : 2, +}; + +exports.getModule = class UserAutoSigEditorModule extends MenuModule { + constructor(options) { + super(options); + this.config = Object.assign({}, _.get(options, 'menuConfig.config'), { extraArgs : options.extraArgs }); + + this.menuMethods = { + saveChanges : (formData, extraArgs, cb) => { + return this.saveChanges(cb); + } + }; + } + + mciReady(mciData, cb) { + super.mciReady(mciData, err => { + if(err) { + return cb(err); + } + + async.series( + [ + (callback) => { + return this.prepViewController('edit', FormIds.edit, mciData.menu, callback); + }, + (callback) => { + const requiredCodes = [ MciViewIds.editor, MciViewIds.save ]; + return this.validateMCIByViewIds('edit', requiredCodes, callback); + }, + (callback) => { + const sig = this.client.user.getProperty(UserProps.AutoSignature) || ''; + this.setViewText('edit', MciViewIds.editor, sig); + return callback(null); + } + ], + err => { + return cb(err); + } + ); + }); + } + + saveChanges(cb) { + const sig = this.getView('edit', MciViewIds.editor).getData().trim(); + this.client.user.persistProperty(UserProps.AutoSignature, sig, err => { + if(err) { + this.client.log.error( { error : err.message }, 'Could not save auto-sig'); + } + return this.prevMenu(cb); + }); + } +}; diff --git a/core/fse.js b/core/fse.js index d77fbfed..8b2214d8 100644 --- a/core/fse.js +++ b/core/fse.js @@ -325,20 +325,21 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul buildMessage(cb) { const headerValues = this.viewControllers.header.getFormData().value; + const area = getMessageAreaByTag(this.messageAreaTag); const getFromUserName = () => { - const area = getMessageAreaByTag(this.messageAreaTag); return (area && area.realNames) ? this.client.user.getProperty(UserProps.RealName) || this.client.user.username : this.client.user.username; }; + let messageBody = this.viewControllers.body.getView(MciViewIds.body.message).getData( { forceLineTerms : this.replyIsAnsi } ); + const msgOpts = { areaTag : this.messageAreaTag, toUserName : headerValues.to, fromUserName : getFromUserName(), subject : headerValues.subject, - message : this.viewControllers.body.getView(MciViewIds.body.message).getData( { forceLineTerms : this.replyIsAnsi } ), }; if(this.isReply()) { @@ -351,11 +352,20 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul // to packetAnsiMsgEncoding (generally cp437) as various boards // really don't like ANSI messages in UTF-8 encoding (they should!) // - msgOpts.meta = { System : { 'explicit_encoding' : _.get(Config(), 'scannerTossers.ftn_bso.packetAnsiMsgEncoding', 'cp437') } }; - msgOpts.message = `${ansi.reset()}${ansi.eraseData(2)}${ansi.goto(1,1)}\r\n${ansi.up()}${msgOpts.message}`; + msgOpts.meta = { System : { 'explicit_encoding' : _.get(Config(), 'scannerTossers.ftn_bso.packetAnsiMsgEncoding', 'cp437') } }; + messageBody = `${ansi.reset()}${ansi.eraseData(2)}${ansi.goto(1,1)}\r\n${ansi.up()}${messageBody}`; } } + if(false != area.autoSignatures) { + const sig = this.client.user.getProperty(UserProps.AutoSignature); + if(sig) { + messageBody += `\r\n-- \r\n${sig}`; + } + } + + msgOpts.message = messageBody; + this.message = new Message(msgOpts); return cb(null); diff --git a/core/user_property.js b/core/user_property.js index 88ac11b1..cc68ef09 100644 --- a/core/user_property.js +++ b/core/user_property.js @@ -27,6 +27,7 @@ module.exports = { LastLoginTs : 'last_login_timestamp', LoginCount : 'login_count', UserComment : 'user_comment', // NYI + AutoSignature : 'auto_signature', DownloadQueue : 'dl_queue', // download_queue.js From 0e6aa563798c930f2582f871f55b3aa1f3444706 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 9 Aug 2019 23:37:00 -0600 Subject: [PATCH 3/6] Fix art: ESC is only cancel --- art/themes/luciano_blocktronics/autosig.ans | Bin 407 -> 410 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/art/themes/luciano_blocktronics/autosig.ans b/art/themes/luciano_blocktronics/autosig.ans index 1af14a63ea6d4c7d6ff9f751b661d819980920fb..ce5b6d0df9a2bc945e9b899655f539e58a5b617f 100644 GIT binary patch delta 44 ucmbQvJd1gPxwMh9bhNQiu7U!PG6zyX+Rz#(;2P|_(O-#?QFU?=qbdOSj0(p9 delta 41 ucmbQmJe_%hxrC{+bhM$hu~DvTFpy Date: Sat, 10 Aug 2019 11:09:34 -0600 Subject: [PATCH 4/6] Comments --- core/fse.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/fse.js b/core/fse.js index 8b2214d8..3c1b70d3 100644 --- a/core/fse.js +++ b/core/fse.js @@ -357,6 +357,9 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul } } + // + // Append auto-signature, if enabled for the area & the user has one + // if(false != area.autoSignatures) { const sig = this.client.user.getProperty(UserProps.AutoSignature); if(sig) { @@ -364,8 +367,8 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul } } + // finally, create the message msgOpts.message = messageBody; - this.message = new Message(msgOpts); return cb(null); From 5db0a33a8a9c90b7a1182487e45dea4f977aca8d Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sat, 10 Aug 2019 12:17:56 -0600 Subject: [PATCH 5/6] Add missing entry to template --- misc/menu_template.in.hjson | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/misc/menu_template.in.hjson b/misc/menu_template.in.hjson index c2bbdd3f..71901719 100644 --- a/misc/menu_template.in.hjson +++ b/misc/menu_template.in.hjson @@ -2090,6 +2090,10 @@ value: { command: "S" } action: @menu:messageSearch } + { + value: { command: "A" } + action: @menu:editAutoSignature + } { value: 1 action: @menu:messageArea @@ -2097,6 +2101,42 @@ ] } + editAutoSignature: { + desc: Auto Sig Editor + module: autosig_edit + art: autosig + form: { + 0: { + mci: { + MT1: { + argName: signature + tabSwitchesView: true + } + BT2: { + text: save + argName: save + submit: true + } + } + submit: { + *: [ + { + value: { save: null } + action: @method:saveChanges + } + ] + } + + actionKeys: [ + { + keys: [ "escape" ] + action: @systemMethod:prevMenu + } + ] + } + } + } + messageSearch: { desc: Message Search module: message_base_search From da545d88200e895fd90e5716db3b1183052abd62 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sat, 10 Aug 2019 12:18:47 -0600 Subject: [PATCH 6/6] Fix default art --- art/themes/luciano_blocktronics/MSGMNU.ANS | Bin 3685 -> 3712 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/art/themes/luciano_blocktronics/MSGMNU.ANS b/art/themes/luciano_blocktronics/MSGMNU.ANS index 9c373944c901ce9fba4302f0fee7c0ef272e5d00..a532804b295b5498300b1a9f94965e6bba959f37 100644 GIT binary patch delta 50 zcmaDV(;&Oy6|0=Nvvjm!ZlZLwL9T*yw6R%kYD#8_LSku2zHV`5`sTN+K^#n?e3Kpd FQ~;~D590s; delta 23 ecmZpWeJZoz6)Urmk@IE_wjd6sU%ZoJ_*4L34F@d%