diff --git a/core/system_menu_method.js b/core/system_menu_method.js index c94db3be..99e4b69a 100644 --- a/core/system_menu_method.js +++ b/core/system_menu_method.js @@ -128,7 +128,7 @@ function logoff(callingMenu, formData, extraArgs) { // client.term.write( ansi.normal() + '\n' + - require('crypto').randomBytes(Math.floor(Math.random() * 35) + 10).toString(client.term.outputEncoding) + + require('crypto').randomBytes(Math.floor(Math.random() * 65) + 20).toString(client.term.outputEncoding) + 'NO CARRIER'); client.end(); diff --git a/core/view_controller.js b/core/view_controller.js index 79286754..40b1c349 100644 --- a/core/view_controller.js +++ b/core/view_controller.js @@ -521,7 +521,11 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) { ViewController.prototype.loadFromMenuConfig = function(options, cb) { assert(_.isObject(options)); - assert(_.isObject(options.mciMap)); + + if(!_.isObject(options.mciMap)) { + cb(new Error('Missing option: mciMap')); + return; + } var self = this; var formIdKey = options.formId ? options.formId.toString() : '0'; diff --git a/mods/art/msg_list.ans b/mods/art/msg_list.ans new file mode 100644 index 00000000..2446c7ce Binary files /dev/null and b/mods/art/msg_list.ans differ diff --git a/mods/menu.json b/mods/menu.json index c515662d..d48fde6d 100644 --- a/mods/menu.json +++ b/mods/menu.json @@ -266,6 +266,10 @@ "value" : { "command" : "C" }, "action" : "@menu:messageAreaChangeCurrentArea" }, + { + "value" : { "command" : "L" }, + "action" : "@menu:messageAreaMessageList" + }, /*{ "value" : { "command" : "A" }, "action" : "@method:changeArea" @@ -312,6 +316,26 @@ } } }, + "messageAreaMessageList" : { + "module" : "msg_list", + "art" : "msg_list", + "options" : { "cls" : true }, + "fallback" : "messageArea", + "config" : { + + }, + "form" : { + "0" : { + "VM" : { + "mci" : { + "VM1" : { + "height" : 10 + } + } + } + } + } + }, // :TODO: messageAreaSelect (change msg areas -> call @systemMethod -> fallback to menu "messageAreaNewPost" : { "module" : "msg_area_post_fse", diff --git a/mods/msg_area_list.js b/mods/msg_area_list.js index e0565dfb..107cf4a1 100644 --- a/mods/msg_area_list.js +++ b/mods/msg_area_list.js @@ -19,6 +19,20 @@ exports.moduleInfo = { author : 'NuSkooler', }; +/* + :TODO: + + Obv/2 has the following: + CHANGE .ANS - Message base changing ansi + |SN Current base name + |SS Current base sponsor + |NM Number of messages in current base + |UP Number of posts current user made (total) + |LR Last read message by current user + |DT Current date + |TI Current time +*/ + function MessageAreaListModule(options) { MenuModule.call(this, options); diff --git a/mods/msg_list.js b/mods/msg_list.js index 625d2607..1062ec40 100644 --- a/mods/msg_list.js +++ b/mods/msg_list.js @@ -2,6 +2,12 @@ 'use strict'; var MenuModule = require('../core/menu_module.js').MenuModule; +var ViewController = require('../core/view_controller.js').ViewController; + +//var moment = require('moment'); +var async = require('async'); +var assert = require('assert'); +var _ = require('lodash'); exports.getModule = MessageListModule; @@ -14,20 +20,24 @@ exports.moduleInfo = { // // :TODO: // * Avail data: -// To -// From +// To - {to} +// From - {from} // Subject // Date // Status (New/Read) // Message Num (Area) // Message Total (Area) -// Message Area desc -// Message Area Name +// Message Area desc - {areaDesc} / %TL2 +// Message Area Name - {areaName} // // Ideas // * Module config can define custom formats for items & focused items (inc. Pipe Codes) -// * Single list view +// * Single list view with advanced formatting (would need textOverflow stuff) +// * Multiple LV's in sync with keyboard input +// * New Table LV (TV) // * +// +// See Obv/2, Iniq, and Mystic docs function MessageListModule(options) { MenuModule.call(this, options); @@ -37,3 +47,28 @@ function MessageListModule(options) { require('util').inherits(MessageListModule, MenuModule); +MessageListModule.prototype.mciReady = function(mciData, cb) { + var self = this; + + var vc = self.viewControllers.msgList = new ViewController( { client : self.client } ); + + async.series( + [ + function callParentMciReady(callback) { + MessageListModule.super_.prototype.mciReady.call(this, mciData, callback); + }, + function loadFromConfig(callback) { + var loadOpts = { + callingMenu : self, + mciMap : mciData.menu + }; + + vc.loadFromMenuConfig(loadOpts, callback); + } + ], + function complete(err) { + cb(err); + } + ); +}; +