Skip to content

Commit e0c1fe3

Browse files
committed
Added scan_ptr reset function '%' to deal with corrupt pointer issue (ie #178, etc)
1 parent 8f12202 commit e0c1fe3

2 files changed

Lines changed: 30 additions & 8 deletions

File tree

ddoc2.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,20 +256,30 @@ docIface = {
256256
}
257257

258258
if (!roomData.tieIns.isZapped(ndx)) {
259+
mBase = msg_base.util.openNewMBase(subList[ndx].code);
260+
259261
if (userSettings.debug.navigation) {
260-
console.putmsg("Room not zapped\n");
262+
console.putmsg("Room not zapped\t\tscan_ptr: " +
263+
subList[ndx].scan_ptr + "\t\ttotal: " +
264+
mBase.total_msgs + "\n");
261265
}
262-
263-
mBase = msg_base.util.openNewMBase(subList[ndx].code);
264-
if (mBase == null) {
266+
267+
if (mBase == null) {
265268
break;
266269
}
267270

268271
if (subList[ndx].scan_ptr < mBase.total_msgs) {
269272
docIface.nav.setSub(subList[ndx]);
270273
mBase.close();
271274
return subList[ndx];
272-
}
275+
} else if (subList[ndx].scan_ptr > mBase.total_msg) {
276+
//we've got some corrupt shit to fix here; not sure how it
277+
//happened but we might as well have a way to fix it
278+
subList[ndx].scan_ptr = mBase.first_msg;
279+
if (userSettings.debug.navigation) {
280+
console.putmsg(yellow + " just fixed scan ptrs\n");
281+
}
282+
}
273283
mBase.close();
274284
}
275285
}
@@ -712,6 +722,7 @@ if (!debugOnly) {
712722
case 'o':
713723
case 'k':
714724
case '-':
725+
case '%':
715726
msg_base.entry_level.handler(uchoice);
716727
break;
717728
//other msg base shit

load/dmbase.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,15 @@ msg_base = {
311311
msg_base.util.remap_message_indices(
312312
mBase),
313313
true);
314-
}
315-
//}
314+
} /* else if (msg_area.sub[bbs.cursub_code].scan_ptr >
315+
mBase.total_msgs) {
316+
//let's reset this to something sane just to get it working again
317+
//for now; we'll worry about doing it correctly later
318+
319+
msg_area.sub[bbs.cursub_code].scan_ptr = mBase.first_msg;
320+
321+
}
322+
//} */
316323
mBase.close();
317324
docIface.nav.findNew();
318325
return;
@@ -590,7 +597,11 @@ msg_base = {
590597
break;
591598
case 'l': //logout
592599
docIface.util.quitDdoc();
593-
break;
600+
break;
601+
case '%': //reset message pointers
602+
var board = msg_area.sub[bbs.cursub_code];
603+
board.scan_ptr = 0;
604+
break;
594605
default:
595606
if (userSettings.debug.navigation) {
596607
console.putmsg("\nNot handled yet . . .\n\n");

0 commit comments

Comments
 (0)