teamspeak-ruby 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/teamspeak-ruby/client.rb +30 -18
- data/lib/teamspeak-ruby/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5293306a7bf6d98ffcd5bd9b7147d8d336636d1
|
4
|
+
data.tar.gz: 4f587d29775bd5d368c85529f965d3785da38049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9ce3a70837d0945f47ac485386ad64ccc0a125705871b0bcac7ebf44775fa52b68082bd4be7c2a18efc11567d27156718dbba035c37a890f0b175752ae2be30
|
7
|
+
data.tar.gz: a1c1aed6910489fd9fab73ba9f9fbc32c407cf71bdd1d72182fdac4ef70870da0d82a72312fb8a6292c71f8c3c43fc150191b6faa1611f02f4d289bfacde3bed
|
@@ -51,27 +51,12 @@ module Teamspeak
|
|
51
51
|
def login(user, pass)
|
52
52
|
command('login', {'client_login_name' => user, 'client_login_password' => pass})
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
# Sends command to the TeamSpeak 3 server and returns the response
|
56
56
|
#
|
57
57
|
# command('use', {'sid' => 1}, '-away')
|
58
58
|
def command(cmd, params = {}, options = '')
|
59
|
-
|
60
|
-
@flood_current += 1
|
61
|
-
|
62
|
-
flood_time_reached = Time.now - @flood_timer < @flood_time
|
63
|
-
flood_limit_reached = @flood_current == @flood_limit
|
64
|
-
|
65
|
-
if flood_time_reached && flood_limit_reached
|
66
|
-
sleep(@flood_time)
|
67
|
-
end
|
68
|
-
|
69
|
-
if flood_limit_reached
|
70
|
-
# Reset flood protection
|
71
|
-
@flood_timer = Time.now
|
72
|
-
@flood_current = 0
|
73
|
-
end
|
74
|
-
end
|
59
|
+
flood_control
|
75
60
|
|
76
61
|
out = ''
|
77
62
|
response = ''
|
@@ -86,6 +71,11 @@ module Teamspeak
|
|
86
71
|
|
87
72
|
@sock.puts out
|
88
73
|
|
74
|
+
if cmd == 'servernotifyregister'
|
75
|
+
2.times {response += @sock.gets}
|
76
|
+
return parse_response(response)
|
77
|
+
end
|
78
|
+
|
89
79
|
while true
|
90
80
|
response += @sock.gets
|
91
81
|
|
@@ -173,6 +163,28 @@ module Teamspeak
|
|
173
163
|
raise ServerError.new(id, message) unless id == 0
|
174
164
|
end
|
175
165
|
|
176
|
-
|
166
|
+
def flood_control
|
167
|
+
if @flood_protection
|
168
|
+
@flood_current += 1
|
169
|
+
|
170
|
+
flood_time_reached = Time.now - @flood_timer < @flood_time
|
171
|
+
flood_limit_reached = @flood_current == @flood_limit
|
172
|
+
|
173
|
+
if flood_time_reached && flood_limit_reached
|
174
|
+
sleep(@flood_time)
|
175
|
+
end
|
176
|
+
|
177
|
+
if flood_limit_reached
|
178
|
+
# Reset flood protection
|
179
|
+
@flood_timer = Time.now
|
180
|
+
@flood_current = 0
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
private(
|
186
|
+
:parse_response, :decode_param, :encode_param,
|
187
|
+
:check_response_error, :flood_control
|
188
|
+
)
|
177
189
|
end
|
178
190
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamspeak-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Harrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: justin@pyrohail.com
|
@@ -45,4 +45,3 @@ signing_key:
|
|
45
45
|
specification_version: 4
|
46
46
|
summary: Ruby interface for TeamSpeak 3's server query api.
|
47
47
|
test_files: []
|
48
|
-
has_rdoc:
|