1
0
mirror of https://github.com/fazo96/telecommander.git synced 2025-01-10 11:34:20 +01:00

bugfixes and polish

This commit is contained in:
Enrico Fasoli 2015-08-31 12:35:08 +00:00
parent 5be530cb17
commit 411dd8af42
2 changed files with 8 additions and 9 deletions

View File

@ -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()

View File

@ -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')
}