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

 Re: Messagebase skipping a number
 By: Digital Man to Nightfox on Sat Nov 19 2016 20:02:04

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

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

I'm not using get_all_msg_headers in my reader, but it sounds like perhaps I
should now that voting has been added.  My reader gets the number of messages
in the messagebase and gets each header one at a time.  I wasn't sure how
efficient it would be to get all headers compared to the one-at-a-time
approach, but perhaps I'll try using get_all_msg_headers and refactor my reader
to use that and see how that works compared to how it's working now.

>> 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?

DM> It is the case. But you probably don't want to load votes, so the default
DM> "include_votes" parameter value (to get_msg_index, get_msg_header and
DM> 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?

DM> I'm not really sure what you're asking. If you pass "true" as the last

I think you answered my question above - The message offsets from 0 to the
total number of messages are valid.

DM> argument to those get_* methods I mentioned, you'll get votes too, but
DM> then you'll have to filter those manually (you don't need/want to try to
DM> display vote to the user). So I think current behavior is what you will
DM> want, but you'll need to be able to handle the case get_msg_index might
DM> return null (just move to the next offset value).

With the voting messages in there, it sounds like I'll need to refactor my
reader a bit to not get the vote messages.

Nightfox

---
� Synchronet � Digital Distortion: digitaldistortionbbs.com