@@ -81,11 +81,17 @@ poast = {
8181 /*
8282 * summary:
8383 * Modularizes the text snagging routine (w/optional maximum
84- * number of lines)
84+ * number of lines); note that the 'X' option still needs to be
85+ * implemented here to enable Xpress messages to be sent (not sure
86+ * if they're set up for asynchronous receive or not at this point;
87+ * I guess I'd assume that they aren't)
8588 * maxLines:
8689 * Maximum number of lines (or null)
87- * returns:
88- * Text array
90+ * return:
91+ * Text array or null (not sure what the null may be signifying;
92+ * probably need to check calling code to see what this is all
93+ * about (strike that it looks like it's for abort, and thus should
94+ * be throwing an exception)
8995 */
9096 getTextBlob : function ( maxLines ) {
9197 var mTxt = new Array ( ) ;
@@ -168,12 +174,10 @@ poast = {
168174 * recipient, though this should not be necessary once
169175 * functionality is broken up properly instead of so much
170176 * cuntpaste right now
171- * returns:
172- * Array of message text lines
173177 */
174- getMsgBody : function ( upload , base , recip ) {
178+ getMsgBody : function ( /* upload,*/ base , recip ) {
175179 var mTxt = new Array ( ) ;
176- var lNdx , uchoice , done = false ;
180+ // var lNdx, uchoice, done = false;
177181
178182 if ( userSettings . debug . message_posting ) {
179183 console . putmsg ( "Attempting post to: " + base . cfg . code + "\n" ) ;
@@ -216,9 +220,6 @@ poast = {
216220 * NOTE: This method is way too big and needs to be chopped the
217221 * fuck up in order to make this more readable and more reusable
218222 */
219- //var mTxt = new Array();
220- //var lNdx = 0, done = false;
221- //var uchoice;
222223
223224 //turn off instant messages coming in while posting
224225 bbs . sys_status |= SS_MOFF ;
@@ -236,74 +237,24 @@ poast = {
236237 //ddoc interface completely to see how it goes
237238 this . getMsgBody ( upload , base , recip ) ;
238239
239- /*do {
240- mTxt[lNdx] = console.getstr("", 79, K_WRAP);
241- if (((mTxt[lNdx++] == "\03") && (upload)) ||
242- ((mTxt[lNdx - 1] == "") || (mTxt[lNdx - 1] == "\r"))) {
243- //end of message
244- uchoice = this.dispSaveMsgPrompt();
245-
246- switch (uchoice) {
247- /* note, abort is not checked for when this function
248- * exits, and I'm pretty sure there are other little
249- * bugs hiding out in here, as well */
250- /*case 'A': //abort
251- done = true;
252- break;
253- case 'C': //continue
254- lNdx--;
255- break;
256- case 'P':
257- this.dispNewMsgHdr();
258- for each (var derp in mTxt) {
259- console.putmsg(green + high_intensity + derp);
260- }
261- //fall through to continue w/entry here, too
262- break;
263- case 'S':
264- //screw those old error codes
265- try {
266- this.mWrite(mTxt, base, recip);
267- console.putmsg(green + high_intensity
268- + "Message saved\n");
269- } catch (e) {
270- bbs.log_str("Err writing to " + base.name);
271- console.putmsg(red + "There was a problem " +
272- "writing to " + base.name +
273- "\nSorry; error is logged.\n");
274- }
275- done = true;
276- break;
277- /* case 'X':
278- * just skipping this right now since I'm impatient
279- * about losing all of the recoding this morning and
280- * feeling much more that time is of the essence :| */
281- /*default:
282- console.putmsg(red + "I have no idea what just " +
283- "happened; event logged.\n");
284- bbs.log_str("Unknown error in addMsg()");
285- break;
286- }
287- }
288- } while (!done); */
289-
290240 //turn instant messages back on
291241 bbs . sys_status |= SS_MOFF ;
292- } ,
293- /*
294- * summary:
295- * method exists for returning exception from mWrite()
296- */
242+ } ,
297243 /*
298244 * summary:
299245 * Writes appropriate message header & body data to the
300- * database
246+ * database; note that this is a monolith that needs to be severely
247+ * dismembered and strung back together in a medival fashion like
248+ * something out of H.P. Lovecraft
301249 * txtArray: Array of String
302250 * An array of textual strings making up the body of the
303251 * message to be added to the base
304252 * mBase: MsgBase Object
305253 * Current MsgBase to be written to
306254 * return:
255+ * Utterly horrifying; throw some fucking exceptions-- actually
256+ * upon further examination it looks like most of this has been
257+ * implemented, though it's still throwing 0 for success
307258 * 0 for success
308259 * -1 if unable to open the MsgBase
309260 * -2 if unable to complete MsgBase.save_msg()
@@ -315,13 +266,13 @@ poast = {
315266 txtArray . length + "\n" ) ;
316267 }
317268
318- //create the message for writing
319- var mHdr = {
269+ //create the message for writing
270+ var mHdr = {
320271 'from' : user . alias ,
321272 //'to' : "All",
322273 'subject' : "dDOC Posting" //cheat for now
323- }
324- if ( ( recipient != null ) &&
274+ }
275+ if ( ( recipient != null ) &&
325276 ( recipient . toString ( ) . toUpperCase ( ) != "ALL" ) ) {
326277 if ( recipient !== 1 ) {
327278 var tmpUser = new User ( recipient ) ;
@@ -330,11 +281,11 @@ poast = {
330281 var sysop = new User ( recipient ) ;
331282 mHdr [ 'to' ] = sysop . alias ;
332283 }
333- } else {
284+ } else {
334285 mHdr [ 'to' ] = "All" ;
335- }
286+ }
336287
337- if ( userSettings . debug . message_posting ) {
288+ if ( userSettings . debug . message_posting ) {
338289 //debug dump requested by echicken (?) in order to help find
339290 //out what is causing mail sent to the 'mail' sub board is
340291 //ending up in 'all mail' but never a personal account, and
@@ -344,16 +295,16 @@ poast = {
344295 "to\t:\t" + mHdr [ 'to' ] + " selected by code as " +
345296 "sysop.alias or recipient name passed (null=ALL)\n" +
346297 "subject\t:\t" + mHdr [ 'subject' ] + " static\n\n" ) ;
347- }
298+ }
348299
349- /*
350- * This is really kind of nasty, but I'm not functioning well
351- * enough right now to get down to the bottom of how it's
352- * being handled differently for the mail sub as opposed to
353- * the standards. :P Whatever, it'll go into a later
354- * refactor.
355- */
356- if ( mBase . subnum == - 1 ) {
300+ /*
301+ * This is really kind of nasty, but I'm not functioning well
302+ * enough right now to get down to the bottom of how it's
303+ * being handled differently for the mail sub as opposed to
304+ * the standards. :P Whatever, it'll go into a later
305+ * refactor.
306+ */
307+ if ( mBase . subnum == - 1 ) {
357308 var dMB = new MsgBase ( 'mail' ) ;
358309 mHdr [ "to_ext" ] = recipient ;
359310 mHdr [ "from_ext" ] = user . number ;
@@ -363,71 +314,68 @@ poast = {
363314 } else {
364315 mHdr [ "subject" ] = "dDoc Mail>" ;
365316 }
366- } else {
317+ } else {
367318 var dMB = new MsgBase ( mBase . cfg . code ) ;
368- }
369- //var debugging = false; //locally, of course
370-
371- /*
372- * Here, because of being sent to sub['mail'] does not seem to
373- * be working, we're going to try implementing the bbs.email()
374- * function which, I believes, has the option granularity to
375- * be able to make certain that email is manually set or not
376- * as far as going to the network. To this point, logs seem
377- * to indicate that previous messages sent to the 'mail' sub
378- * have ended up looking for a way out on the network, and not
379- * at local users.
380- */
381-
382- //need to move this out into separate code
383- try {
319+ }
320+
321+ /*
322+ * Here, because of being sent to sub['mail'] does not seem to
323+ * be working, we're going to try implementing the bbs.email()
324+ * function which, I believes, has the option granularity to
325+ * be able to make certain that email is manually set or not
326+ * as far as going to the network. To this point, logs seem
327+ * to indicate that previous messages sent to the 'mail' sub
328+ * have ended up looking for a way out on the network, and not
329+ * at local users.
330+ */
331+
332+ //need to move this out into separate code
333+ try {
384334 dMB . open ( ) ;
385- } catch ( e ) {
335+ } catch ( e ) {
386336 console . putmsg ( red + "Error opening: " + high_intensity +
387337 mBase . subnum + normal + "\n" ) ;
388338 log ( "dDOC err opening: " + mBase . subnum + "; " + e . message ) ;
389339 throw new docIface . dDocException ( "mWriteException" ,
390340 e . message , e . number ) ;
391- }
341+ }
392342
393- if ( userSettings . debug . message_posting ) {
343+ if ( userSettings . debug . message_posting ) {
394344 console . putmsg ( red + "Received mBase.subnum:\t" + dMB . subnum +
395345 "\t(in call to mWrite())\n" ) ;
396- //console.putmsg(red + "Group:\t" + dMB.grp_name +
397- // "\nSub-board:\t" + dMB.name + "\n");
398346 console . putmsg ( red + "\nNext debugging output is text " +
399347 "concatenation for message body.\n\n" ) ;
400- }
348+ }
401349
402- var catMTxt = new String ( ) ;
403- for each ( var ouah in txtArray ) {
350+ var catMTxt = new String ( ) ;
351+ for each ( var ouah in txtArray ) {
404352 if ( userSettings . debug . message_posting ) {
405353 console . putmsg ( red + "ouah: " + ouah + "\n" + normal ) ;
406354 }
407355 catMTxt += ( ouah + "\n" ) ;
408- }
356+ }
409357
410- try {
358+ try {
411359 dMB . save_msg ( mHdr , catMTxt ) ;
412- } catch ( e ) {
360+ } catch ( e ) {
413361 console . putmsg ( red + "Error saving to: " + high_intensity +
414362 mBase . subnum + normal + "\n" ) ;
415363 log ( "dDOC err saving msg to: " + mBase . subnum + "; "
416364 + e . message ) ;
417365 throw new docIface . dDocException ( "mWriteException" , e . message ,
418366 e . number ) ;
419- }
367+ }
420368
421- try {
369+ try {
422370 dMB . close ( ) ;
423- } catch ( e ) {
371+ } catch ( e ) {
424372 console . putmsg ( red + "Error closing: " + high_intensity +
425373 mBase . subnum + normal + "\n" ) ;
426374 log ( "dDOC err closing: " + mBase . subnum + "; " + e . message ) ;
427375 throw new docIface . dDocException ( "mWriteException" , e . message ,
428376 e . number ) ;
429- }
430- return 0 ;
377+ }
378+ return 0 ; //get rid of this once calling code is modified
431379 } ,
432380 /*
433381 * summary:
@@ -436,12 +384,19 @@ poast = {
436384 * important/urgent, if possible. Strict emulation as
437385 * possible. Takes no arguments, gives no return status,
438386 * though this might be good for error checking later on.
387+ *
388+ * NOTE: Okay so it wasn't SUPPOSED to be giving an return statuses;
389+ * I've found that this isn't quite accurate, there's a -1 that is
390+ * returned for an error code so, despite just doing a
391+ * documentation pass, I'm going to go ahead and change that to a
392+ * throw exception
439393 */
440394 yell : function ( ) {
441395 console . putmsg ( green + high_intensity + "\nPress 'y' to send" +
442396 " a yell to the Sysop(s).\n\nEnter your choice -> " ) ;
443397 if ( console . getkey ( ) . toUpperCase ( ) != 'Y' ) {
444- return - 1 ;
398+ throw new dDocException ( "yell() Exception" ,
399+ "User didn't want to yell" , 1 ) ;
445400 }
446401
447402 var mb = new MsgBase ( 'mail' ) ;
@@ -462,6 +417,5 @@ poast = {
462417 "anything foreboding above, your message will be read by " +
463418 "system user #1 upon next login.\n" ) ;
464419 }
465-
466420}
467421
0 commit comments