• Messagebase skipping a number

    From Nightfox@VERT/DIGDIST to Digital Man on Sun Nov 20 03:22:29 2016
    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. My message reader sees messages 3404 and 3406 as valid messages, but there's nothing at message number 3405 (which would be offset 3404). 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. 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? In the JavaScript interface, is it necessary to go through all message offsets to make sure a valid message can be retrieved?

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Digital Man@VERT to Nightfox on Sun Nov 20 04:02:04 2016
    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 þ [vert/cvs/bbs].synchro.net
  • From echicken@VERT/ECBBS to Nightfox on Sun Nov 20 07:15:05 2016
    Re: Messagebase skipping a number
    By: Nightfox to Digital Man on Sat Nov 19 2016 19:22:29

    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. My message reader sees messages 3404 and 3406 as valid messages, but there's nothing at message number 3405 (which would be offset 3404). When I use the built-in reader,

    Nothing as in "no message header" (you try to read the header and get 'null') or nothing as in "no message body" (null), or both?

    I'm wondering if this is related to the new 'vote messages'. They coexist with the rest of the messages in a sub, but have no message body, have a special attribute in the header, have no subject line, and are probably different in a couple of other ways.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@VERT/DIGDIST to Digital Man on Sun Nov 20 05:22:15 2016
    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).

    By default, the JS MsgBase does not return votes as messages (e.g. using 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?

    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

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

    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).

    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
  • From Nightfox@VERT/DIGDIST to echicken on Sun Nov 20 05:23:23 2016
    Re: Messagebase skipping a number
    By: echicken to Nightfox on Sat Nov 19 2016 23:15:05

    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. My
    message reader sees messages 3404 and 3406 as valid messages, but
    there's nothing at message number 3405 (which would be offset 3404).
    When I use the built-in reader,

    Nothing as in "no message header" (you try to read the header and get 'null') or nothing as in "no message body" (null), or both?

    I'd have to do some debugging to find out.

    I'm wondering if this is related to the new 'vote messages'. They coexist with the rest of the messages in a sub, but have no message body, have a special attribute in the header, have no subject line, and are probably different in a couple of other ways.

    From Digital Man's reply, it sounds like those are indeed vote messages. It sounds like I'll have to refactor my reader a bit to use get_all_headers and not get the vote messages instead of getting each header one at a time, as it's currently doing.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Nightfox@VERT/DIGDIST to echicken on Sun Nov 20 05:54:34 2016
    Re: Messagebase skipping a number
    By: echicken to Nightfox on Sat Nov 19 2016 23:15:05

    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. My
    message reader sees messages 3404 and 3406 as valid messages, but
    there's nothing at message number 3405 (which would be offset 3404).
    When I use the built-in reader,

    Nothing as in "no message header" (you try to read the header and get 'null') or nothing as in "no message body" (null), or both?

    It looks like the message header is null.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Digital Man@VERT to Nightfox on Sun Nov 20 06:58:18 2016
    Re: Messagebase skipping a number
    By: Nightfox to echicken on Sat Nov 19 2016 09:54 pm

    Re: Messagebase skipping a number
    By: echicken to Nightfox on Sat Nov 19 2016 23:15:05

    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. My
    message reader sees messages 3404 and 3406 as valid messages, but
    there's nothing at message number 3405 (which would be offset 3404).
    When I use the built-in reader,

    Nothing as in "no message header" (you try to read the header and get 'null') or nothing as in "no message body" (null), or both?

    It looks like the message header is null.

    Doesn't your reader already filter out some messages based on attributes (deleted messages, unvalidated messages, private mesages)? You could just add the new VOTE and POLL attributes to your checking/filtering logic.

    The main advantages of using the get_all_msg_headers() method is speed (that's why it was created) and it now tallies the votes for you and puts the results in the message headers (currently, just upvotes and downvotes). The main disadvantage is that it didn't exist before sbbs v3.16.

    digital man

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

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From echicken@VERT/ECBBS to Nightfox on Sun Nov 20 10:18:39 2016
    Re: Messagebase skipping a number
    By: Nightfox to echicken on Sat Nov 19 2016 21:54:34

    It looks like the message header is null.

    I usually check for this every time I load a message header from a MsgBase, and skip the message if the header === null. It crops up once in a while for various reasons (though I don't generally bother with the by_offset thing, maybe it's less of an issue in that case) so I've just adopted it as a normal practice.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@VERT/DIGDIST to Digital Man on Sun Nov 20 15:20:09 2016
    Re: Messagebase skipping a number
    By: Digital Man to Nightfox on Sat Nov 19 2016 22:58:18

    Doesn't your reader already filter out some messages based on attributes (deleted messages, unvalidated messages, private mesages)? You could just add the new VOTE and POLL attributes to your checking/filtering logic.

    It doesn't yet, but that's something that has been on my mind to add.

    The main advantages of using the get_all_msg_headers() method is speed (that's why it was created) and it now tallies the votes for you and puts the results in the message headers (currently, just upvotes and downvotes). The main disadvantage is that it didn't exist before sbbs v3.16.

    I could do a version check to make sure my reader only calls get_all_msg_headers() on 3.16 and above. At first I was thinking of requiring 3.16 or higher, but I'd like it to be backwards-compatible.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Nightfox@VERT/DIGDIST to echicken on Sun Nov 20 15:20:52 2016
    Re: Messagebase skipping a number
    By: echicken to Nightfox on Sun Nov 20 2016 02:18:39

    It looks like the message header is null.

    I usually check for this every time I load a message header from a MsgBase, and skip the message if the header === null. It crops up once in a while for various reasons (though I don't generally bother with the by_offset thing, maybe it's less of an issue in that case) so I've just adopted it as a normal practice.

    I check the headers for null also. But in my case I just wouldn't do anything with it if it was null. Now it seems like it might be more common for a message header to be null though.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Digital Man@VERT to Nightfox on Sun Nov 20 20:04:02 2016
    Re: Messagebase skipping a number
    By: Nightfox to Digital Man on Sun Nov 20 2016 07:20 am

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

    Doesn't your reader already filter out some messages based on attributes (deleted messages, unvalidated messages, private mesages)? You could just add the new VOTE and POLL attributes to your checking/filtering logic.

    It doesn't yet, but that's something that has been on my mind to add.

    So if you or a user deletes a message, it remains visible to everyone? For the built-in reader, that behavior is configurable (SCFG->Message Options->User Can View Deleted Messages), the default setting is "Sysops Only", I think.

    digital man

    Synchronet "Real Fact" #69:
    You can purchase the BBS Documentary DVD set at http://bbsdocumentary.com/order/
    Norco, CA WX: 64.8øF, 61.0% humidity, 8 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From echicken@VERT/ECBBS to Nightfox on Sun Nov 20 23:14:17 2016
    Re: Messagebase skipping a number
    By: Nightfox to Digital Man on Sun Nov 20 2016 07:20:09

    I could do a version check to make sure my reader only calls get_all_msg_headers() on 3.16 and above. At first I was thinking of requiring 3.16 or higher, but I'd like it to be backwards-compatible.

    Simplest/safest might be:

    if (typeof msgbase.get_all_msg_headers === 'function') {}

    Saves you from having to worry about which version/release that method first appeared in.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@VERT/DIGDIST to Digital Man on Sun Nov 20 22:22:27 2016
    Re: Messagebase skipping a number
    By: Digital Man to Nightfox on Sun Nov 20 2016 12:04:02

    It doesn't yet, but that's something that has been on my mind to add.

    So if you or a user deletes a message, it remains visible to everyone? For the built-in reader, that behavior is configurable (SCFG->Message Options->User Can View Deleted Messages), the default setting is "Sysops Only", I think.

    That's its current behavior, but it's something I've been meaning to update. Thanks for the tip.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Nightfox@VERT/DIGDIST to echicken on Sun Nov 20 22:30:38 2016
    Re: Messagebase skipping a number
    By: echicken to Nightfox on Sun Nov 20 2016 15:14:17

    Simplest/safest might be:

    if (typeof msgbase.get_all_msg_headers === 'function') {}

    Saves you from having to worry about which version/release that method first appeared in.

    Makes sense. That seems a bit better.

    Nightfox

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