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