Try to catch system errors, return page links directly, change calculation of new messages
This commit is contained in:
parent
874a7ee302
commit
912841b7d8
@ -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
|
||||
|
@ -45,7 +45,7 @@ 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.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';
|
||||
@ -61,6 +61,7 @@ function FrameViewdata() {
|
||||
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.SYS_ERROR = ascii(27)+'ASYSTEM ERROR, TRY AGAIN OR TELL US ON *08';
|
||||
|
||||
var blp=0; // Length of data on the bottom line
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
7
main.js
7
main.js
@ -121,6 +121,7 @@ while(bbs.online) {
|
||||
const viewdata = (client.socket.local_port === 516);
|
||||
|
||||
while (action !== ACTION_TERMINATE && action !== ACTION_EXIT) {
|
||||
try {
|
||||
bbs.nodesync(); // @todo Stop the display of telegrams
|
||||
|
||||
/* The current input character */
|
||||
@ -1164,6 +1165,12 @@ while(bbs.online) {
|
||||
break;
|
||||
}
|
||||
log(LOG_DEBUG,'ACTION END: ['+read+']');
|
||||
|
||||
} catch (e) {
|
||||
log(LOG_ERROR,JSON.stringify(e));
|
||||
fo.sendBaseline('SYS_ERROR',false);
|
||||
mode = action = false;
|
||||
}
|
||||
}
|
||||
|
||||
log(LOG_DEBUG,'- FINISHED');
|
||||
|
Loading…
Reference in New Issue
Block a user