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:
parent
5be530cb17
commit
411dd8af42
@ -65,19 +65,18 @@ module.exports = function(data){
|
|||||||
|
|
||||||
// Function to create a log box
|
// Function to create a log box
|
||||||
data.mkBox = function(label){
|
data.mkBox = function(label){
|
||||||
var box = blessed.log({
|
return blessed.log({
|
||||||
keys: true,
|
keys: true,
|
||||||
right: 0,
|
right: 0,
|
||||||
label: label,
|
label: label,
|
||||||
width: '80%',
|
width: '80%',
|
||||||
|
hidden: true,
|
||||||
height: data.screen.height - data.cmdline.height,
|
height: data.screen.height - data.cmdline.height,
|
||||||
border: { type: 'line' },
|
border: { type: 'line' },
|
||||||
scrollable: true,
|
scrollable: true,
|
||||||
//draggable: true,
|
//draggable: true,
|
||||||
style: data.defaultStyle
|
style: data.defaultStyle
|
||||||
})
|
})
|
||||||
box.hide()
|
|
||||||
return box
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command line prompt
|
// Command line prompt
|
||||||
@ -106,7 +105,7 @@ module.exports = function(data){
|
|||||||
data.screen.on('resize',function(){
|
data.screen.on('resize',function(){
|
||||||
for(i in data.msgBox){
|
for(i in data.msgBox){
|
||||||
item = data.msgBox[i]
|
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.chats.height = data.screen.height - data.cmdline.height
|
||||||
data.screen.render()
|
data.screen.render()
|
||||||
@ -186,7 +185,7 @@ module.exports = function(data){
|
|||||||
|
|
||||||
// What happens when a different window is selected
|
// What happens when a different window is selected
|
||||||
data.chats.on('select',function(selected){
|
data.chats.on('select',function(selected){
|
||||||
data.log('SELECT:',selected.content)
|
//data.log('SELECT:',selected.content)
|
||||||
data.switchToBox(selected.content)
|
data.switchToBox(selected.content)
|
||||||
data.screen.focusPush(data.cmdline)
|
data.screen.focusPush(data.cmdline)
|
||||||
data.screen.render()
|
data.screen.render()
|
||||||
|
@ -152,7 +152,7 @@ data.connect = function(){
|
|||||||
|
|
||||||
// Executed when connected and logged in
|
// Executed when connected and logged in
|
||||||
data.whenReady = function(){
|
data.whenReady = function(){
|
||||||
data.log('READY!')
|
data.log('Connected')
|
||||||
data.connected = true
|
data.connected = true
|
||||||
data.downloadData()
|
data.downloadData()
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ data.downloadData = function(){
|
|||||||
data.client.updates.getState(function(astate){
|
data.client.updates.getState(function(astate){
|
||||||
data.updateState(astate)
|
data.updateState(astate)
|
||||||
data.log(data.state.unreadCount,'unread messages')
|
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
|
// Can't use registerOnUpdates because it's apparently broken
|
||||||
//client.registerOnUpdates(onUpdate)
|
//client.registerOnUpdates(onUpdate)
|
||||||
setTimeout(data.downloadUpdates,1000)
|
setTimeout(data.downloadUpdates,1000)
|
||||||
@ -263,9 +263,9 @@ data.appendMsg = function(msg,toBoxId,bare,smartmode){
|
|||||||
if(msg.to_id.chat_id != undefined){
|
if(msg.to_id.chat_id != undefined){
|
||||||
// Is a group
|
// Is a group
|
||||||
param = data.getName(msg.to_id.chat_id,'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')
|
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...
|
// don't forget dat .user_id! don't need it in from_id...
|
||||||
param = data.getName(msg.to_id.user_id,'user')
|
param = data.getName(msg.to_id.user_id,'user')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user