Enable msg_area_new to take a area tag as an argument
This commit is contained in:
parent
8e15c890a5
commit
71208075c3
@ -231,6 +231,11 @@ function atcode(field,length,pad,context) {
|
|||||||
|
|
||||||
// Count of unread messages
|
// Count of unread messages
|
||||||
case 'msg_area_new':
|
case 'msg_area_new':
|
||||||
|
if (args.length === 1) {
|
||||||
|
context = new MsgArea();
|
||||||
|
context.code = args[0];
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof context !== 'object') {
|
if (typeof context !== 'object') {
|
||||||
log(LOG_ERROR,'Unable to render ['+field+'], no context provided');
|
log(LOG_ERROR,'Unable to render ['+field+'], no context provided');
|
||||||
break;
|
break;
|
||||||
|
@ -61,15 +61,23 @@ function MsgArea() {
|
|||||||
set: function(code) {
|
set: function(code) {
|
||||||
this.msgbase = new MsgBase(code);
|
this.msgbase = new MsgBase(code);
|
||||||
|
|
||||||
if (! this.msgbase.open()) {
|
try {
|
||||||
writeln(code+' cannot be opened:'+this.msgbase.error);
|
if (this.msgbase.open()) {
|
||||||
exit(2);
|
// @todo If there are more than 10,000, take only the last 10,000.
|
||||||
|
this.headers = this.msgbase.get_all_msg_headers(false,false) || [];
|
||||||
|
this.msgbase.close();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log(LOG_ERROR,code+' cannot be opened:'+this.msgbase.error);
|
||||||
|
this.headers = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.headers = this.msgbase.get_all_msg_headers(false,false) || [];
|
} catch (e) {
|
||||||
// @todo If there are more than 10,000, take only the last 10,000.
|
log(LOG_ERROR,code+' cannot be opened:'+e.message);
|
||||||
|
this.headers = [];
|
||||||
|
}
|
||||||
|
|
||||||
this.msgbase.close();
|
log(LOG_DEBUG,'msgbase:'+JSON.stringify(this.msgbase));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -259,7 +267,7 @@ MsgArea.prototype.getMessagePage = function(number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MsgArea.prototype.getUserStats = function() {
|
MsgArea.prototype.getUserStats = function() {
|
||||||
return msg_area.grp_list[this.msgbase.cfg.grp_number].sub_list[msg_area.sub[this.msgbase.cfg.code].index];
|
return this.msgbase.cfg ? msg_area.grp_list[this.msgbase.cfg.grp_number].sub_list[msg_area.sub[this.msgbase.cfg.code].index] : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user