Subj : Reading the scan_ptr for the 'mail sub'
To   : Nightfox
From : Digital Man
Date : Sun Mar 22 2015 08:57 pm

 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
>
>  Kh> While implementing a new mail interface for my shell, it appears that
>  Kh> I'm  not able to utilize the scan_ptr in the same way that I have been
>  Kh> using in  the message base interface that I've done... There, I was
>  Kh> utilizing  msg_area.sub[bbs.cursub_code].whatever... Here, even when I
>  Kh> specify  manually msg_area.sub['mail'].scan_ptr, I still find it
>  Kh> undefined. Can  anybody tell me if there is a different way to go about
>  Kh> locating the  current message/scan_ptr in mail or should I get ready to
>  Kh> 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 � telnet://vert.synchro.net