diff --git a/core/door.js b/core/door.js index 14c02264..e75db66c 100644 --- a/core/door.js +++ b/core/door.js @@ -5,7 +5,7 @@ var spawn = require('child_process').spawn; var events = require('events'); var _ = require('lodash'); -var pty = require('pty'); +var pty = require('pty.js'); exports.Door = Door; diff --git a/core/message_area.js b/core/message_area.js index f9612b14..93dd584a 100644 --- a/core/message_area.js +++ b/core/message_area.js @@ -75,6 +75,12 @@ function changeCurrentArea(client, areaId, cb) { } ], function complete(err) { + if(!err) { + client.log.info( { areaId : areaId }, 'Current message area changed'); + } else { + client.log.warn( { areaId : areaId, error : err.message }, 'Could not change message area'); + } + cb(err); } ); diff --git a/mods/menu.json b/mods/menu.json index d0f6ded7..18ea93a5 100644 --- a/mods/menu.json +++ b/mods/menu.json @@ -301,7 +301,13 @@ "action" : "@method:changeArea" } ] - } + }, + "actionKeys" : [ // :TODO: Need better name + { + "keys" : [ "escape" ], + "action" : "@menu:messageArea" + } + ] } } } diff --git a/mods/msg_area_list.js b/mods/msg_area_list.js index 50d4fc33..1643825f 100644 --- a/mods/msg_area_list.js +++ b/mods/msg_area_list.js @@ -37,7 +37,15 @@ function MessageAreaListModule(options) { if(1 === formData.submitId) { var areaId = self.messageAreas[formData.value.area].areaId; messageArea.changeCurrentArea(self.client, areaId, function areaChanged(err) { - self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); + if(err) { + self.client.term.write('\nCannot change area: ' + err.message + '\n'); + + setTimeout(function timeout() { + self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); + }, 1000); + } else { + self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); + } }); } } @@ -61,8 +69,6 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) { var self = this; var vc = self.viewControllers.areaList = new ViewController( { client : self.client } ); - //var messageAreas = []; - async.series( [ function callParentMciReady(callback) { @@ -81,14 +87,6 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) { callback(err); }); }, - /* - function fetchAreaData(callback) { - messageArea.getAvailableMessageAreas(function fetched(err, areas) { - messageAreas = areas; - callback(err); - }); - }, - */ function populateAreaListView(callback) { var areaListView = vc.getView(1); @@ -99,8 +97,6 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) { areaList.push(strUtil.format(self.entryFormat, msgArea)); }); - console.log(areaList) - areaListView.setItems(areaList); areaListView.redraw(); } diff --git a/package.json b/package.json index ad3ea3f5..8f6b9f8f 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "node-uuid" : "1.4.x", "moment" : "2.10.x", "gaze" : "0.5.x", - "mkdirp" : "0.5.x" + "mkdirp" : "0.5.x", + "pty.js" : "0.2.x" }, "engine" : "node >= 0.12.2" } \ No newline at end of file