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

View File

@ -19,14 +19,16 @@ exports.getModule = NewScanModule;
/*
* :TODO:
* * Update message ID when reading (this should be working!)
* * New scan all areas
* * User configurable new scan: Area selection (avail from messages area)
* * User configurable new scan: Area selection (avail from messages area) (sep module)
* * Add status TL/VM (either/both should update if present)
* *
*/
var MciCodeIds = {
ScanStatusLabel : 1, // TL1
ScanStatusList : 2, // VM2 (appends)
};
function NewScanModule(options) {
MenuModule.call(this, options);
@ -35,9 +37,27 @@ function NewScanModule(options) {
var config = this.menuConfig.config;
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) {
var availMsgAreas = msgArea.getAvailableMessageAreas( { includePrivate : true } );
var currentArea = availMsgAreas[self.currentScanAux];
@ -54,16 +74,31 @@ function NewScanModule(options) {
self.currentScanAux += 1;
callback(null);
} else {
self.updateScanStatus(self.scanCompleteMsg);
callback(new Error('No more areas'));
}
},
function updateStatus(callback) {
// :TODO: Update status text
function updateStatusScanStarted(callback) {
self.updateScanStatus(self.scanStartFmt.format({
desc : currentArea.desc,
}));
callback(null);
},
function newScanAreaAndGetMessages(callback) {
msgArea.getNewMessagesInAreaForUser(
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);
}
);

View File

@ -369,9 +369,6 @@
art: LETTER
options: { pause: true }
next: newUserFeedbackToSysOp
extraArgs: {
messageAreaName: private_mail
}
}
newUserFeedbackToSysOp: {
@ -395,7 +392,9 @@
help: MSGEHLP
},
editorMode: edit
editorType: area
editorType: email
messageAreaName: private_mail
toUserId: 1 /* always to +op */
}
form: {
0: {
@ -505,6 +504,7 @@
options: { pause: true }
next: fullLoginSequenceLastCallers
}
fullLoginSequenceLastCallers: {
desc: Last Callers
module: last_callers
@ -517,8 +517,34 @@
module: whos_online
art: WHOSON
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: {
desc: System Stats
art: SYSSTAT
@ -532,6 +558,40 @@
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
///////////////////////////////////////////////////////////////////////
@ -743,6 +803,10 @@
value: { command: "4" }
action: @menu:doorTradeWars2002BBSLink
}
{
value: { command: "DL" }
action: @menu:doorDarkLands
}
]
}
@ -763,6 +827,24 @@
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: {
desc: Playing L.O.R.D.
@ -860,7 +942,6 @@
module: msg_list
art: MSGLIST
config: {
listType: public
menuViewPost: messageAreaViewPost
}
form: {

View File

@ -45,7 +45,7 @@ function AreaPostFSEModule(options) {
if(err) {
// :TODO:... sooooo now what?
} else {
console.log(msg);
console.log(msg); // :TODO: remove me -- probably log that one was saved, however.
}
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" : {
art: MNUPRMT
"mci" : {