Class: TeamSpeak3::Client
- Inherits:
-
Object
- Object
- TeamSpeak3::Client
- Defined in:
- lib/client.rb
Instance Attribute Summary collapse
-
#away_message ⇒ Object
readonly
Returns the value of attribute away_message.
-
#channel_group_id ⇒ Object
readonly
Returns the value of attribute channel_group_id.
-
#channel_group_inherited_channel_id ⇒ Object
readonly
Returns the value of attribute channel_group_inherited_channel_id.
-
#channel_id ⇒ Object
readonly
Returns the value of attribute channel_id.
-
#client_database_id ⇒ Object
readonly
Returns the value of attribute client_database_id.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#icon_id ⇒ Object
readonly
Returns the value of attribute icon_id.
-
#idle_time ⇒ Object
readonly
Returns the value of attribute idle_time.
-
#last_connected ⇒ Object
readonly
Returns the value of attribute last_connected.
-
#nickname ⇒ Object
readonly
Returns the value of attribute nickname.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#servergroups ⇒ Object
readonly
Returns the value of attribute servergroups.
-
#talk_power ⇒ Object
readonly
Returns the value of attribute talk_power.
-
#type_id ⇒ Object
readonly
Returns the value of attribute type_id.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#virtual_server ⇒ Object
readonly
Returns the value of attribute virtual_server.
Instance Method Summary collapse
- #away? ⇒ Boolean
- #channel_commander? ⇒ Boolean
- #flag?(flag) ⇒ Boolean
-
#initialize(virtual_server, params) ⇒ Client
constructor
A new instance of Client.
- #input_hardware? ⇒ Boolean
- #input_muted? ⇒ Boolean
- #kick_from_channel!(reason = nil) ⇒ Object
- #kick_from_server!(reason = nil) ⇒ Object
- #output_hardware? ⇒ Boolean
- #output_muted? ⇒ Boolean
- #priority_speaker? ⇒ Boolean
- #recording? ⇒ Boolean
- #send_message(message) ⇒ Object
- #talker? ⇒ Boolean
- #talking? ⇒ Boolean
Constructor Details
#initialize(virtual_server, params) ⇒ Client
Returns a new instance of Client.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/client.rb', line 25 def initialize(virtual_server, params) @virtual_server = virtual_server @client_id = params[:clid].to_i @client_database_id = params[:client_database_id].to_i @channel_id = params[:cid].to_i @nickname = params[:client_nickname] @type_id = params[:client_type].to_i @away = params[:client_away].to_i == 1 @away_message = params[:client_away_message] @flags = [] @flags << :talking if params[:client_flag_talking].to_i == 1 @input_muted = true if params[:client_input_muted].to_i == 1 @output_muted = true if params[:client_output_muted].to_i == 1 @input_hardware = true if params[:client_input_hardware].to_i == 1 @output_hardware = true if params[:client_output_hardware].to_i == 1 @talk_power = params[:client_talk_power].to_i @talker = params[:client_is_talker].to_i == 1 @priority_speaker = params[:client_is_priority_speaker].to_i == 1 @recording = params[:client_is_recording].to_i == 1 @channel_commander = params[:client_is_channel_commander].to_i == 1 @uid = params[:client_unique_identifier] @version = params[:client_version] @platform = params[:client_platform] @servergroups = params[:client_servergroups].split(',').map {|group| group.to_i} @channel_group_id = params[:client_channel_group_id].to_i @channel_group_inherited_channel_id = params[:client_channel_group_inherited_channel_id].to_i @idle_time = Time.now - params[:client_idle_time].to_i @created_at = Time.at(params[:client_created].to_i) @last_connected = Time.at(params[:client_lastconnected].to_i) @icon_id = params[:client_icon_id].to_i @country = params[:client_country] end |
Instance Attribute Details
#away_message ⇒ Object (readonly)
Returns the value of attribute away_message.
10 11 12 |
# File 'lib/client.rb', line 10 def @away_message end |
#channel_group_id ⇒ Object (readonly)
Returns the value of attribute channel_group_id.
17 18 19 |
# File 'lib/client.rb', line 17 def channel_group_id @channel_group_id end |
#channel_group_inherited_channel_id ⇒ Object (readonly)
Returns the value of attribute channel_group_inherited_channel_id.
18 19 20 |
# File 'lib/client.rb', line 18 def channel_group_inherited_channel_id @channel_group_inherited_channel_id end |
#channel_id ⇒ Object (readonly)
Returns the value of attribute channel_id.
7 8 9 |
# File 'lib/client.rb', line 7 def channel_id @channel_id end |
#client_database_id ⇒ Object (readonly)
Returns the value of attribute client_database_id.
6 7 8 |
# File 'lib/client.rb', line 6 def client_database_id @client_database_id end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/client.rb', line 5 def client_id @client_id end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
23 24 25 |
# File 'lib/client.rb', line 23 def country @country end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
20 21 22 |
# File 'lib/client.rb', line 20 def created_at @created_at end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
11 12 13 |
# File 'lib/client.rb', line 11 def flags @flags end |
#icon_id ⇒ Object (readonly)
Returns the value of attribute icon_id.
22 23 24 |
# File 'lib/client.rb', line 22 def icon_id @icon_id end |
#idle_time ⇒ Object (readonly)
Returns the value of attribute idle_time.
19 20 21 |
# File 'lib/client.rb', line 19 def idle_time @idle_time end |
#last_connected ⇒ Object (readonly)
Returns the value of attribute last_connected.
21 22 23 |
# File 'lib/client.rb', line 21 def last_connected @last_connected end |
#nickname ⇒ Object (readonly)
Returns the value of attribute nickname.
8 9 10 |
# File 'lib/client.rb', line 8 def nickname @nickname end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
15 16 17 |
# File 'lib/client.rb', line 15 def platform @platform end |
#servergroups ⇒ Object (readonly)
Returns the value of attribute servergroups.
16 17 18 |
# File 'lib/client.rb', line 16 def servergroups @servergroups end |
#talk_power ⇒ Object (readonly)
Returns the value of attribute talk_power.
12 13 14 |
# File 'lib/client.rb', line 12 def talk_power @talk_power end |
#type_id ⇒ Object (readonly)
Returns the value of attribute type_id.
9 10 11 |
# File 'lib/client.rb', line 9 def type_id @type_id end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
13 14 15 |
# File 'lib/client.rb', line 13 def uid @uid end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
14 15 16 |
# File 'lib/client.rb', line 14 def version @version end |
#virtual_server ⇒ Object (readonly)
Returns the value of attribute virtual_server.
3 4 5 |
# File 'lib/client.rb', line 3 def virtual_server @virtual_server end |
Instance Method Details
#away? ⇒ Boolean
68 69 70 |
# File 'lib/client.rb', line 68 def away? @away end |
#channel_commander? ⇒ Boolean
72 73 74 |
# File 'lib/client.rb', line 72 def channel_commander? @channel_commander end |
#flag?(flag) ⇒ Boolean
76 77 78 |
# File 'lib/client.rb', line 76 def flag?(flag) @flags.include?(flag) end |
#input_hardware? ⇒ Boolean
80 81 82 |
# File 'lib/client.rb', line 80 def input_hardware? @input_hardware end |
#input_muted? ⇒ Boolean
84 85 86 |
# File 'lib/client.rb', line 84 def input_muted? @input_muted end |
#kick_from_channel!(reason = nil) ⇒ Object
93 94 95 96 |
# File 'lib/client.rb', line 93 def kick_from_channel!(reason = nil) virtual_server.server.kick_client!(client_id, :channel, reason) true end |
#kick_from_server!(reason = nil) ⇒ Object
88 89 90 91 |
# File 'lib/client.rb', line 88 def kick_from_server!(reason = nil) virtual_server.server.kick_client!(client_id, :server, reason) true end |
#output_hardware? ⇒ Boolean
98 99 100 |
# File 'lib/client.rb', line 98 def output_hardware? @output_hardware end |
#output_muted? ⇒ Boolean
102 103 104 |
# File 'lib/client.rb', line 102 def output_muted? @output_muted end |
#priority_speaker? ⇒ Boolean
106 107 108 |
# File 'lib/client.rb', line 106 def priority_speaker? @priority_speaker end |
#recording? ⇒ Boolean
110 111 112 |
# File 'lib/client.rb', line 110 def recording? @recording end |
#send_message(message) ⇒ Object
114 115 116 |
# File 'lib/client.rb', line 114 def () virtual_server.server.(self, ) end |
#talker? ⇒ Boolean
118 119 120 |
# File 'lib/client.rb', line 118 def talker? @talker end |
#talking? ⇒ Boolean
122 123 124 |
# File 'lib/client.rb', line 122 def talking? flag?(:talking) end |