Class: Tox::Client
- Inherits:
-
Object
show all
- Defined in:
- lib/tox/client.rb
Overview
Defined Under Namespace
Classes: BadSavedataError, Error
Instance Method Summary
collapse
Constructor Details
#initialize(options = Tox::Options.new) ⇒ Client
Returns a new instance of Client.
8
9
10
11
12
13
14
15
16
|
# File 'lib/tox/client.rb', line 8
def initialize(options = Tox::Options.new)
@on_friend_request = nil
@on_friend_message = nil
@on_friend_name_change = nil
@on_friend_status_message_change = nil
@on_friend_status_change = nil
initialize_with options
end
|
Instance Method Details
#bootstrap_official ⇒ Object
18
19
20
21
22
|
# File 'lib/tox/client.rb', line 18
def bootstrap_official
Status.new.udp_nodes.each do |node|
bootstrap node.resolv_ipv4, node.port, node.public_key
end
end
|
#friend(number) ⇒ Object
30
31
32
|
# File 'lib/tox/client.rb', line 30
def friend(number)
Friend.new self, number
end
|
#friend!(number) ⇒ Object
34
35
36
|
# File 'lib/tox/client.rb', line 34
def friend!(number)
Friend.new(self, number).exist!
end
|
#friends ⇒ Object
24
25
26
27
28
|
# File 'lib/tox/client.rb', line 24
def friends
friend_numbers.map do |friend_number|
friend friend_number
end
end
|
#on_friend_message(&block) ⇒ Object
42
43
44
|
# File 'lib/tox/client.rb', line 42
def on_friend_message(&block)
@on_friend_message = block
end
|
#on_friend_name_change(&block) ⇒ Object
46
47
48
|
# File 'lib/tox/client.rb', line 46
def on_friend_name_change(&block)
@on_friend_name_change = block
end
|
#on_friend_request(&block) ⇒ Object
38
39
40
|
# File 'lib/tox/client.rb', line 38
def on_friend_request(&block)
@on_friend_request = block
end
|
#on_friend_status_change(&block) ⇒ Object
54
55
56
|
# File 'lib/tox/client.rb', line 54
def on_friend_status_change(&block)
@on_friend_status_change = block
end
|
#on_friend_status_message_change(&block) ⇒ Object
50
51
52
|
# File 'lib/tox/client.rb', line 50
def on_friend_status_message_change(&block)
@on_friend_status_message_change = block
end
|