Subj : Messagebase skipping a number
To   : Nightfox
From : Digital Man
Date : Sat Nov 19 2016 08:02 pm

 Re: Messagebase skipping a number
 By: Nightfox to Digital Man on Sat Nov 19 2016 07:22 pm

> Hi DM,
>
> Today, while using my custom JS message reader, I noticed that one of my
> message sub-boards appears to be skipping an offset.  For example, message
> number 3405 (offset 3404) doesn't seem to exist.

It's probably a vote.

> My message reader sees
> messages 3404 and 3406 as valid messages, but there's nothing at message
> number 3405 (which would be offset 3404).

By default, the JS MsgBase does not return votes as messages (e.g. using
get_all_msg_headers).

> When I use the built-in reader,
> it skips that message but the numbers are sequential - According to the
> built-in reader, message number 3405 seems to be what my reader thinks is
> 3406.

Messages offsets and message numbers rarely have a direct correlation (e.g.
when a message is deleted, that message number disappears, but many of the
message offsets are shifted when the message is physically removed from the
base).

The built-in reader displays relative numbers, not actual message numbers (e.g.
the first visible msg to the user is always msg #1).

> In the JavaScript interface, I had thought that message offsets would
> all be valid between 0 and the number of messages in the messagebase.  Is
> that not the case?

It is the case. But you probably don't want to load votes, so the default
"include_votes" parameter value (to get_msg_index, get_msg_header and
get_all_msg_headers) is false.

> In the JavaScript interface, is it necessary to go
> through all message offsets to make sure a valid message can be retrieved?

I'm not really sure what you're asking. If you pass "true" as the last argument
to those get_* methods I mentioned, you'll get votes too, but then you'll have
to filter those manually (you don't need/want to try to display vote to the
user). So I think current behavior is what you will want, but you'll need to be
able to handle the case get_msg_index might return null (just move to the next
offset value).

Also, if you want the new msg (pseudo) header properties (upvotes and
downvotes), you'll need to use the get_all_msg_headers() method for retrieving
the message headers.

                                           digital man

Synchronet/BBS Terminology Definition #21:
FF = Form Feed (ASCII 12, Ctrl-L)
Norco, CA WX: 64.5�F, 33.0% humidity, 1 mph E wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net