* Filter Private from area lists/etc.
* Clean up CPU string for MCI display
This commit is contained in:
parent
65d7186a86
commit
52dee0a401
|
@ -16,21 +16,38 @@ exports.changeMessageArea = changeMessageArea;
|
||||||
exports.getMessageListForArea = getMessageListForArea;
|
exports.getMessageListForArea = getMessageListForArea;
|
||||||
exports.gotoMsgAreaFSEModuleForMessage = gotoMsgAreaFSEModuleForMessage;
|
exports.gotoMsgAreaFSEModuleForMessage = gotoMsgAreaFSEModuleForMessage;
|
||||||
|
|
||||||
function getAvailableMessageAreas() {
|
function getAvailableMessageAreas(options) {
|
||||||
// example: [ { "name" : "local_music", "desc" : "Music Discussion", "groups" : ["somegroup"] }, ... ]
|
// example: [ { "name" : "local_music", "desc" : "Music Discussion", "groups" : ["somegroup"] }, ... ]
|
||||||
return Config.messages.areas;
|
options = options || {};
|
||||||
|
|
||||||
|
var areas = Config.messages.areas;
|
||||||
|
var avail = [];
|
||||||
|
for(var i = 0; i < areas.length; ++i) {
|
||||||
|
if(true !== options.includePrivate &&
|
||||||
|
Message.WellKnownAreaNames.Private === areas[i].name)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
avail.push(areas[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return avail;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultMessageArea() {
|
function getDefaultMessageArea() {
|
||||||
//
|
//
|
||||||
// Return first non-private/etc. area name. This will be from config.hjson
|
// Return first non-private/etc. area name. This will be from config.hjson
|
||||||
//
|
//
|
||||||
|
return getAvailableMessageAreas()[0];
|
||||||
|
/*
|
||||||
var avail = getAvailableMessageAreas();
|
var avail = getAvailableMessageAreas();
|
||||||
for(var i = 0; i < avail.length; ++i) {
|
for(var i = 0; i < avail.length; ++i) {
|
||||||
if(Message.WellKnownAreaNames.Private !== avail[i].name) {
|
if(Message.WellKnownAreaNames.Private !== avail[i].name) {
|
||||||
return avail[i];
|
return avail[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessageAreaByName(areaName) {
|
function getMessageAreaByName(areaName) {
|
||||||
|
|
|
@ -91,7 +91,12 @@ function getPredefinedMCIValue(client, code) {
|
||||||
},
|
},
|
||||||
|
|
||||||
OA : function systemArchitecture() { return os.arch(); },
|
OA : function systemArchitecture() { return os.arch(); },
|
||||||
SC : function systemCpuModel() { return os.cpus()[0].model; },
|
SC : function systemCpuModel() {
|
||||||
|
//
|
||||||
|
// Clean up CPU strings a bit for better display
|
||||||
|
//
|
||||||
|
return os.cpus()[0].model.replace(/\s+(?= )|\(R\)|\(TM\)|CPU/g, '');
|
||||||
|
},
|
||||||
|
|
||||||
// :TODO: cpu load average (over N seconds): http://stackoverflow.com/questions/9565912/convert-the-output-of-os-cpus-in-node-js-to-percentage
|
// :TODO: cpu load average (over N seconds): http://stackoverflow.com/questions/9565912/convert-the-output-of-os-cpus-in-node-js-to-percentage
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,8 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
|
|
||||||
var areaListItems = [];
|
var areaListItems = [];
|
||||||
var focusListItems = [];
|
var focusListItems = [];
|
||||||
|
|
||||||
|
// :TODO: use _.map() here
|
||||||
for(var i = 0; i < self.messageAreas.length; ++i) {
|
for(var i = 0; i < self.messageAreas.length; ++i) {
|
||||||
areaListItems.push(listFormat.format(
|
areaListItems.push(listFormat.format(
|
||||||
{ index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } )
|
{ index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } )
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue