accutronic 0.2.3 → 0.2.4
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.
- data/lib/accu-net.rb +24 -2
- metadata +2 -2
data/lib/accu-net.rb
CHANGED
@@ -48,7 +48,8 @@ class ServerWrapper
|
|
48
48
|
# and yields to a passed block (if any).
|
49
49
|
def listen()
|
50
50
|
msg = @server.gets.chomp
|
51
|
-
yield msg
|
51
|
+
yield msg if block_given?
|
52
|
+
return msg
|
52
53
|
end
|
53
54
|
|
54
55
|
# Listens for multiple lines, appends them together
|
@@ -71,6 +72,16 @@ class ServerWrapper
|
|
71
72
|
end
|
72
73
|
}
|
73
74
|
end
|
75
|
+
|
76
|
+
# Listen for an encrypted connection.
|
77
|
+
def listen_encrypted()
|
78
|
+
if listen_code == 3 then
|
79
|
+
password,source = EncryptDecrypt.decrypt(@password,((listen_lines).join),@mode)
|
80
|
+
return source
|
81
|
+
else
|
82
|
+
raise "Sent code was not 3!"
|
83
|
+
end
|
84
|
+
end
|
74
85
|
|
75
86
|
# Sends a plaintext message.
|
76
87
|
def send(text)
|
@@ -130,7 +141,8 @@ class ClientWrapper
|
|
130
141
|
# and yields to a passed block (if any).
|
131
142
|
def listen()
|
132
143
|
msg = @client.gets.chomp
|
133
|
-
yield msg
|
144
|
+
yield msg if block_given?
|
145
|
+
return msg
|
134
146
|
end
|
135
147
|
|
136
148
|
# Listens for multiple lines, appends them together
|
@@ -153,6 +165,16 @@ class ClientWrapper
|
|
153
165
|
end
|
154
166
|
}
|
155
167
|
end
|
168
|
+
|
169
|
+
# Listen for an encrypted connection.
|
170
|
+
def listen_encrypted()
|
171
|
+
if listen_code == 3 then
|
172
|
+
password,source = EncryptDecrypt.decrypt(@password,((listen_lines).join),@mode)
|
173
|
+
return source
|
174
|
+
else
|
175
|
+
raise "Sent code was not 3!"
|
176
|
+
end
|
177
|
+
end
|
156
178
|
|
157
179
|
# Sends a plaintext message.
|
158
180
|
def send(text)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: accutronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: abc
|