From 411dd8af42b75666cd1cccfbf3e94104a0c51652 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Mon, 31 Aug 2015 12:35:08 +0000 Subject: [PATCH] bugfixes and polish --- lib/ui.js | 9 ++++----- telecommander.js | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/ui.js b/lib/ui.js index b9e28ce..2d9da7a 100644 --- a/lib/ui.js +++ b/lib/ui.js @@ -65,19 +65,18 @@ module.exports = function(data){ // Function to create a log box data.mkBox = function(label){ - var box = blessed.log({ + return blessed.log({ keys: true, right: 0, label: label, width: '80%', + hidden: true, height: data.screen.height - data.cmdline.height, border: { type: 'line' }, scrollable: true, //draggable: true, style: data.defaultStyle }) - box.hide() - return box } // Command line prompt @@ -106,7 +105,7 @@ module.exports = function(data){ data.screen.on('resize',function(){ for(i in data.msgBox){ item = data.msgBox[i] - item.height = screen.height - data.cmdline.height + item.height = data.screen.height - data.cmdline.height } data.chats.height = data.screen.height - data.cmdline.height data.screen.render() @@ -186,7 +185,7 @@ module.exports = function(data){ // What happens when a different window is selected data.chats.on('select',function(selected){ - data.log('SELECT:',selected.content) + //data.log('SELECT:',selected.content) data.switchToBox(selected.content) data.screen.focusPush(data.cmdline) data.screen.render() diff --git a/telecommander.js b/telecommander.js index ee4d360..1ada7b3 100755 --- a/telecommander.js +++ b/telecommander.js @@ -152,7 +152,7 @@ data.connect = function(){ // Executed when connected and logged in data.whenReady = function(){ - data.log('READY!') + data.log('Connected') data.connected = true data.downloadData() } @@ -174,7 +174,7 @@ data.downloadData = function(){ data.client.updates.getState(function(astate){ data.updateState(astate) data.log(data.state.unreadCount,'unread messages') - data.log('Started receiving updates') + //data.log('Started receiving updates') // Can't use registerOnUpdates because it's apparently broken //client.registerOnUpdates(onUpdate) setTimeout(data.downloadUpdates,1000) @@ -263,9 +263,9 @@ data.appendMsg = function(msg,toBoxId,bare,smartmode){ if(msg.to_id.chat_id != undefined){ // Is a group param = data.getName(msg.to_id.chat_id,'group') - } else if(msg.from_id === msg.to_id.user_id || msg.from_id != user.id){ + } else if(msg.from_id === msg.to_id.user_id || msg.from_id != data.user.id){ param = data.getName(msg.from_id,'user') - } else if(msg.to_id.user_id != undefined && msg.to_id.user_id != user.id) { + } else if(msg.to_id.user_id != undefined && msg.to_id.user_id != data.user.id) { // don't forget dat .user_id! don't need it in from_id... param = data.getName(msg.to_id.user_id,'user') }