From a981aab4b718ec9fba2e577bba1290ccc2b03bc6 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Sun, 21 Jun 2015 21:17:00 -0700 Subject: [PATCH 01/14] Fixed poor aliasing in ddoc2.js for space leading to new message scan --- ddoc2.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ddoc2.js b/ddoc2.js index 049b062..690c74d 100644 --- a/ddoc2.js +++ b/ddoc2.js @@ -690,10 +690,6 @@ if (!debugOnly) { console.putmsg("\n" + dprompt); uchoice = docIface.getChoice(); - //poor aliasing - if (uchoice == ' ') { - uchoice = 'n'; - } switch (uchoice) { //top menu @@ -701,6 +697,8 @@ if (!debugOnly) { docIface.doMainMenu(); break; //message base entry commands + case ' ': + uchoice = 'n'; case 'b': case 'e': case 'E': From 734be4746b2df0b8f8b0c2fb6b0fbe088011eae1 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Wed, 24 Jun 2015 10:40:53 -0700 Subject: [PATCH 02/14] Fixed some syntax in commit that also closes #173 and closes #172 --- load/dmbase.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index bfab3b1..5e88cb5 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -591,10 +591,16 @@ msg_base = { console.putmsg("mBase.last_msg = " + mBase.last_msg + "\n"); } - if (forward) {inc = 1;} else {inc = -1;} + if (forward) { + inc = 1; + } else { + inc = -1; + } // if starting in reverse from the room prompt, unskip one message - if (!forward) tmpPtr += 1; // so we start with the most recently read + if (!forward) { + tmpPtr += 1; // so we start with the most recently read + } // message. In all other cases we want to skip one. if (userSettings.debug.message_scan) { From 14cb16464863dd007d66f7402ee15ecf83223617 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Fri, 26 Jun 2015 09:06:49 -0700 Subject: [PATCH 03/14] Started coding new message scan functionality to use remap_message_indices() --- load/dmbase.js | 80 +++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index 97608fb..5334ec0 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -288,6 +288,29 @@ msg_base = { } return hollaBack; + }, + /* + * summary: + * Read any new messages in the current room, then call findNew to + * move to the next room with unread messages + */ + readNew : function() { + var mBase = this.openNewMBase(bbs.cursub_code); + + /*if (userSettings.debug.navigation) { + console.putmsg(yellow + msg_area.sub[bbs.cursub_code].index + ": " + + roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index) + + "\n"); + }*/ + + //if (!roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index)) { + if (msg_area.sub[bbs.cursub_code].scan_ptr < mBase.total_msgs) { + this.scanSub(msg_area.sub[bbs.cursub_code], true); + } + //} + docIface.nav.findNew(); + mBase.close(); + return; } }, /* @@ -448,7 +471,6 @@ msg_base = { case 'n': //read new console.putmsg(green + high_intensity + "Read new\n"); try { - msg_base.readNew(); } catch (e) { console.putmsg(yellow + "Exception reading new: " + @@ -746,6 +768,9 @@ msg_base = { * to be using exception handling instead of passing error codes * sBoard: String * Synchronet Sub-board object + * indices: Array + * Freshly remapped array indices conveniently skipping any deleted + * messages or other crap that we don't need to worry about * forward: Boolean * true for forward read & converse * return: @@ -756,13 +781,13 @@ msg_base = { * make sure that we're not using return for error codes; a proper * exception throwing model really needs to be adhered to */ - scanSub : function(sBoard, forward) { + scanSub : function(sBoard, indices, forward) { var tmpPtr, inc, choice = 0; if (userSettings.debug.message_scan) { console.putmsg("Entered scanSub(); forward = " + forward + " user.cursub: " + user.cursub + "\nsBoard.code: " + - sBoard.code + "\n"); + sBoard.code + "\tindices size: " + indices.length + "\n"); } mBase = this.openNewMBase(sBoard.code); @@ -775,12 +800,16 @@ msg_base = { "Error in openNewMBase()", 1); } - tmpPtr = sBoard.scan_ptr; - //tmpPtr = sBoard.ptridx; - //tmpPtr = mBase.cfg.ptridx; + //tmpPtr = sBoard.scan_ptr; //old way to handle this + if ((tmpPtr = indices.indexOf(sBoard.scan_ptr)) == -1) { + tmpPtr = 0; //start from the beginning of these indices + } + if (userSettings.debug.message_scan) { console.putmsg("sBoard.scan_ptr = " + sBoard.scan_ptr + "\n"); console.putmsg("sBoard.ptridx = " + sBoard.ptridx + "\n"); + console.putmsg("tmpPtr = " + tmpPtr + "\n"); + console.putmsg("indices[tmpPtr] = " + indices[tmpPtr] + "\n"); console.putmsg("mBase.cfg.ptridx = " + mBase.cfg.ptridx + "\n"); console.putmsg("mBase.first_msg = " + mBase.first_msg + "\n"); console.putmsg("mBase.total_msgs = " + mBase.total_msgs + "\n"); @@ -833,20 +862,23 @@ msg_base = { if ((tmpPtr <= 0) && (inc == -1)) { mBase.close(); return 0; // do we reverse scan from room to room also? - } else if ((tmpPtr >= mBase.total_msgs) && (inc == 1)) { + } else if ((tmpPtr >= indices.length) && (inc == 1)) { mBase.close(); return 1; // skip to next room } tmpPtr += inc; - if ((tmpPtr >= 0) && (tmpPtr <= mBase.total_msgs)) { - while (this.dispMsg(mBase, tmpPtr, true) == null) { + if ((tmpPtr >= 0) && (tmpPtr <= indices.length)) { + while (this.dispMsg(mBase, indices[tmpPtr], true) + == null) { tmpPtr += inc; - if ((tmpPtr == 0) || (tmpPtr > mBase.total_msgs)) { + if ((tmpPtr == 0) || (tmpPtr > indices.length)) { break; } } //this.dispMsg(mBase, tmpPtr, true); - if (inc == 1) sBoard.scan_ptr = tmpPtr; + if (inc == 1) { + sBoard.scan_ptr = indices[tmpPtr]; + } } break; default: @@ -859,36 +891,12 @@ msg_base = { console.putmsg(red + "End of scanSub() main loop\n" + "tmpPtr: " + tmpPtr + "\tinc: " + inc + "\n"); } - choice = this.read_cmd.rcChoice(mBase, tmpPtr); + choice = this.read_cmd.rcChoice(mBase, indices[tmpPtr]); } mBase.close(); if (userSettings.debug.message_scan) { console.putmsg(red + "Closed mBase: " + sBoard.code + "\n"); } - }, - /* - * summary: - * Read any new messages in the current room, then call findNew to - * move to the next room with unread messages - */ - readNew : function() { - var mBase = this.openNewMBase(bbs.cursub_code); - - /*if (userSettings.debug.navigation) { - console.putmsg(yellow + msg_area.sub[bbs.cursub_code].index + ": " + - roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index) + - "\n"); - }*/ - - //if (!roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index)) { - if (msg_area.sub[bbs.cursub_code].scan_ptr < mBase.total_msgs) { - this.scanSub(msg_area.sub[bbs.cursub_code], true); - } - //} - docIface.nav.findNew(); - mBase.close(); - return; } - } From 84f4184a7382fa9545c7183951a3a5f3e82393b8 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Fri, 26 Jun 2015 21:16:35 -0700 Subject: [PATCH 04/14] Working on hasUnread() in dmbase.js for issue #172 and other related issues --- load/dmbase.js | 119 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 41 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index 5334ec0..c53d5aa 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -113,7 +113,7 @@ msg_base = { break; case 'b': //change scan direction bbs.log_key("b"); - valid = true;hollaBack = 2; + valid = true; hollaBack = 2; docIface.log_str_n_char(this.log_header, 'b'); console.putmsg(green + high_intensity + "Back (change " + "direction)...\n"); @@ -320,6 +320,81 @@ msg_base = { * messages */ util : { + /* + * summary: + * Opens a new message base (modularizing); doesn't use proper + * exception throwing + * mb: + * Code of the new message base to open + * return: + * new message base object (already open), or 'null' for error + * NOTE: + * this needs to be changed to throw an exception for error, let's get + * away from the error code passing shit through returns + */ + openNewMBase : function(mb) { + try { + //take care of this in calling code + //mBase.close(); + mBase = new MsgBase(mb); + try { + mBase.open(); + } catch (e) { + console.putmsg(red + "Ername: " + e.name + "mBase.error: " + + e.message + "\n"); + throw new dDocException("openNewMBase() Error", e.message, 1); + } + + if (userSettings.debug.message_scan) { + console.putmsg(red + "Opened: " + mb + + " allegedly . . .\n"); + } + } catch (e) { + console.putmsg(red + "Error opening new mBase:\n" + + e.toString() + "\n"); + log("Error skipping through scanSub(): " + + e.toString()); + throw new dDocException("openNewMBase() Error", e.message, 2); + } + + return mBase; + }, + /* + * summary: + * Method determines whether or not there are any messages + * remaining to be read in a sub that are not deleted, etc + * mBase: + * Base to be tested for unread messages + * return: + * Boolean regarding whether or not valid unread messages still + * exist for this room + */ + hasUnread : function(mBase) { + var mb = this.openNewMBase(mBase); + var mHdr; + + if (mb == null) { + throw new dDocException("hasUnread() Error", + "Error getting valid open base back from openNewMBase()", 1); + } + + var tmpPtr = msg_area.sub[mb.code].scan_ptr; + + if (tmpPtr == mb.last_msg) { + return false; + } + + while (tmpPtr <= mb.last_msg) { + if (((mHdr = mb.get_msg_header(tmpPtr)) == null) || + (mHdr.attr & MSG_DELETED)) { + tmpPtr++; + } else { + return true; + } + } + + return false; + }, /* * summary: * Method remaps message start through finish for a room/sub-board @@ -471,7 +546,7 @@ msg_base = { case 'n': //read new console.putmsg(green + high_intensity + "Read new\n"); try { - msg_base.readNew(); + msg_base.read_cmd.readNew(); } catch (e) { console.putmsg(yellow + "Exception reading new: " + e.toString() + "\n"); @@ -650,6 +725,7 @@ msg_base = { "\tbreaks: " + breaks + "\n"); } + //this should be swapped out for proper message base open validation if (!base.is_open) { //let's give this a shot if (userSettings.debug.message_scan) { @@ -720,45 +796,6 @@ msg_base = { } return 0; - }, - /* - * summary: - * Opens a new message base (modularizing); doesn't use proper exception - * throwing - * mb: - * Code of the new message base to open - * return: - * new message base object (already open), or 'null' for error - * NOTE: - * this needs to be changed to throw an exception for error, let's get - * away from the error code passing shit through returns - */ - openNewMBase : function(mb) { - try { - //take care of this in calling code - //mBase.close(); - mBase = new MsgBase(mb); - try { - mBase.open(); - } catch (e) { - console.putmsg(red + "Ername: " + e.name + "mBase.error: " + - e.message + "\n"); - throw new dDocException("openNewMBase() Error", e.message, 1); - } - - if (userSettings.debug.message_scan) { - console.putmsg(red + "Opened: " + mb + - " allegedly . . .\n"); - } - } catch (e) { - console.putmsg(red + "Error opening new mBase:\n" - + e.toString() + "\n"); - log("Error skipping through scanSub(): " + - e.toString()); - throw new dDocException("openNewMBase() Error", e.message, 2); - } - - return mBase; }, /* * summary: From b94bd93e808f4c8534c502424e5c21fbde99c694 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Fri, 26 Jun 2015 21:24:16 -0700 Subject: [PATCH 05/14] Closed #173; poasting is now fixed --- load/dmbase.js | 2 +- load/dpoast.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index c53d5aa..037e900 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -568,7 +568,7 @@ msg_base = { case 'e': //enter a normal message console.putmsg(green + high_intensity + "Enter message\n"); - base = msg_base.openNewMBase(user.cursub); + base = msg_base.util.openNewMBase(user.cursub); if (base === null) { console.putmsg(yellow + "Could not open MsgBase: " + user.cursub + "\n"); diff --git a/load/dpoast.js b/load/dpoast.js index 5ff3b7d..a4fa24e 100644 --- a/load/dpoast.js +++ b/load/dpoast.js @@ -235,7 +235,7 @@ poast = { //going to use a generic subject for now; ignoring it from the //ddoc interface completely to see how it goes - this.getMsgBody(upload, base, recip); + this.getMsgBody(/*upload,*/ base, recip); //turn instant messages back on bbs.sys_status |= SS_MOFF; From b8a802980f359e7afc7d8ed496e87bbc8f5b37c0 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Fri, 26 Jun 2015 21:31:05 -0700 Subject: [PATCH 06/14] Squashed multiple bugs en route to solving #172 --- ddoc2.js | 2 +- load/dmbase.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ddoc2.js b/ddoc2.js index 690c74d..50a28d5 100644 --- a/ddoc2.js +++ b/ddoc2.js @@ -259,7 +259,7 @@ docIface = { console.putmsg("Room not zapped\n"); } - mBase = msg_base.openNewMBase(subList[ndx].code); + mBase = msg_base.util.openNewMBase(subList[ndx].code); if (mBase == null) { break; } diff --git a/load/dmbase.js b/load/dmbase.js index 037e900..4555e05 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -295,7 +295,7 @@ msg_base = { * move to the next room with unread messages */ readNew : function() { - var mBase = this.openNewMBase(bbs.cursub_code); + var mBase = msg_base.util.openNewMBase(bbs.cursub_code); /*if (userSettings.debug.navigation) { console.putmsg(yellow + msg_area.sub[bbs.cursub_code].index + ": " + @@ -305,7 +305,7 @@ msg_base = { //if (!roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index)) { if (msg_area.sub[bbs.cursub_code].scan_ptr < mBase.total_msgs) { - this.scanSub(msg_area.sub[bbs.cursub_code], true); + msg_base.scanSub(msg_area.sub[bbs.cursub_code], true); } //} docIface.nav.findNew(); @@ -827,7 +827,7 @@ msg_base = { sBoard.code + "\tindices size: " + indices.length + "\n"); } - mBase = this.openNewMBase(sBoard.code); + mBase = msg_base.util.openNewMBase(sBoard.code); if (mBase === null) { if (userSettings.debug.message_scan) { From 97c797f0cf312c6c2c8883d502f1262d13bf6692 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Mon, 29 Jun 2015 06:58:13 -0700 Subject: [PATCH 07/14] Fixed jump abort; closed #175 --- ddoc2.js | 8 ++++++-- load/dmbase.js | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ddoc2.js b/ddoc2.js index 50a28d5..b4ed62e 100644 --- a/ddoc2.js +++ b/ddoc2.js @@ -309,7 +309,11 @@ docIface = { docIface.util.quitDdoc(); } ouah = "Mail"; //vestigial? - } else { + } else if (uChoice == "") { + //abort + console.putmsg(yellow + "Aborted jump to new room . . .\n"); + return; + } else { try { ouah = this.chk4Room(uChoice); } catch (e) { @@ -329,7 +333,7 @@ docIface = { } } - if (ouah == "Mail") { + if (ouah == "MAIL") { bbs.log_str("Jumped to Mail"); } else { bbs.log_str("Jumped to " + this.setSub(ouah)); diff --git a/load/dmbase.js b/load/dmbase.js index 4555e05..27a7454 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -305,7 +305,9 @@ msg_base = { //if (!roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index)) { if (msg_area.sub[bbs.cursub_code].scan_ptr < mBase.total_msgs) { - msg_base.scanSub(msg_area.sub[bbs.cursub_code], true); + msg_base.scanSub(msg_area.sub[bbs.cursub_code], + msg_base.util.remap_message_indices(mBase), + true); } //} docIface.nav.findNew(); @@ -584,7 +586,7 @@ msg_base = { break; //other functionality tie-ins case 'w': -//normal wholist + //normal wholist wholist.list_long(wholist.populate()); break; case 'W': //short wholist From 90ba66770e865367e5d35e6b11558e4c0a9c5984 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Mon, 29 Jun 2015 07:32:56 -0700 Subject: [PATCH 08/14] More progress on getting message scan fixed (issue #172) --- ddoc2.js | 9 +++-- load/dmbase.js | 94 +++++++++++++++++++++++--------------------------- 2 files changed, 50 insertions(+), 53 deletions(-) diff --git a/ddoc2.js b/ddoc2.js index b4ed62e..24ac545 100644 --- a/ddoc2.js +++ b/ddoc2.js @@ -238,10 +238,13 @@ docIface = { var ndx = subList[bbs.cursub].index; var mBase; - if (userSettings.debug.navigation) { + if (userSettings.debug.message_scan) { console.putmsg(yellow + "Entering findNew()\nWorking with subList" + - " of length: " + subList.length + "\nContents: " + - subList.toString() + "\n"); + " of length " + subList.length + "; contents:\n"); + for each(var tmpSub in subList) { + console.putmsg("* " + cyan + tmpSub.name + "\n"); + } + console.putmsg("\n"); } for ( /* ndx already set */ ; ndx < subList.length ; ndx += 1 ) { diff --git a/load/dmbase.js b/load/dmbase.js index 27a7454..ede4b9f 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -295,6 +295,10 @@ msg_base = { * move to the next room with unread messages */ readNew : function() { + if (userSettings.debug.message_scan) { + console.putmsg(green + "openNewMBase(" + high_intensity + + bbs.cursub_code + normal + green + ");\n"); + } var mBase = msg_base.util.openNewMBase(bbs.cursub_code); /*if (userSettings.debug.navigation) { @@ -306,7 +310,7 @@ msg_base = { //if (!roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index)) { if (msg_area.sub[bbs.cursub_code].scan_ptr < mBase.total_msgs) { msg_base.scanSub(msg_area.sub[bbs.cursub_code], - msg_base.util.remap_message_indices(mBase), + msg_base.util.remap_message_indices(mBase.code), true); } //} @@ -411,65 +415,55 @@ msg_base = { * 'current' index since we're remapping the whole lot of 'em */ remap_message_indices : function(mBase) { - var msgMap = new Array(), curHdr = new Object(); - var curPtr = 0; + var msgMap = new Array(), curHdr = new Object(); + var curPtr = 0; - if (!mBase.is_open()) { - if (userSettings.debug.message_scan) { - console.putmsg(cyan + "Opening " + mBase.cfg.name + " for" + - " message mapping. . .\n"); - } - try { - mBase.open(); - } catch (e) { - throw new docIface.dDocException("remap_message_indices" + - "() Exception", e.message, 1); - } - } + mBase = this.openNewMBase(mBase.code); + if (userSettings.debug.message_scan) { + console.putmsg(yellow + "Remapping:\n"); + } + + for (var ndx = mBase.first_msg; ndx <= mBase.last_msg; ndx++) { if (userSettings.debug.message_scan) { - console.putmsg(yellow + "Remapping:\n"); + console.clearline(); } - for (var ndx = mBase.first_msg; ndx <= mBase.last_msg; ndx++) { - if (userSettings.debug.message_scan) { - console.clearline(); - } - - try { - curHdr = mBase.get_msg_header(ndx); - } catch (e) { - console.putmsg("Exception getting header: " + e.message + - "\n"); - mBase.close(); - throw new docIface.dDocException("remap_message_indices" + - "() Exception", e.message, 2); - } - if ((curHdr == null) || (curHdr.attr&MSG_DELETED)) { - continue; //skip this shit, we don't want this indexed - } else { - if (userSettings.debug.message_scan) { - console.putmsg(yellow + high_intensity + ndx + " to " + - curPtr); - } - msgMap[curPtr++] = ndx; - } + try { + curHdr = mBase.get_msg_header(ndx); + } catch (e) { + console.putmsg("Exception getting header: " + e.message + + "\n"); + mBase.close(); + throw new docIface.dDocException("remap_message_indices" + + "() Exception", e.message, 2); } - if (msgMap.length == 0) { - console.putmsg(red + "No messages found for mapping\n"); - throw new docIface.dDocException("remap_message_indices()" + - " Exception", "No messages in " + mBase.cfg.name + - " for mapping!", 3); + if ((curHdr == null) || (curHdr.attr&MSG_DELETED)) { + continue; //skip this shit, we don't want this indexed + } else { + if (userSettings.debug.message_scan) { + console.putmsg(yellow + high_intensity + ndx + " to " + + curPtr); + } + msgMap[curPtr++] = ndx; } + } - if (userSettings.debug.message_scan) { - console.putmsg(green + "Returning message mapping: " + msgMap + - "\nFor base: " + mBase.cfg.name + "\n"); - } + if (msgMap.length == 0) { + console.putmsg(red + "No messages found for mapping\n"); + throw new docIface.dDocException("remap_message_indices()" + + " Exception", "No messages in " + mBase.cfg.name + + " for mapping!", 3); + } + + if (userSettings.debug.message_scan) { + console.putmsg(green + "Returning message mapping: " + msgMap + + "\nFor base: " + mBase.cfg.name + "\n"); + } - mBase.close(); - return msgMap; + mBase.close(); + return msgMap; }, /* * summary: From 1c3810dccb081f98fc648ef9febb0fbff16ee587 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Thu, 2 Jul 2015 07:05:35 -0700 Subject: [PATCH 09/14] More debugging en route to fixing #172, #172 --- load/dmbase.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index ede4b9f..3dbe06c 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -890,7 +890,12 @@ msg_base = { //break; case 0: // Next message if (userSettings.debug.message_scan) { - console.putmsg("DEBUG: Next Msg\n"); + //console.putmsg("DEBUG: Next Msg\n"); + console.putmsg(high_intensity + "tmpPtr: " + normal + + tmpPtr + "\t" + high_intensity + "indices.length: " + + normal + indices.length + "\t" + high_intensity + + "indices[tmpPtr]: " + normal + indices[tmpPtr] + + "\n"); } if ((tmpPtr <= 0) && (inc == -1)) { mBase.close(); @@ -904,7 +909,7 @@ msg_base = { while (this.dispMsg(mBase, indices[tmpPtr], true) == null) { tmpPtr += inc; - if ((tmpPtr == 0) || (tmpPtr > indices.length)) { + if ((tmpPtr == 0) || (tmpPtr >= indices.length)) { break; } } From e31ca6da7069195fc4b33c8c63c978a183c91eeb Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Sat, 4 Jul 2015 08:13:39 -0700 Subject: [PATCH 10/14] Found and quashed some more bugs; things still are not fixed, but closer --- load/dmbase.js | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index 3dbe06c..6db40a5 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -297,25 +297,24 @@ msg_base = { readNew : function() { if (userSettings.debug.message_scan) { console.putmsg(green + "openNewMBase(" + high_intensity + - bbs.cursub_code + normal + green + ");\n"); + bbs.cursub_code + normal + green + ");\nWorking with " + + "user.cursub: " + user.cursub + "\n"); } var mBase = msg_base.util.openNewMBase(bbs.cursub_code); - /*if (userSettings.debug.navigation) { - console.putmsg(yellow + msg_area.sub[bbs.cursub_code].index + ": " + - roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index) + - "\n"); - }*/ - + if (userSettings.debug.message_scan) { + console.putmsg("Made it past openNewMBase();\n"); + } //if (!roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index)) { - if (msg_area.sub[bbs.cursub_code].scan_ptr < mBase.total_msgs) { + if (msg_area.sub[bbs.cursub_code].scan_ptr <= mBase.total_msgs) { msg_base.scanSub(msg_area.sub[bbs.cursub_code], - msg_base.util.remap_message_indices(mBase.code), + msg_base.util.remap_message_indices( + mBase), true); } //} - docIface.nav.findNew(); mBase.close(); + docIface.nav.findNew(); return; } }, @@ -339,7 +338,7 @@ msg_base = { * away from the error code passing shit through returns */ openNewMBase : function(mb) { - try { + //try { //take care of this in calling code //mBase.close(); mBase = new MsgBase(mb); @@ -355,13 +354,13 @@ msg_base = { console.putmsg(red + "Opened: " + mb + " allegedly . . .\n"); } - } catch (e) { + /* } catch (e) { console.putmsg(red + "Error opening new mBase:\n" + e.toString() + "\n"); log("Error skipping through scanSub(): " + e.toString()); throw new dDocException("openNewMBase() Error", e.message, 2); - } + } */ return mBase; }, @@ -418,7 +417,7 @@ msg_base = { var msgMap = new Array(), curHdr = new Object(); var curPtr = 0; - mBase = this.openNewMBase(mBase.code); + mBase = this.openNewMBase(mBase.cfg.code); if (userSettings.debug.message_scan) { console.putmsg(yellow + "Remapping:\n"); @@ -817,11 +816,11 @@ msg_base = { scanSub : function(sBoard, indices, forward) { var tmpPtr, inc, choice = 0; - if (userSettings.debug.message_scan) { + //if (userSettings.debug.navigation) { console.putmsg("Entered scanSub(); forward = " + forward + " user.cursub: " + user.cursub + "\nsBoard.code: " + sBoard.code + "\tindices size: " + indices.length + "\n"); - } + //} mBase = msg_base.util.openNewMBase(sBoard.code); @@ -838,7 +837,7 @@ msg_base = { tmpPtr = 0; //start from the beginning of these indices } - if (userSettings.debug.message_scan) { + //if (userSettings.debug.message_scan) { console.putmsg("sBoard.scan_ptr = " + sBoard.scan_ptr + "\n"); console.putmsg("sBoard.ptridx = " + sBoard.ptridx + "\n"); console.putmsg("tmpPtr = " + tmpPtr + "\n"); @@ -847,7 +846,7 @@ msg_base = { console.putmsg("mBase.first_msg = " + mBase.first_msg + "\n"); console.putmsg("mBase.total_msgs = " + mBase.total_msgs + "\n"); console.putmsg("mBase.last_msg = " + mBase.last_msg + "\n"); - } + //} if (forward) { inc = 1; From 9ba73e8f5457754370d955c9fcd8c749a3280908 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Sat, 4 Jul 2015 08:17:21 -0700 Subject: [PATCH 11/14] Squished bad MSG_DELETED (MSG_DELETE is what was wanted) in dmbase.js en route to #172 --- load/dmbase.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index 6db40a5..72e0f5e 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -391,7 +391,7 @@ msg_base = { while (tmpPtr <= mb.last_msg) { if (((mHdr = mb.get_msg_header(tmpPtr)) == null) || - (mHdr.attr & MSG_DELETED)) { + (mHdr.attr & MSG_DELETE)) { tmpPtr++; } else { return true; @@ -438,7 +438,7 @@ msg_base = { "() Exception", e.message, 2); } - if ((curHdr == null) || (curHdr.attr&MSG_DELETED)) { + if ((curHdr == null) || (curHdr.attr&MSG_DELETE)) { continue; //skip this shit, we don't want this indexed } else { if (userSettings.debug.message_scan) { From 8f1220219054d6041bdd22392b5df01a679416b8 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Sun, 19 Jul 2015 12:19:33 -0700 Subject: [PATCH 12/14] Fixed a small bug in findNew() that was hanging up the scan --- ddoc2.js | 6 ++---- load/dmbase.js | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ddoc2.js b/ddoc2.js index 24ac545..447a401 100644 --- a/ddoc2.js +++ b/ddoc2.js @@ -255,9 +255,7 @@ docIface = { + "\n"); } - if (!roomData.tieIns.isZapped(ndx) - /*msg_area.sub[bbs.cursub_code].index)*/ - ) { + if (!roomData.tieIns.isZapped(ndx)) { if (userSettings.debug.navigation) { console.putmsg("Room not zapped\n"); } @@ -267,7 +265,7 @@ docIface = { break; } - if (subList[ndx].scan_ptr != mBase.total_msgs) { + if (subList[ndx].scan_ptr < mBase.total_msgs) { docIface.nav.setSub(subList[ndx]); mBase.close(); return subList[ndx]; diff --git a/load/dmbase.js b/load/dmbase.js index 72e0f5e..2790704 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -306,7 +306,7 @@ msg_base = { console.putmsg("Made it past openNewMBase();\n"); } //if (!roomData.tieIns.isZapped(msg_area.sub[bbs.cursub_code].index)) { - if (msg_area.sub[bbs.cursub_code].scan_ptr <= mBase.total_msgs) { + if (msg_area.sub[bbs.cursub_code].scan_ptr < mBase.total_msgs) { msg_base.scanSub(msg_area.sub[bbs.cursub_code], msg_base.util.remap_message_indices( mBase), @@ -722,7 +722,7 @@ msg_base = { //this should be swapped out for proper message base open validation if (!base.is_open) { - //let's give this a shot + //let's give this a shotjoin if (userSettings.debug.message_scan) { console.putmsg(yellow + "base was closed; reopening\n"); } From e0c1fe3fcc781ad1c2374520df6aa2ade3b1db22 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Thu, 23 Jul 2015 07:00:27 -0700 Subject: [PATCH 13/14] Added scan_ptr reset function '%' to deal with corrupt pointer issue (ie #178, etc) --- ddoc2.js | 21 ++++++++++++++++----- load/dmbase.js | 17 ++++++++++++++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ddoc2.js b/ddoc2.js index 447a401..ea4f3be 100644 --- a/ddoc2.js +++ b/ddoc2.js @@ -256,12 +256,15 @@ docIface = { } if (!roomData.tieIns.isZapped(ndx)) { + mBase = msg_base.util.openNewMBase(subList[ndx].code); + if (userSettings.debug.navigation) { - console.putmsg("Room not zapped\n"); + console.putmsg("Room not zapped\t\tscan_ptr: " + + subList[ndx].scan_ptr + "\t\ttotal: " + + mBase.total_msgs + "\n"); } - - mBase = msg_base.util.openNewMBase(subList[ndx].code); - if (mBase == null) { + + if (mBase == null) { break; } @@ -269,7 +272,14 @@ docIface = { docIface.nav.setSub(subList[ndx]); mBase.close(); return subList[ndx]; - } + } else if (subList[ndx].scan_ptr > mBase.total_msg) { + //we've got some corrupt shit to fix here; not sure how it + //happened but we might as well have a way to fix it + subList[ndx].scan_ptr = mBase.first_msg; + if (userSettings.debug.navigation) { + console.putmsg(yellow + " just fixed scan ptrs\n"); + } + } mBase.close(); } } @@ -712,6 +722,7 @@ if (!debugOnly) { case 'o': case 'k': case '-': + case '%': msg_base.entry_level.handler(uchoice); break; //other msg base shit diff --git a/load/dmbase.js b/load/dmbase.js index 2790704..2debe2c 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -311,8 +311,15 @@ msg_base = { msg_base.util.remap_message_indices( mBase), true); - } - //} + } /* else if (msg_area.sub[bbs.cursub_code].scan_ptr > + mBase.total_msgs) { + //let's reset this to something sane just to get it working again + //for now; we'll worry about doing it correctly later + + msg_area.sub[bbs.cursub_code].scan_ptr = mBase.first_msg; + + } + //} */ mBase.close(); docIface.nav.findNew(); return; @@ -590,7 +597,11 @@ msg_base = { break; case 'l': //logout docIface.util.quitDdoc(); - break; + break; + case '%': //reset message pointers + var board = msg_area.sub[bbs.cursub_code]; + board.scan_ptr = 0; + break; default: if (userSettings.debug.navigation) { console.putmsg("\nNot handled yet . . .\n\n"); From acce344aee2a47d8a3c1410251d1fcd9c0753df5 Mon Sep 17 00:00:00 2001 From: Damon Getsman Date: Thu, 23 Jul 2015 07:35:54 -0700 Subject: [PATCH 14/14] Patched a quick [ugly] fix in for issue #179 (going to message by number) --- load/dmbase.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/load/dmbase.js b/load/dmbase.js index 2debe2c..fa71e1f 100644 --- a/load/dmbase.js +++ b/load/dmbase.js @@ -915,7 +915,8 @@ msg_base = { return 1; // skip to next room } tmpPtr += inc; - if ((tmpPtr >= 0) && (tmpPtr <= indices.length)) { + try { + if ((tmpPtr >= 0) && (tmpPtr <= indices.length)) { while (this.dispMsg(mBase, indices[tmpPtr], true) == null) { tmpPtr += inc; @@ -927,7 +928,11 @@ msg_base = { if (inc == 1) { sBoard.scan_ptr = indices[tmpPtr]; } - } + } + } catch (e) { + console.putmsg(yellow + "Uncaught exception from " + + "dispMsg(): " + e.message + "\n"); + } break; default: console.putmsg(red + "\nUnexpected value from rcChoice: "