• Messagebase skipping a number

    From Nightfox@VERT/DIGDIST to Digital Man on Sat Nov 19 19: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 Sat Nov 19 20: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 Sat Nov 19 23:15:05 2016
    Re: Messagebase skipping a numberã By: Nightfox to Digital Man on Sat Nov 19 2016 19:22:29ãã Ni> Today, while using my custom JS message reader, I noticed that one of myã Ni> message sub-boards appears to be skipping an offset. For example, messageã Ni> number 3405 (offset 3404) doesn't seem to exist. My message reader seesã Ni> messages 3404 and 3406 as valid messages, but there's nothing at messageã Ni> 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 Sat Nov 19 21: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).ãã 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ã
  • From Nightfox@VERT/DIGDIST to echicken on Sat Nov 19 21:23:23 2016
    Re: Messagebase skipping a numberã By: echicken to Nightfox on Sat Nov 19 2016 23:15:05ãã Ni>> Today, while using my custom JS message reader, I noticed that oneã Ni>> of my message sub-boards appears to be skipping an offset. Forã Ni>> example, message number 3405 (offset 3404) doesn't seem to exist. Myã Ni>> message reader sees messages 3404 and 3406 as valid messages, butã Ni>> there's nothing at message number 3405 (which would be offset 3404).ã Ni>> When I use the built-in reader, ãã ec> Nothing as in "no message header" (you try to read the header and getã ec> 'null') or nothing as in "no message body" (null), or both?ããI'd have to do some debugging to find out.ãã ec> I'm wondering if this is related to the new 'vote messages'. They coexistã ec> with the rest of the messages in a sub, but have no message body, have aã ec> special attribute in the header, have no subject line, and are probablyã ec> 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 Sat Nov 19 21:54:34 2016
    Re: Messagebase skipping a numberã By: echicken to Nightfox on Sat Nov 19 2016 23:15:05ãã Ni>> Today, while using my custom JS message reader, I noticed that oneã Ni>> of my message sub-boards appears to be skipping an offset. Forã Ni>> example, message number 3405 (offset 3404) doesn't seem to exist. Myã Ni>> message reader sees messages 3404 and 3406 as valid messages, butã Ni>> there's nothing at message number 3405 (which would be offset 3404).ã Ni>> When I use the built-in reader, ãã ec> Nothing as in "no message header" (you try to read the header and getã ec> '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 Sat Nov 19 22: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ã >ã > Ni>> Today, while using my custom JS message reader, I noticed that oneã > Ni>> of my message sub-boards appears to be skipping an offset. Forã > Ni>> example, message number 3405 (offset 3404) doesn't seem to exist. Myã > Ni>> message reader sees messages 3404 and 3406 as valid messages, butã > Ni>> there's nothing at message number 3405 (which would be offset 3404).ã > Ni>> When I use the built-in reader,ã >ã > ec> Nothing as in "no message header" (you try to read the header and getã > ec> '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 02:18:39 2016
    Re: Messagebase skipping a numberã By: Nightfox to echicken on Sat Nov 19 2016 21:54:34ãã Ni> 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 07:20:09 2016
    Re: Messagebase skipping a numberã By: Digital Man to Nightfox on Sat Nov 19 2016 22:58:18ãã DM> Doesn't your reader already filter out some messages based on attributesã DM> (deleted messages, unvalidated messages, private mesages)? You could justã DM> 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.ãã DM> The main advantages of using the get_all_msg_headers() method is speedã DM> (that's why it was created) and it now tallies the votes for you and putsã DM> the results in the message headers (currently, just upvotes andã DM> downvotes). The main disadvantage is that it didn't exist before sbbsã DM> 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 07:20:52 2016
    Re: Messagebase skipping a numberã By: echicken to Nightfox on Sun Nov 20 2016 02:18:39ãã Ni>> It looks like the message header is null.ãã ec> I usually check for this every time I load a message header from aã ec> MsgBase, and skip the message if the header === null. It crops up once inã ec> a while for various reasons (though I don't generally bother with theã ec> by_offset thing, maybe it's less of an issue in that case) so I've justã ec> 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 12: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ã >ã > DM> Doesn't your reader already filter out some messages based onã > DM> attributes (deleted messages, unvalidated messages, private mesages)?ã > DM> You could just add the new VOTE and POLL attributes to yourã > DM> 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 15:14:17 2016
    Re: Messagebase skipping a numberã By: Nightfox to Digital Man on Sun Nov 20 2016 07:20:09ãã Ni> I could do a version check to make sure my reader only callsã Ni> get_all_msg_headers() on 3.16 and above. At first I was thinking ofã Ni> 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 14: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.ãã DM> So if you or a user deletes a message, it remains visible to everyone? Forã DM> the built-in reader, that behavior is configurable (SCFG->Messageã DM> Options->User Can View Deleted Messages), the default setting is "Sysopsã DM> 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 14:30:38 2016
    Re: Messagebase skipping a numberã By: echicken to Nightfox on Sun Nov 20 2016 15:14:17ãã ec> Simplest/safest might be:ãã ec> if (typeof msgbase.get_all_msg_headers === 'function') {}ãã ec> Saves you from having to worry about which version/release that methodã ec> first appeared in.ããMakes sense. That seems a bit better.ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã