From 6dd4129a8bf75be7f03eaed72b06c031a40086d9 Mon Sep 17 00:00:00 2001 From: echicken <> Date: Mon, 15 Sep 2014 05:50:34 +0000 Subject: [PATCH] File scan/list commands, message group and area selection commands. --- exec/load/menu-command-helpers.js | 71 +++++++- exec/load/menu-commands.js | 261 +++++++++++++++++++----------- 2 files changed, 231 insertions(+), 101 deletions(-) diff --git a/exec/load/menu-command-helpers.js b/exec/load/menu-command-helpers.js index c5b79665dd..89975b6a04 100644 --- a/exec/load/menu-command-helpers.js +++ b/exec/load/menu-command-helpers.js @@ -1,21 +1,76 @@ load("sbbsdefs.js"); // To-do: -// bbs.list_files Filespec? -// bbs.list_file_info FL_EXFIND With filespec // findFiles Prompt for filespec/search string bbs.list_files(filespec or string, FL_FINDDESC|FL_VIEW) -// bbs.scan_dirs All dirs? +// select file group & directory + +// I'm not sure about the handling of bbs.curgrp vs. msg_area.grp_list index here +var selectMessageGroup = function() { + + console.putmsg(bbs.text(133)); + for(var g = 0; g < msg_area.grp_list.length; g++) { + console.putmsg( + format( + ((g == bbs.curgrp) ? " * " : " ") + bbs.text(134), + g + 1, + msg_area.grp_list[g].description + ) + ); + } + console.mnemonics( + format( + bbs.text(503), + bbs.curgrp + 1 + ) + ); + var g = console.getkeys("Q", msg_area.grp_list.length); + if(g != "Q" && g != "") + bbs.curgrp = parseInt(g) - 1; + +} + +// Not sure about the handling of bbs.cursb vs sub_list index here +var selectMessageArea = function() { + + console.putmsg(format(bbs.text(125), msg_area.sub[bbs.cursub_code].grp_name)); + for(var s = 0; s < msg_area.grp_list[bbs.curgrp].sub_list.length; s++) { + var mb = new MsgBase(msg_area.grp_list[bbs.curgrp].sub_list[s].code); + mb.open(); + var tm = mb.total_msgs; + mb.close(); + console.putmsg( + format( + ((s == bbs.cursub) ? " * " : " ") + bbs.text(126), + s + 1, + msg_area.grp_list[bbs.curgrp].sub_list[s].description, + "", + tm + ) + ); + } + console.mnemonics( + format( + bbs.text(503), + bbs.cursub + 1 + ) + ); + var s = console.getkeys("Q", msg_area.grp_list[bbs.curgrp].sub_list.length); + if(s != "Q" && s != "") + bbs.cursub = parseInt(s) - 1; + +} + +var selectGroupAndArea = function() { + selectMessageGroup(); + selectMessageArea(); +} var scanSubs = function() { console.putmsg(bbs.text(116)); console.crlf(); - var cursub = console.noyes("Current sub only"); var youOnly = (console.noyes("To you only")) ? 0 : SCAN_TOYOU; - if(!cursub) - bbs.scan_msgs(bbs.cursub_code, SCAN_NEW|youOnly); - else - bbs.scan_subs(SCAN_NEW|youOnly); + bbs.scan_subs(SCAN_NEW|youOnly); } diff --git a/exec/load/menu-commands.js b/exec/load/menu-commands.js index f06393e0ac..a744918010 100644 --- a/exec/load/menu-commands.js +++ b/exec/load/menu-commands.js @@ -18,246 +18,321 @@ var Commands = { 'Menus' : {} // Placeholder, don't populate }; -/* Model: +/* Pattern: - Commands[area][command] = {}; - Commands[area][command].Description = "This is what this does." + Commands[area][command] = { + 'Description' : "This is what this does." + } if(inBBS()) // Not being loaded from jsexec Commands[area][command].Action = some.method; (If Action doesn't rely on the 'bbs' or 'console' objects, the inBBS() check can be skipped.) - We may want to add other properties (default ARS, etc.) in the future. + We can add other properties (default ARS, text, hotkey, etc.) later. Add custom functions to menu-command-helpers.js. */ // User & user-activity related functions -Commands.User.Config = {}; -Commands.User.Config.Description = "Enter the user settings configuration menu"; +Commands.User.Config = { + 'Description' : "Enter the user settings configuration menu" +}; if(inBBS()) Commands.User.Config.Action = bbs.user_config; -Commands.User.Find = {}; -Commands.User.Find.Description = "Find user by username/number"; +Commands.User.Find = { + 'Description' : "Find user by username/number" +}; if(inBBS()) Commands.User.Find.Action = findUser; -Commands.User.Info = {}; -Commands.User.Info.Description = "Display current user information"; +Commands.User.Info = { + 'Description' : "Display current user information" +}; if(inBBS()) Commands.User.Info.Action = bbs.user_info; -Commands.User.List = {}; -Commands.User.List.Description = "List users"; +Commands.User.List = { + 'Description' : "List users" +} if(inBBS()) Commands.User.List.Action = bbs.list_users; -Commands.User.ListNodes = {}; -Commands.User.ListNodes.Description = "List all node activity"; +Commands.User.ListNodes = { + 'Description' : "List all node activity" +} if(inBBS()) Commands.User.ListNodes.Action = bbs.list_nodes; -Commands.User.ListNodesActive = {}; -Commands.User.ListNodesActive.Description = "List all active nodes"; +Commands.User.ListNodesActive = { + 'Description' : "List all active nodes" +} if(inBBS()) Commands.User.ListNodesActive.Action = bbs.whos_online; -Commands.User.Logons = {}; -Commands.User.Logons.Description = "Display the recent-logon list"; +Commands.User.Logons = { + 'Description' : "Display the recent-logon list" +} if(inBBS()) Commands.User.Logons.Action = bbs.list_logons; -Commands.User.SelectShell = {}; -Commands.User.SelectShell.Description = "Select a command shell"; +Commands.User.SelectShell = { + 'Description' : "Select a command shell" +} if(inBBS()) Commands.User.SelectShell.Action = bbs.select_shell; -Commands.User.SelectEditor = {}; -Commands.User.SelectEditor.Description = "Select an external message editor"; +Commands.User.SelectEditor = { + 'Description' : "Select an external message editor" +} if(inBBS()) Commands.User.SelectEditor.Action = bbs.select_editor; // System areas & functions that don't fit elsewhere -Commands.System.ExternalPrograms = {}; -Commands.System.ExternalPrograms.Description = "External Programs section"; +Commands.System.Chat = { + 'Description' : "Enter the chat section" +} +if(inBBS()) + Commands.System.Chat.Action = function() { bbs.exec("?chat_sec.js"); } + +Commands.System.ExternalPrograms = { + 'Description' : "External Programs section" +} if(inBBS()) Commands.System.ExternalPrograms.Action = bbs.xtrn_sec; -Commands.System.Info = {}; -Commands.System.Info.Description = "Display system information"; +Commands.System.Info = { + 'Description' : "Display system information" +} if(inBBS()) Commands.System.Info.Action = bbs.sys_info; -Commands.System.LogOff = {}; -Commands.System.LogOff.Description = "Log off"; +Commands.System.LogOff = { + 'Description' : "Log off" +} if(inBBS()) Commands.System.LogOff.Action = bbs.logoff; -Commands.System.LogOffFast = {}; -Commands.System.LogOffFast.Description = "Log off, fast"; +Commands.System.LogOffFast = { + 'Description' : "Log off, fast" +} if(inBBS()) Commands.System.LogOffFast.Action = bbs.logout; -Commands.System.NodeChat = {}; -Commands.System.NodeChat.Description = "Enter multi-node chat"; +Commands.System.NodeChat = { + 'Description' : "Enter multi-node chat" +} if(inBBS()) Commands.System.NodeChat.Action = bbs.multinode_chat; -Commands.System.NodeChatPrivate = {}; -Commands.System.NodeChatPrivate.Description = "Enter private inter-node chat"; +Commands.System.NodeChatPrivate = { + 'Description' : "Enter private inter-node chat" +} if(inBBS()) Commands.System.NodeChatPrivate.Action = bbs.private_chat; -Commands.System.NodeMessage = {}; -Commands.System.NodeMessage.Description = "Inter-node private message prompt"; +Commands.System.NodeMessage = { + 'Description' : "Inter-node private message prompt" +} if(inBBS()) Commands.System.NodeMessage.Action = bbs.private_message; -Commands.System.NodeStats = {}; -Commands.System.NodeStats.Description = "Display node statistics"; +Commands.System.NodeStats = { + 'Description' : "Display node statistics" +} if(inBBS()) Commands.System.NodeStats.Action = bbs.node_stats; -Commands.System.PageSysop = {}; -Commands.System.PageSysop.Description = "Page the sysop for chat"; +Commands.System.PageSysop = { + 'Description' : "Page the sysop for chat" +} if(inBBS()) Commands.System.PageSysop.Action = bbs.page_sysop; -Commands.System.PageGuru = {}; -Commands.System.PageGuru.Description = "Page the annoying guru for chat"; +Commands.System.PageGuru = { + 'Description' : "Page the annoying guru for chat" +} if(inBBS()) Commands.System.PageGuru.Action = bbs.page_guru; -Commands.System.Stats = {}; -Commands.System.Stats.Description = "Display system statistics"; +Commands.System.Stats = { + 'Description' : "Display system statistics" +} if(inBBS()) Commands.System.Stats.Action = bbs.sys_stats; -Commands.System.TextSection = {}; -Commands.System.TextSection.Description = "Text files section"; +Commands.System.TextSection = { + 'Description' : "Text files section" +} if(inBBS()) Commands.System.TextSection.Action = bbs.text_sec; -Commands.System.TimeBank = {}; -Commands.System.TimeBank.Description = "Time Bank"; +Commands.System.TimeBank = { + 'Description' : "Time Bank" +} if(inBBS()) Commands.System.TimeBank.Action = bbs.time_bank; -Commands.System.Version = {}; -Commands.System.Version.Description = "Display software version information"; +Commands.System.Version = { + 'Description' : "Display software version information" +} if(inBBS()) Commands.System.Version.Action = bbs.ver; // Message area related functions -Commands.Messages.BulkMail = {}; -Commands.Messages.BulkMail.Description = "Send bulk private mail"; +Commands.Messages.BulkMail = { + 'Description' : "Send bulk private mail" +} if(inBBS()) Commands.Messages.BulkMail.Action = bbs.bulk_mail; -Commands.Messages.Find = {}; -Commands.Messages.Find.Description = "Search message groups/areas/subs"; +Commands.Messages.Find = { + 'Description' : "Search message groups/areas/subs" +} if(inBBS()) Commands.Messages.Find.Action = findMessages; -Commands.Messages.Post = {}; -Commands.Messages.Post.Description = "Post a message in the current area"; +Commands.Messages.Post = { + 'Description' : "Post a message in the current area" +} if(inBBS()) Commands.Messages.Post.Action = bbs.post_msg; -Commands.Messages.MailRead = {}; -Commands.Messages.MailRead.Description = "Read private mail / email"; +Commands.Messages.MailRead = { + 'Description' : "Read private mail / email" +} if(inBBS()) Commands.Messages.MailRead.Action = bbs.read_mail; -Commands.Messages.QWKSection = {}; -Commands.Messages.QWKSection.Description = "Enter the QWK transfer/configuration section"; +Commands.Messages.QWKSection = { + 'Description' : "Enter the QWK transfer/configuration section" +} if(inBBS()) Commands.Messages.QWKSection.Action = bbs.qwk_sec; -Commands.Messages.Read = {}; -Commands.Messages.Read.Description = "Read messages in the current area"; +Commands.Messages.Read = { + 'Description' : "Read messages in the current area" +} if(inBBS()) Commands.Messages.Read.Action = bbs.scan_msgs; -Commands.Messages.Scan = {}; -Commands.Messages.Scan.Description = "Scan for new messages"; +Commands.Messages.Scan = { + 'Description' : "Scan for new messages" +} if(inBBS()) Commands.Messages.Scan.Action = scanSubs; -Commands.Messages.ScanConfig = {}; -Commands.Messages.ScanConfig.Description = "New message scan configuration"; +Commands.Messages.ScanConfig = { + 'Description' : "New message scan configuration" +} if(inBBS()) Commands.Messages.ScanConfig.Action = bbs.cfg_msg_scan; -Commands.Messages.ScanPointers = {}; -Commands.Messages.ScanPointers.Description = "Configure message scan pointer values"; +Commands.Messages.ScanPointers = { + 'Description' : "Configure message scan pointer values" +} if(inBBS()) Commands.Messages.ScanPointers.Action = bbs.cfg_msg_ptrs; -Commands.Messages.ScanPointersReinit = {}; -Commands.Messages.ScanPointersReinit.Description = "Re-initialize new message scan pointer values"; +Commands.Messages.ScanPointersReinit = { + 'Description' : "Re-initialize new message scan pointer values" +} if(inBBS()) Commands.Messages.ScanPointersReinit.Action = bbs.reinit_msg_ptrs; -Commands.Messages.SendMail = {}; -Commands.Messages.SendMail.Description = "Send local private mail"; +Commands.Messages.SelectGroup = { + 'Description' : "Select a message group" +} +if(inBBS()) + Commands.Messages.SelectGroup.Action = selectMessageGroup; + +Commands.Messages.SelectArea = { + 'Description' : "Select a message area" +} +if(inBBS()) + Commands.Messages.SelectArea.Action = selectMessageArea; + +Commands.Messages.SelectGroupAndArea = { + 'Description' : "Select a message group and area" +} +if(inBBS()) + Commands.Messages.SelectGroupAndArea.Action = selectGroupAndArea; + +Commands.Messages.SendMail = { + 'Description' : "Send local private mail" +} if(inBBS()) Commands.Messages.SendMail.Action = sendMail; -Commands.Messages.SendNetMail = {}; -Commands.Messages.SendNetMail.Description = "Send netmail/email"; +Commands.Messages.SendNetMail = { + 'Description' : "Send netmail/email" +} if(inBBS()) Commands.Messages.SendNetMail.Action = sendNetMail; -Commands.Messages.SubInfo = {}; -Commands.Messages.SubInfo.Description = "Display message sub-board information"; +Commands.Messages.SubInfo = { + 'Description' : "Display message sub-board information" +} if(inBBS()) Commands.Messages.SubInfo.Action = bbs.sub_info; // File area related functions -Commands.Files.BatchMenu = {}; -Commands.Files.BatchMenu.Description = "Enter the batch file transfer menu"; +Commands.Files.BatchMenu = { + 'Description' : "Enter the batch file transfer menu" +} if(inBBS()) Commands.Files.BatchMenu.Action = bbs.batch_menu; -Commands.Files.BatchDownload = {}; -Commands.Files.BatchDownload.Description = "Start a batch download"; +Commands.Files.BatchDownload = { + 'Description' : "Start a batch download" +} if(inBBS()) Commands.Files.BatchDownload.Action = bbs.batch_download; -Commands.Files.DirInfo = {}; -Commands.Files.DirInfo.Description = "Display file directory information"; +Commands.Files.DirInfo = { + 'Description' : "Display file directory information" +} if(inBBS()) Commands.Files.DirInfo.Action = bbs.dir_info; -Commands.Files.List = {}; -Commands.Files.List.Description = "List all files in the current directory"; +Commands.Files.List = { + 'Description' : "List all files in the current directory" +} if(inBBS()) Commands.Files.List.Action = bbs.list_files; -Commands.Files.ListExtended = {}; -Commands.Files.ListExtended.Description = "List all files in current directory (extended info.)"; +Commands.Files.ListExtended = { + 'Description' : "List all files in current directory (extended info)" +} if(inBBS()) Commands.Files.ListExtended.Action = bbs.list_file_info; -Commands.Files.TempXfer = {}; -Commands.Files.TempXfer.Description = "Enter the temporary file transfer menu"; +Commands.Files.Scan = { + 'Description' : "Scan directories for files" +} +if(inBBS()) + Commands.Files.Scan.Action = bbs.scan_dirs; + +Commands.Files.TempXfer = { + 'Description' : "Enter the temporary file transfer menu" +} if(inBBS()) Commands.Files.TempXfer.Action = bbs.temp_xfer; -Commands.Files.Upload = {}; -Commands.Files.Upload.Description = "Upload a file to the current directory"; +Commands.Files.Upload = { + 'Description' : "Upload a file to the current directory" +} if(inBBS()) Commands.Files.Upload.Action = bbs.upload_file; -Commands.Files.XferPolicy = {}; -Commands.Files.XferPolicy.Description = "Display the file transfer policy"; +Commands.Files.XferPolicy = { + 'Description' : "Display the file transfer policy" +} if(inBBS()) Commands.Files.XferPolicy.Action = bbs.xfer_policy; @@ -270,4 +345,4 @@ var getMenus = function() { f.close(); } -getMenus(); +getMenus(); \ No newline at end of file -- GitLab