Newscan functionality for messages in working state

This commit is contained in:
Bryan Ashby 2016-01-03 19:40:34 -07:00
parent 7aab03c4ba
commit dd82a24e56
5 changed files with 149 additions and 16 deletions

View File

@ -110,7 +110,11 @@ function FullScreenEditorModule(options) {
// //
this.editorType = config.editorType; this.editorType = config.editorType;
this.editorMode = config.editorMode; this.editorMode = config.editorMode;
this.messageAreaName = config.messageAreaName || Message.WellKnownAreaNames.Private;
if(config.messageAreaName) {
this.messageAreaName = config.messageAreaName;
}
this.messageIndex = config.messageIndex || 0; this.messageIndex = config.messageIndex || 0;
this.messageTotal = config.messageTotal || 0; this.messageTotal = config.messageTotal || 0;
this.toUserId = config.toUserId || 0; this.toUserId = config.toUserId || 0;
@ -145,7 +149,7 @@ function FullScreenEditorModule(options) {
}; };
this.isLocalEmail = function() { this.isLocalEmail = function() {
return 'email' === self.editorType && Message.WellKnownAreaNames.Private === self.messageAreaName; return Message.WellKnownAreaNames.Private === self.messageAreaName;
}; };
this.isReply = function() { this.isReply = function() {

View File

@ -19,14 +19,16 @@ exports.getModule = NewScanModule;
/* /*
* :TODO: * :TODO:
* * Update message ID when reading (this should be working!) * * User configurable new scan: Area selection (avail from messages area) (sep module)
* * New scan all areas
* * User configurable new scan: Area selection (avail from messages area)
* * Add status TL/VM (either/both should update if present) * * Add status TL/VM (either/both should update if present)
* * * *
*/ */
var MciCodeIds = {
ScanStatusLabel : 1, // TL1
ScanStatusList : 2, // VM2 (appends)
};
function NewScanModule(options) { function NewScanModule(options) {
MenuModule.call(this, options); MenuModule.call(this, options);
@ -35,9 +37,27 @@ function NewScanModule(options) {
var config = this.menuConfig.config; var config = this.menuConfig.config;
this.currentStep = 'messageAreas'; this.currentStep = 'messageAreas';
this.currentScanAux = 0; // Message.WellKnownAreaNames.Private this.currentScanAux = 0; // e.g. Message.WellKnownAreaNames.Private when currentSteps = messageAreas
this.scanStartFmt = config.scanStartFmt || 'Scanning {desc}...';
this.scanFinishNoneFmt = config.scanFinishNoneFmt || 'Nothing new';
this.scanFinishNewFmt = config.scanFinishNewFmt || '{count} entries found';
this.scanCompleteMsg = config.scanCompleteMsg || 'Finished newscan';
this.updateScanStatus = function(statusText) {
var vc = self.viewControllers.allViews;
var view = vc.getView(MciCodeIds.ScanStatusLabel);
if(view) {
view.setText(statusText);
}
view = vc.getView(MciCodeIds.ScanStatusList);
// :TODO: MenuView needs appendItem()
if(view) {
}
};
this.newScanMessageArea = function(cb) { this.newScanMessageArea = function(cb) {
var availMsgAreas = msgArea.getAvailableMessageAreas( { includePrivate : true } ); var availMsgAreas = msgArea.getAvailableMessageAreas( { includePrivate : true } );
var currentArea = availMsgAreas[self.currentScanAux]; var currentArea = availMsgAreas[self.currentScanAux];
@ -54,16 +74,31 @@ function NewScanModule(options) {
self.currentScanAux += 1; self.currentScanAux += 1;
callback(null); callback(null);
} else { } else {
self.updateScanStatus(self.scanCompleteMsg);
callback(new Error('No more areas')); callback(new Error('No more areas'));
} }
}, },
function updateStatus(callback) { function updateStatusScanStarted(callback) {
// :TODO: Update status text self.updateScanStatus(self.scanStartFmt.format({
desc : currentArea.desc,
}));
callback(null); callback(null);
}, },
function newScanAreaAndGetMessages(callback) { function newScanAreaAndGetMessages(callback) {
msgArea.getNewMessagesInAreaForUser( msgArea.getNewMessagesInAreaForUser(
self.client.user.userId, currentArea.name, function msgs(err, msgList) { self.client.user.userId, currentArea.name, function msgs(err, msgList) {
if(!err) {
if(0 === msgList.length) {
self.updateScanStatus(self.scanFinishNoneFmt.format({
desc : currentArea.desc,
}));
} else {
self.updateScanStatus(self.scanFinishNewFmt.format({
desc : currentArea.desc,
count : msgList.length,
}));
}
}
callback(err, msgList); callback(err, msgList);
} }
); );

View File

@ -369,9 +369,6 @@
art: LETTER art: LETTER
options: { pause: true } options: { pause: true }
next: newUserFeedbackToSysOp next: newUserFeedbackToSysOp
extraArgs: {
messageAreaName: private_mail
}
} }
newUserFeedbackToSysOp: { newUserFeedbackToSysOp: {
@ -395,7 +392,9 @@
help: MSGEHLP help: MSGEHLP
}, },
editorMode: edit editorMode: edit
editorType: area editorType: email
messageAreaName: private_mail
toUserId: 1 /* always to +op */
} }
form: { form: {
0: { 0: {
@ -505,6 +504,7 @@
options: { pause: true } options: { pause: true }
next: fullLoginSequenceLastCallers next: fullLoginSequenceLastCallers
} }
fullLoginSequenceLastCallers: { fullLoginSequenceLastCallers: {
desc: Last Callers desc: Last Callers
module: last_callers module: last_callers
@ -517,8 +517,34 @@
module: whos_online module: whos_online
art: WHOSON art: WHOSON
options: { pause: true } options: { pause: true }
next: fullLoginSequenceSysStats next: fullLoginSequenceNewScanConfirm
} }
fullLoginSequenceNewScanConfirm: {
desc: Logging In
prompt: loginGlobalNewScan
submit: [
{
value: { promptValue: 0 }
action: @menu:fullLoginSequenceNewScan
}
{
value: { promptValue: 1 }
action: @menu:fullLoginSequenceUserStats
}
]
}
fullLoginSequenceNewScan: {
desc: Performing New Scan
module: @systemModule:new_scan
art: NEWSCAN
next: fullLoginSequenceSysStats
config: {
messageListMenu: newScanMessageList
}
}
fullLoginSequenceSysStats: { fullLoginSequenceSysStats: {
desc: System Stats desc: System Stats
art: SYSSTAT art: SYSSTAT
@ -532,6 +558,40 @@
next: mainMenu next: mainMenu
} }
newScanMessageList: {
desc: Viewing New Message List
module: msg_list
art: NEWMSGS
config: {
menuViewPost: messageAreaViewPost
}
form: {
0: {
mci: {
VM1: {
focus: true
submit: true
argName: message
}
}
submit: {
*: [
{
value: { message: null }
action: @method:selectMessage
}
]
}
actionKeys: [
{
keys: [ "escape", "q", "shift + q" ]
action: @systemMethod:prevMenu
}
]
}
}
}
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Main Menu // Main Menu
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@ -743,6 +803,10 @@
value: { command: "4" } value: { command: "4" }
action: @menu:doorTradeWars2002BBSLink action: @menu:doorTradeWars2002BBSLink
} }
{
value: { command: "DL" }
action: @menu:doorDarkLands
}
] ]
} }
@ -763,6 +827,24 @@
io: socket io: socket
} }
} }
doorDarkLands: {
desc: Playing Dark Lands
module: abracadabra
config: {
name: DARKLANDS
dropFileType: DOOR
cmd: /home/nuskooler/dev/enigma-bbs/doors/darklands/start.sh
args: [
"{node}",
"{dropFile}",
"{srvPort}",
],
nodeMax: 1
tooManyArt: DOORMANY
io: socket
}
}
doorLORD: { doorLORD: {
desc: Playing L.O.R.D. desc: Playing L.O.R.D.
@ -860,7 +942,6 @@
module: msg_list module: msg_list
art: MSGLIST art: MSGLIST
config: { config: {
listType: public
menuViewPost: messageAreaViewPost menuViewPost: messageAreaViewPost
} }
form: { form: {

View File

@ -45,7 +45,7 @@ function AreaPostFSEModule(options) {
if(err) { if(err) {
// :TODO:... sooooo now what? // :TODO:... sooooo now what?
} else { } else {
console.log(msg); console.log(msg); // :TODO: remove me -- probably log that one was saved, however.
} }
self.nextMenu(); self.nextMenu();

View File

@ -46,6 +46,19 @@
} }
} }
loginGlobalNewScan: {
art: GNSPMPT
mci: {
TM1: {
argName: promptValue
items: [ "yes", "no" ]
focus: true
hotKeys: { Y: 0, N: 1 }
hotKeySubmit: true
}
}
}
"menuCommand" : { "menuCommand" : {
art: MNUPRMT art: MNUPRMT
"mci" : { "mci" : {