* Filter Private from area lists/etc.

* Clean up CPU string for MCI display
This commit is contained in:
Bryan Ashby 2015-10-17 21:39:54 -06:00
parent 65d7186a86
commit 52dee0a401
5 changed files with 27 additions and 3 deletions

View File

@ -16,21 +16,38 @@ exports.changeMessageArea = changeMessageArea;
exports.getMessageListForArea = getMessageListForArea;
exports.gotoMsgAreaFSEModuleForMessage = gotoMsgAreaFSEModuleForMessage;
function getAvailableMessageAreas() {
function getAvailableMessageAreas(options) {
// 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() {
//
// Return first non-private/etc. area name. This will be from config.hjson
//
return getAvailableMessageAreas()[0];
/*
var avail = getAvailableMessageAreas();
for(var i = 0; i < avail.length; ++i) {
if(Message.WellKnownAreaNames.Private !== avail[i].name) {
return avail[i];
}
}
*/
}
function getMessageAreaByName(areaName) {

View File

@ -91,7 +91,12 @@ function getPredefinedMCIValue(client, code) {
},
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

View File

@ -104,6 +104,8 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
var areaListItems = [];
var focusListItems = [];
// :TODO: use _.map() here
for(var i = 0; i < self.messageAreas.length; ++i) {
areaListItems.push(listFormat.format(
{ index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } )

Binary file not shown.