Fix for ansitex still running, when user timeout inactive. Fix for calculating unread messages.

This commit is contained in:
Deon George
2022-05-06 17:41:07 +10:00
parent 912841b7d8
commit 641551125b
5 changed files with 43 additions and 13 deletions

View File

@@ -236,17 +236,28 @@ PageFrame.prototype.loadMessage = function(page) {
var stats = ma.getUserStats(this.frame);
// if this message is to the user, and the msg number > scan_ptr and it is the next message on the user's new mail list
var newmsgs = area.newMsgs();
var newmsgs = area.newMsgsToMe();
log(LOG_DEBUG,'User has: '+newmsgs.length+' msgs to read to ME');
if (newmsgs.length) {
var next = newmsgs.shift();
log(LOG_DEBUG,'NEXT is: '+next.tag+' , this is: '+msg.tag);
if (next.tag === msg.tag)
stats.scan_ptr = next.number;
}
// if this message is the next message, update last_read
if (msg.number === stats.last_read+1)
stats.last_read = msg.number;
var newmsgs = area.newMsgs();
log(LOG_DEBUG,'User has: '+newmsgs.length+' msgs to read');
if (newmsgs.length) {
var next = newmsgs.shift();
log(LOG_DEBUG,'NEXT is: '+next.tag+' , this is: '+msg.tag);
if (next.tag === msg.tag)
stats.last_read = next.number;
}
log(LOG_DEBUG,'Built frame: ['+this.frame+']['+this.index+'] ('+this.page+')');
}

View File

@@ -180,8 +180,9 @@ function atcode(field,length,pad,context) {
break;
}
var x = context.getUserStats().last_read+1;
result = (x <= context.msgbase.last_msg) ? context.getMessagePtr(x).date : '';
var x = context.newMsgs();
result = x.length ? x.shift().date : '';
break;
case 'msg_area_msgunread_page':
@@ -190,8 +191,8 @@ function atcode(field,length,pad,context) {
break;
}
var x = context.getUserStats().last_read+1;
return (x <= context.msgbase.last_msg) ? context.getMessagePage(x) : null;
var x = context.newMsgs();
return x.length ? context.getMessagePage(x.shift().number) : null;
// First unread message to me
case 'msg_area_msgotome_date':
@@ -200,7 +201,7 @@ function atcode(field,length,pad,context) {
break;
}
var x = context.newMsgs();
var x = context.newMsgsToMe();
result = x.length ? x.shift().date : '';
break;
@@ -211,7 +212,7 @@ function atcode(field,length,pad,context) {
break;
}
var x = context.newMsgs();
var x = context.newMsgsToMe();
return x.length ? context.getMessagePage(x.shift().number) : null;
// Count of unread messages