Archived
1
0
Fork 0

Load friends for Tox client

This commit is contained in:
Braiden Vasco 2017-07-25 23:26:38 +00:00
parent 29f0a8287c
commit b09e43deb0

View file

@ -40,6 +40,8 @@ private
@tox_client = Tox::Client.new tox_options @tox_client = Tox::Client.new tox_options
on_friends_load @tox_client.friends
@tox_client.on_iteration do @tox_client.on_iteration do
after_iteration after_iteration
before_iteration before_iteration
@ -171,6 +173,21 @@ private
}.freeze }.freeze
end end
def on_friends_load(friends)
@state = state.merge(
sidebar: state[:sidebar].merge(
menu: state[:sidebar][:menu].merge(
items: friends.map do |friend|
{
name: friend.name.freeze,
online: friend.status == Tox::UserStatus::NONE,
}
end,
).freeze,
).freeze,
).freeze
end
def on_window_left def on_window_left
@state = state.merge( @state = state.merge(
focus: :sidebar, focus: :sidebar,