• Reading the scan_ptr for the 'mail sub'

    From Khelair@VERT/TINFOIL to All on Saturday, March 21, 2015 10:42:31
    While implementing a new mail interface for my shell, it appears that I'm not able to utilize the scan_ptr in the same way that I have been using in the message base interface that I've done... There, I was utilizing msg_area.sub[bbs.cursub_code].whatever... Here, even when I specify manually msg_area.sub['mail'].scan_ptr, I still find it undefined. Can anybody tell me if there is a different way to go about locating the current message/scan_ptr in mail or should I get ready to toss up some code snippets?
    Any assistance or pointers in the right direction are appreciated.

    -D/K

    ---
    Borg Burgers: We do it our way; your way is irrelevant.
    þ Synchronet þ Tinfoil Tetrahedron BBS telnet://tinfoil.synchro.net
  • From Nightfox@VERT/DIGDIST to Khelair on Sunday, March 22, 2015 08:29:47
    Re: Reading the scan_ptr for the 'mail sub'
    By: Khelair to All on Sat Mar 21 2015 10:42:31

    While implementing a new mail interface for my shell, it appears that I'm not able to utilize the scan_ptr in the same way that I have been using in the message base interface that I've done... There, I was utilizing msg_area.sub[bbs.cursub_code].whatever... Here, even when I specify manually msg_area.sub['mail'].scan_ptr, I still find it undefined. Can anybody tell me if there is a different way to go about locating the current message/scan_ptr in mail or should I get ready to toss up some code snippets?

    I've been working on a new message reader, and I've found that the msg_area, and it seems to me that the "mail" is a special case in that the msg_area.grp, msg_ara.sub, etc. arrays don't seem to be defined for the "mail" area. Those arrays seem to be only defined for the sub-boards. So, I don't think there is a last-read pointer, etc. defined for the "mail" area. If you want to find the last read message for a user in the "mail" area, you'll need to go through all messages in the "mail" area, look for the ones written to the current logged-in user, and look at the 'attr' field in the message headers and find the last one that has the MSG_READ attribute set. For example, something like this:

    var msgbase = new MsgBase("mail");
    if (msgbase.is_open)
    {
    var lastReadMsgIdx = 0;
    for (var i = 0; i < msgbase.total_msgs; ++i)
    {
    var msgHdr = msgbase.get_msg_header(true, i, true);
    if ((msgHdr.to_ext == user.number) && ((msgHdr.attr & MSG_READ) == MSG_READ))
    lastReadMsgIdx = i;
    }
    msgbase.close();
    }
    else
    console.print("Uh-oh, failed to open personal mail!\r\n\1p");


    Nightfox

    ---
    þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.com
  • From Khelair@VERT/TINFOIL to Nightfox on Sunday, March 22, 2015 19:28:09
    Re: Reading the scan_ptr for the 'mail sub'
    By: Nightfox to Khelair on Sun Mar 22 2015 08:29:47

    I've been working on a new message reader, and I've found that the msg_area, and it seems to me that the "mail" is a special case in that
    the msg_area.grp, msg_ara.sub, etc. arrays don't seem to be defined for the "mail" area. Those arrays seem to be only defined for the
    sub-boards. So, I don't think there is a last-read pointer, etc.
    defined for the "mail" area. If you want to find the last read message for a user in the "mail" area, you'll need to go through all messages in the "mail" area, look for the ones written to the current logged-in
    user, and look at the 'attr' field in the message headers and find the last one that has the MSG_READ attribute set. For example, something
    [snip]

    Wow. Well, not the answer that I was hoping for, but an excellent response for information and solution. Much appreciated. :)

    -D/K

    ---
    Borg Burgers: We do it our way; your way is irrelevant.
    þ Synchronet þ Tinfoil Tetrahedron BBS telnet://tinfoil.synchro.net
  • From Digital Man@VERT to Khelair on Sunday, March 22, 2015 20:56:29
    Re: Reading the scan_ptr for the 'mail sub'
    By: Khelair to All on Sat Mar 21 2015 10:42 am

    While implementing a new mail interface for my shell, it appears that I'm not able to utilize the scan_ptr in the same way that I have been using in the message base interface that I've done... There, I was utilizing msg_area.sub[bbs.cursub_code].whatever... Here, even when I specify manually msg_area.sub['mail'].scan_ptr, I still find it undefined. Can anybody tell me if there is a different way to go about locating the current message/scan_ptr in mail or should I get ready to toss up some code snippets?
    Any assistance or pointers in the right direction are appreciated.

    There's no such concept of a 'new-scan pointer' for email. Instead, all mail waiting for the current user is checked for the 'read' flag. If there is unread
    mail, that is when you typically tell the user they have "new mail", not based on any pointer value.

    digital man

    Synchronet "Real Fact" #13:
    SBBSecho was originally written by Allen Christiansen (King Drafus) in 1994. Norco, CA WX: 58.7øF, 80.0% humidity, 6 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to Nightfox on Sunday, March 22, 2015 20:57:58
    Re: Reading the scan_ptr for the 'mail sub'
    By: Nightfox to Khelair on Sun Mar 22 2015 08:29 am

    Re: Reading the scan_ptr for the 'mail sub'
    By: Khelair to All on Sat Mar 21 2015 10:42:31

    While implementing a new mail interface for my shell, it appears that I'm not able to utilize the scan_ptr in the same way that I have been using in the message base interface that I've done... There, I was utilizing msg_area.sub[bbs.cursub_code].whatever... Here, even when I specify manually msg_area.sub['mail'].scan_ptr, I still find it undefined. Can anybody tell me if there is a different way to go about locating the current message/scan_ptr in mail or should I get ready to toss up some code snippets?

    I've been working on a new message reader, and I've found that the msg_area, and it seems to me that the "mail" is a special case in that the msg_area.grp, msg_ara.sub, etc. arrays don't seem to be defined for the "mail" area. Those arrays seem to be only defined for the sub-boards. So, I don't think there is a last-read pointer, etc. defined for the "mail" area. If you want to find the last read message for a user in the "mail" area, you'll need to go through all messages in the "mail" area, look for the ones written to the current logged-in user, and look at the 'attr' field in the message headers and find the last one that has the MSG_READ attribute set. For example, something like this:

    var msgbase = new MsgBase("mail");
    if (msgbase.is_open)
    {
    var lastReadMsgIdx = 0;
    for (var i = 0; i < msgbase.total_msgs; ++i)
    {
    var msgHdr = msgbase.get_msg_header(true, i, true);
    if ((msgHdr.to_ext == user.number) && ((msgHdr.attr & MSG_READ) == MSG_READ))
    lastReadMsgIdx = i;
    }
    msgbase.close();
    }
    else
    console.print("Uh-oh, failed to open personal mail!\r\n\1p");

    Users can read their mail out-of-order, so the concept of "lastReadMsgIdx" doesn't really apply here.

    digital man

    Synchronet "Real Fact" #62:
    "Baja" (name of Synchronet PCMS compiler/languege) is pronounced "ba-ha". Norco, CA WX: 58.7øF, 80.0% humidity, 6 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Nightfox@VERT/DIGDIST to Digital Man on Monday, March 23, 2015 19:34:52
    Re: Reading the scan_ptr for the 'mail sub'
    By: Digital Man to Nightfox on Sun Mar 22 2015 20:57:58

    Users can read their mail out-of-order, so the concept of "lastReadMsgIdx" doesn't really apply here.

    Users can read messages on sub-boards out of order too though.. The message read prompt lets users enter a message number and it will jump directly to that message. A user could jump around messages in a sub-board that way.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.com
  • From Digital Man@VERT to Nightfox on Monday, March 23, 2015 20:11:26
    Re: Reading the scan_ptr for the 'mail sub'
    By: Nightfox to Digital Man on Mon Mar 23 2015 07:34 pm

    Re: Reading the scan_ptr for the 'mail sub'
    By: Digital Man to Nightfox on Sun Mar 22 2015 20:57:58

    Users can read their mail out-of-order, so the concept of "lastReadMsgIdx" doesn't really apply here.

    Users can read messages on sub-boards out of order too though.. The message read prompt lets users enter a message number and it will jump directly to that message. A user could jump around messages in a sub-board that way.

    Right, but we don't store a separate "message read" flag for every message for every user. That's why we use a single "highest message number read" pointer for each user for each sub-board. Email uses a different method.

    digital man

    Synchronet "Real Fact" #39:
    Synchronet has been ported to FreeBSD, NetBSD, OpenBSD, Solaris, QNX, and MacOS.
    Norco, CA WX: 61.9øF, 64.0% humidity, 6 mph ESE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Nightfox@VERT/DIGDIST to Digital Man on Monday, March 23, 2015 21:35:06
    Re: Reading the scan_ptr for the 'mail sub'
    By: Digital Man to Nightfox on Mon Mar 23 2015 20:11:26

    Users can read their mail out-of-order, so the concept of
    "lastReadMsgIdx" doesn't really apply here.

    Users can read messages on sub-boards out of order too though.. The
    message read prompt lets users enter a message number and it will jump
    directly to that message. A user could jump around messages in a
    sub-board that way.

    Right, but we don't store a separate "message read" flag for every message for every user. That's why we use a single "highest message number read" pointer for each user for each sub-board. Email uses a different method.

    I see what you're saying. Conceptually, they seem different but also slightly similar. For personal email, if you want to point the user to the first unread message (similar to a newscan in a sub-board), you could iterate through personal messages to the user, starting with the first, and look for the first message that doesn't have the "message read" flag set. The user could read their messages out of order, but that would still get them to an unread personal email. I think that's what Khelair was going for.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.com
  • From Khelair@VERT/TINFOIL to Digital Man on Monday, March 23, 2015 21:10:52
    Re: Reading the scan_ptr for the 'mail sub'
    By: Digital Man to Khelair on Sun Mar 22 2015 20:56:29

    There's no such concept of a 'new-scan pointer' for email. Instead, all mail waiting for the current user is checked for the 'read' flag. If
    there is unread mail, that is when you typically tell the user they have "new mail", not based on any pointer value.

    Roger that. Got some helpful code from [I believe it was, please shoot me if I'm wrong] Nightfox that I implemented with little change. :)
    Now I just need to go back and rewrite some of my modularized code a bit so that I can re-use the existing routines and not my bastardized reinvention of the wheel I already wrote with the other message bases, since everything is pretty much the same in the interface I'm writing...

    -D/K

    ---
    Borg Burgers: We do it our way; your way is irrelevant.
    þ Synchronet þ Tinfoil Tetrahedron BBS telnet://tinfoil.synchro.net
  • From Khelair@VERT/TINFOIL to Nightfox on Tuesday, March 24, 2015 19:34:54
    Re: Reading the scan_ptr for the 'mail sub'
    By: Nightfox to Digital Man on Mon Mar 23 2015 21:35:06

    slightly similar. For personal email, if you want to point the user to the first unread message (similar to a newscan in a sub-board), you could iterate through personal messages to the user, starting with the first, and look for the first message that doesn't have the "message read" flag set. The user could read their messages out of order, but that would still get them to an unread personal email. I think that's what Khelair was going for.

    Aye, this is the behavior that I'm looking for. The interface that I'm implementing (see bbs.eschwa.com if you want an example) is very minimal, and handles everything by first unread on forward. That is the starting point, anyway, as you mentioned... After that you can go forward, backward, or jump to any particular message, yes. It's a very, very linear interface, where basically you can scroll through the whole system from email to message boards by doing nothing other than thwapping the spacebar at the end of each one.

    -D/K

    ---
    Borg Burgers: We do it our way; your way is irrelevant.
    þ Synchronet þ Tinfoil Tetrahedron BBS telnet://tinfoil.synchro.net