Skip to content

Commit 3e3bfc1

Browse files
committed
Re-adding dmbase.js, what the hell?
2 parents 97f1162 + 1816c56 commit 3e3bfc1

7 files changed

Lines changed: 332 additions & 291 deletions

File tree

ddoc2.js

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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
4646
userSettings = 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-
5452
docIface = {
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");

load/dexpress.js

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* dexpress.js
33
* by: Damon Getsman
44
* started: 12oct14 (lol I'm 37 today; lawd the helpless aging)
5-
* finished;
5+
* beta: well prior to 30may15
6+
* finished:
67
*
78
* Handles text entry and the like for the ddoc suite's express message
89
* functionality
@@ -25,7 +26,7 @@ wholist = {
2526
* summary:
2627
* Cycles through system's nodes, checking to see if they're in use
2728
* and then compiling an array of the usernames
28-
* returns:
29+
* return:
2930
* Array() of User objects
3031
*/
3132
populate : function() {
@@ -133,17 +134,17 @@ wholist = {
133134
/*bbs.log_key("w");
134135
bbs.whos_online(); */
135136
},
136-
/*
137-
* summary:
138-
* Displays a shorter (multicolumn, though spacing isn't perfectly
139-
* figured out on that yet) format listing of who is online
140-
* ul:
141-
* Array() of User objects for those currently online
142-
*/
137+
/*
138+
* summary:
139+
* Displays a shorter (multicolumn, though spacing isn't perfectly
140+
* figured out on that yet) format listing of who is online
141+
* ul:
142+
* Array() of User objects for those currently online
143+
*/
143144
list_short : function(ul) {
144145
//this one we'll have to make multi-column
145146
var uNames = new Array();
146-
var maxArrayLen = 0, totalUsers = 0, cols, ouah2, colBoundary;
147+
var maxArrayLen = 0, totalUsers = 0, ouah2, colBoundary;
147148

148149
bbs.log_key("W");
149150
console.putmsg(green + high_intensity +
@@ -161,7 +162,7 @@ wholist = {
161162
//name, determines where the nearest tab beyond is, and divides the
162163
//available screen columns into that many segments accordingly
163164
colBoundary = ((((maxArrayLen + 2) % 8) + 1) * 8);
164-
cols = Math.round(console.screen_columns / colBoundary);
165+
//cols = Math.round(console.screen_columns / colBoundary);
165166

166167
//generate wholist
167168
for (var ouah = 0; ouah < totalUsers; ouah++) {
@@ -174,26 +175,26 @@ wholist = {
174175
} else {
175176
console.putmsg("\t\t");
176177
}
177-
178-
//pretty sure the above replaces this right now
179-
/* if ((ouah > 0) && ((ouah % cols) == 0)) {
180-
console.putmsg("\n");
181-
} */
182178
}
183179

184180
console.putmsg("\n");
185181
}
186182
},
183+
//sub-object
187184
express = {
188185
/*
189186
* summary:
190187
* Reads in a buffer of up to 5 77 column lines, checking
191188
* each line for end-of-input criteria (ie ABORT, or a
192189
* blank line prematurely), sending it off to be sent via a
193190
* Synchronet telegram by the calling routine
194-
* returns:
191+
* return:
195192
* null if aborted; an array of Strings, with up to 5
196193
* elements. Assume nothing else.
194+
* NOTE:
195+
* Yet another great candidate for switching out that null and
196+
* replacing things with an exception, the way code is supposed to
197+
* work, etc etc etc
197198
*/
198199
readBuf : function() {
199200
var abort = false, nao = new Date, mTxt = new Array, xHdr;
@@ -251,16 +252,24 @@ express = {
251252
* recipient's name, it verifies whether or not the user is logged
252253
* in/valid in general. More functionality will be added as the
253254
* skeleton is first implemented.
254-
* returns:
255+
* return:
255256
* Negative value for user not found, zero for success
257+
* NOTE:
258+
* Let's get some exceptions in here; c'mon with this lazy shite
256259
*/
257260
chkRcp : function(ul) {
258261
//check to make sure the recipient is valid
259262
var recip = null, success = false;
260263

261264
console.putmsg(green + "Message eXpress\nRecipient: ");
262-
//note that a default user from previous expresses will
263-
//have to be added here to keep people from bitching
265+
/*
266+
* note that a default user from previous expresses will
267+
* have to be added here to keep people from bitching; this can be
268+
* implemented most easily [probably] when it is time to start keeping
269+
* a list of the different Xes that have been sent in order to scroll
270+
* back or forwards through them, as well as to quote harassing ones to
271+
* the sysop, who probably won't give a fuck in any case
272+
*/
264273

265274
recip = console.getstr();
266275
for each (u in ul) {
@@ -292,8 +301,9 @@ express = {
292301
* routine, from 'x' at the main menu, as well as from any other
293302
* area where it will be implemented (ie message save menus,
294303
* message read menus, etc)
295-
* returns:
296-
* Negative value for fuggup
304+
* return:
305+
* Negative value for fuggup; let's switch that to an exception, for the
306+
* love of all things holy
297307
*/
298308
sendX : function() {
299309
var recip, mTxt;

0 commit comments

Comments
 (0)