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[snip]
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
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.
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.
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.
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.
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.
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.
Sysop: | digital man |
---|---|
Location: | Riverside County, California |
Users: | 1,044 |
Nodes: | 15 (0 / 15) |
Uptime: | 00:35:46 |
Calls: | 500,299 |
Calls today: | 17 |
Files: | 95,204 |
U/L today: |
1 files (1,581K bytes) |
D/L today: |
2,582 files (614M bytes) |
Messages: | 465,287 |
Posted today: | 13 |