66 * contributing/refactoring also by: @Ntwitch (github.com)
77 * started: 18aug14
88 * alpha phase: 25oct14
9- * beta phase: 10mar14
9+ * beta phase:
1010 * finished:
1111 *
1212 * a slightly more organized attempt to emulate the DOC shell from
@@ -46,14 +46,15 @@ var stillAlive = true; //ask for advice on the 'right' way to do this
4646userSettings = null ; roomSettings = { } ; zappedRooms = null ;
4747
4848/*
49- * obviously, with all of the other places that we've got debugging
50- * referenced, we need to go around and make them dependent upon this,
51- * even before we start introducing granularity into the whole mixture
49+ * summary:
50+ * Top level object for globals and primary program control flow/menu
5251 */
53-
5452docIface = {
5553 //top level menu
56- //menu properties
54+ /*
55+ * summary:
56+ * Top-level menu contained within a string
57+ */
5758 menu : green + high_intensity +
5859 //$ctrl_a + "g" + "\n" + "<A>\tSysop commands\n" +
5960 "\n\n<B>\tChange eXpress beeps\n<b>\tRead forum backward\n" +
@@ -75,6 +76,10 @@ docIface = {
7576 "number\n<->\tread last n messages\n<%>\ttoggle guideflag " +
7677 "status\n<@>\taidelist\n<\">\tquote Xes to Sysop\n" +
7778 "<$>\tchange debugging settings\n\n" ,
79+ /*
80+ * summary:
81+ * Save text prompt
82+ */
7883 sprompt : high_intensity + yellow + "<A>" + green + "bort " +
7984 yellow + "<C>" + green + "ontinue " + yellow + "<P>" +
8085 green + "rint " + yellow + "<S>" + green + "ave " + yellow +
@@ -91,8 +96,6 @@ docIface = {
9196 * the exception message
9297 * setnum:
9398 * exception number
94- * toString():
95- * Used for returning a concise message on the exception
9699 */
97100 dDocException : function ( setname , setmsg , setnum ) {
98101 this . name = setname ;
@@ -118,25 +121,15 @@ docIface = {
118121 }
119122 bbs . node_action = nodeAction ;
120123 system . node_list [ bbs . node_num - 1 ] . action = bbs . node_action ;
121-
122- /* for (var ouah = 0; ouah < maxnodes; ouah++) {
123- if (userSettings.debug.misc) {
124- console.putmsg(red + high_intensity + ouah + " ");
125- }
126- if (system.node_list[ouah].useron == user.number) {
127- if (userSettings.debug.misc) {
128- console.putmsg(yellow + "Hit! Trying to set status\n");
129- }
130- system.node_list[ouah].action = nodeAction;
131- break;
132- }
133- } */
134124 } ,
135125 /*
136126 * summary:
137- * Just a wrapper for console.getkey() at this point. I honestly can't
138- * remember why I did this now; leaving it in case I remember
139- * returns:
127+ * Just a wrapper for console.getkey() at this point. This is utilized for
128+ * any prompting situation where we want to be able to make sure that we're
129+ * going to receive any X messages (or telegrams/messages or other inter-
130+ * node communication) while the prompt is waiting for something from the
131+ * user
132+ * return:
140133 * Unmodified return value from console.getkey()
141134 */
142135 getChoice : function ( ) {
@@ -157,7 +150,10 @@ docIface = {
157150 * String value
158151 * key:
159152 * Character value
160- * returns: nonzero on error
153+ *
154+ * NOTE: This might be broken in some areas; as I was doing the documentation
155+ * pass I decided to change this one to throw an exception on error and
156+ * ditch the return codes since it was so rudimentary
161157 */
162158 log_str_n_char : function ( str , key ) {
163159 try {
@@ -166,14 +162,17 @@ docIface = {
166162 } catch ( e ) {
167163 system . log ( "TTBBS Error " + e . description +
168164 " when trying to save str+key to log" ) ;
169- return - 1 ;
165+ throw new dDocException ( "log_str_n_char() Error" , e . message , 1 ) ;
170166 }
171167
172- return 0 ;
168+ // return 0;
173169 } ,
174170 /*
175171 * summary:
176172 * Simply displays the docIface top level property 'menu'
173+ * NOTE:
174+ * See the commented out area where things need to be fixed in order to
175+ * implement pausing (I think that's what it was working with, anyway)
177176 */
178177 doMainMenu : function ( ) {
179178 bbs . log_key ( "?" ) ;
@@ -199,7 +198,6 @@ docIface = {
199198
200199 //console.putmsg(this.menu);
201200 } ,
202-
203201 //sub-objects
204202 nav : {
205203 /*
@@ -209,7 +207,7 @@ docIface = {
209207 * room:
210208 * The msg_area.grp_list[].sub_list[] element of the room to jump
211209 * to
212- * returns :
210+ * return :
213211 * String of the human-readable sub name.
214212 */
215213 setSub : function ( room ) {
@@ -231,7 +229,7 @@ docIface = {
231229 * Scans through known rooms (not zapped) starting from
232230 * the current room and looks for new messages. If new messages
233231 * are found, call setSub to point the user at the room.
234- * returns :
232+ * return :
235233 * sub-board object if new messages were found
236234 * null if no new messages were found
237235 */
@@ -377,6 +375,9 @@ docIface = {
377375 * summary:
378376 * Mark all messages as read in the current room and
379377 * call findNew() to change to the next room with unread messages
378+ * NOTE:
379+ * skip() should _NOT_ mark all messages in the current room as
380+ * read; it should just skip to the next room in the list
380381 */
381382 skip : function ( ) {
382383 // mark all messages as read in current room
@@ -395,10 +396,9 @@ docIface = {
395396 * sub-boards
396397 * srchStr:
397398 * Substring to search for
398- * returns:
399- * The object for the sub-board if a match, null if rList
400- * doesn't come back decently, -1 if no match is found
401- * within a valid list
399+ * return:
400+ * The object for the sub-board if a match, exceptions are thrown
401+ * on appropriate error conditions
402402 */
403403 chk4Room : function ( srchStr ) {
404404 var rList = docIface . util . getRoomList ( true ) ;
@@ -422,6 +422,7 @@ docIface = {
422422 throw new dDocException ( "chk4Room() exception" , "No match" , 2 ) ;
423423 }
424424 } ,
425+ //sub-object
425426 util : {
426427 // --++==**properties**==++--
427428 preSubBoard : null ,
@@ -435,10 +436,13 @@ docIface = {
435436 * not being confined is expanded. Also, this may be
436437 * useful in the future for listKnown() and other routines
437438 * in dmbase.js that are recreating the wheel a bit
438- * returns :
439+ * return :
439440 * As I redundantly and out-of-proper-orderly mentioned
440441 * above, it returns an array of sub-board objects
441- * If running non-confined, returns null
442+ * If running non-confined, returns null. When this feature is
443+ * finally ready to be implemented, it might be necessary to return
444+ * some sort of JSON or list of arrays in order to handle the
445+ * deeper data structure than we're currently utilizing
442446 */
443447 getRoomList : function ( /*in the future, group here too*/ ) {
444448 //var debugging = true;
@@ -452,7 +456,7 @@ docIface = {
452456 }
453457 return msg_area . grp_list [ topebaseno ] . sub_list ;
454458 } else {
455- return null ;
459+ return null ; //ereh
456460 }
457461 } ,
458462 /*
@@ -474,21 +478,9 @@ docIface = {
474478 console . putmsg ( red + e . toString ( ) + "\n" ) ;
475479 }
476480
477- //load room settings
481+ //load room settings -- WHAT THE FUCK IS GOING ON WITH THE NESTED TRY/
482+ //CATCH BULLSHIT HERE? Vestigial horror no doubt; fix this
478483 try {
479- /*if (userSettings.debug.file_io) {
480- console.putmsg(cyan + "Looking for room info file: " +
481- roomData.fileIO.roomRecFilename + "\n"); //why no workee? 8o|
482- } //this should be "/sbbs/data/user/docrooms", but more than that
483- //it should be working correctly from w/in proper references WTF
484-
485- for each(var area in msg_area.grp_list[topebaseno].code) {
486- roomSettings[area] = roomData.fileIO.snagRoomInfoBlob(
487- "/sbbs/data/user/docrooms",
488- //roomData.fileIO.roomRecFilename,
489- area);
490- }*/
491-
492484 try {
493485 roomData . fileIO . snagRoomInfoBlob ( ) ;
494486 } catch ( e ) {
@@ -583,7 +575,11 @@ docIface = {
583575 * ddoc, in order to restore functionality to where it was
584576 * left off for somebody that may be jumping between
585577 * shells, or the like. As mentioned above; this may be
586- * out of scope and needing a better solution.
578+ * out of scope and needing a better solution. For some reason
579+ * this also refuses to work properly when not called from the
580+ * lowest-level primary menu; not sure what's up with that, Digital
581+ * Man just referred me to logout.c or something and I couldn't
582+ * make heads or tails of it just yet
587583 */
588584 quitDdoc : function ( ) {
589585 bbs . log_str ( user . alias + " is leaving dDOC shell" ) ;
@@ -614,14 +610,17 @@ docIface = {
614610 "again soon!\n\nPeace out!\n" ) ;
615611
616612 bbs . logout ( ) ;
617- return ;
618613 } ,
619614 /*
620615 * summary:
621616 * Searches the correct file in /sbbs/user for the proper
622617 * block of information regarding the current sub/room and
623618 * displays that information with proper DOC-ish heading
624619 * information.
620+ * NOTE:
621+ * I believe this is completely vestigial at this point; need to
622+ * run through and verify before removing it. This should all be
623+ * handled from within dperroom's code right now, though.
625624 */
626625 dispRoomInfo : function ( ) {
627626 bbs . log_key ( "I" ) ;
0 commit comments