Try to catch system errors, return page links directly, change calculation of new messages

This commit is contained in:
Deon George 2022-05-06 15:32:35 +10:00
parent 874a7ee302
commit 912841b7d8
5 changed files with 945 additions and 917 deletions

View File

@ -44,6 +44,7 @@ function FrameAnsi() {
this.settings.USER_CREATE_ERROR = '\1n\1h\1RERROR CREATING USER, PLEASE TRY AGAIN *00';
this.settings.LOGIN_ERROR = '\1n\1h\1RERROR LOGGING IN, PLEASE TRY AGAIN *00';
this.settings.CANCEL_MSG = '\1n\1h\1GPRESS 2 TO CANCEL';
this.settings.SYS_ERROR = '\1n\1h\1RSYSTEM ERROR DETECTED - TRY AGAIN OR TELL US *08';
/**
* Set the attribute at the current position

View File

@ -45,22 +45,23 @@ function FrameViewdata() {
this.settings.ERR_NOT_IMPLEMENTED = ascii(27)+'ANOT IMPLEMENTED YET?';
this.settings.ERR_ROUTE = ascii(27)+'GMISTAKE?'+ascii(27)+'BTRY AGAIN OR TELL US ON *08';
this.settings.ERR_METHOD_NOT_EXIST = ascii(27)+'GMISTAKE?'+ascii(27)+'BTRY AGAIN OR TELL US ON *08';
this.settings.ACCESS_DENIED = ascii(27)+'ACCESS DENIED.';
this.settings.ALREADY_MEMBER = ascii(27)+'AALREADY MEMBER OF CUG'
this.settings.INACTIVITY = ascii(27)+'AINACTIVITY ALERT, DISCONNECT PENDING...';
this.settings.ACCESS_DENIED = ascii(27)+'AACCESS DENIED.';
this.settings.ALREADY_MEMBER = ascii(27)+'AALREADY MEMBER OF CUG'
this.settings.INACTIVITY = ascii(27)+'AINACTIVITY ALERT, DISCONNECT PENDING...';
this.settings.INACTIVE = ascii(27)+'AINACTIVITY DISCONNECT';
this.settings.NOACTION = ascii(27)+'ANO ACTION PERFORMED';
this.settings.BASESTAR = ascii(27)+'B*';
this.settings.INVALID_CODE = ascii(27)+'AINVAID CODE, PLEASE TRY AGAIN *00';
this.settings.TOKEN_EMAIL = ascii(27)+'ATOKEN EMAILED TO YOU...';
this.settings.TOKEN_SENT = ascii(27)+'ATOKEN SENT, PLEASE ENTER TOKEN';
this.settings.TOKEN_SENT = ascii(27)+'ATOKEN SENT, PLEASE ENTER TOKEN';
this.settings.INVALID_EMAIL = ascii(27)+'AINVAID EMAIL, PLEASE TRY AGAIN *00';
this.settings.INVALID_UID = ascii(27)+'AINVAID USER ID, PLEASE TRY AGAIN *00';
this.settings.CANNOT_SEND_TOKEN = ascii(27)+'ACANNOT SEND VALIDATION CODE, PLEASE TRY AGAIN *00';
this.settings.USER_EXISTS = ascii(27)+'AERROR USER EXISTS, PLEASE TRY AGAIN *00';
this.settings.USER_CREATE_ERROR = ascii(27)+'AERROR CREATING USER, PLEASE TRY AGAIN *00';
this.settings.LOGIN_ERROR = ascii(27)+'AERROR LOGGING IN, PLEASE TRY AGAIN *00';
this.settings.CANCEL_MSG = ascii(27)+'BPRESS 2 TO CANCEL';
this.settings.CANCEL_MSG = ascii(27)+'BPRESS 2 TO CANCEL';
this.settings.SYS_ERROR = ascii(27)+'ASYSTEM ERROR, TRY AGAIN OR TELL US ON *08';
var blp=0; // Length of data on the bottom line

View File

@ -153,8 +153,7 @@ function atcode(field,length,pad,context) {
var x = context.msgbase.first_msg || 1;
result = x ? context.getMessagePage(x) : null;
break;
return x ? context.getMessagePage(x) : null;
// Newest message in msgarea
case 'msg_area_msgnewest_date':
@ -172,8 +171,7 @@ function atcode(field,length,pad,context) {
break;
}
result = context.msgbase.last_msg ? context.getMessagePage(context.msgbase.last_msg) : null;
break;
return context.msgbase.last_msg ? context.getMessagePage(context.msgbase.last_msg) : null;
// First unread message
case 'msg_area_msgunread_date':
@ -193,8 +191,7 @@ function atcode(field,length,pad,context) {
}
var x = context.getUserStats().last_read+1;
result = (x <= context.msgbase.last_msg) ? context.getMessagePage(x) : null;
break;
return (x <= context.msgbase.last_msg) ? context.getMessagePage(x) : null;
// First unread message to me
case 'msg_area_msgotome_date':
@ -215,8 +212,7 @@ function atcode(field,length,pad,context) {
}
var x = context.newMsgs();
result = x.length ? context.getMessagePage(x.shift().number) : null;
break;
return x.length ? context.getMessagePage(x.shift().number) : null;
// Count of unread messages
case 'msg_area_new':
@ -225,7 +221,7 @@ function atcode(field,length,pad,context) {
break;
}
result = ''+(context.msgbase.last_msg-context.getUserStats().last_read);
result = ''+context.newMsgs().length;
break;
// Count of unread messages to me
@ -235,7 +231,7 @@ function atcode(field,length,pad,context) {
break;
}
result = ''+context.newMsgs().length;
result = ''+context.newMsgsToMe().length;
break;
// Is this message area in my new scan list

View File

@ -160,13 +160,36 @@ function MsgArea() {
}
/**
* New Messages for the logged in user
* Unread messages
*
* @returns {*[]}
*/
MsgArea.prototype.newMsgs = function() {
var msgs = [];
var stats = this.getUserStats();
//log(LOG_DEBUG,'Users scan pointer: '+JSON.stringify(stats.scan_ptr));
for(var x in this.headers) {
// Advance past our last scan_ptr
if (x <= stats.last_read)
continue;
msgs.push(this.headers[x]);
write(); // @todo This is needed for this to work?
}
return msgs;
}
/**
* New Messages for the logged in user
*/
MsgArea.prototype.newMsgsToMe = function() {
var msgs = [];
var stats = this.getUserStats();
//log(LOG_DEBUG,'Users scan pointer: '+JSON.stringify(stats.scan_ptr));
for(var x in this.headers) {
// Advance past our last scan_ptr
if (x <= stats.scan_ptr)

1809
main.js

File diff suppressed because it is too large Load Diff