muby 0.7.5 → 0.7.6
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/muby/configuration.rb +1 -1
- data/lib/muby/connection.rb +58 -14
- metadata +2 -2
data/lib/muby/configuration.rb
CHANGED
data/lib/muby/connection.rb
CHANGED
@@ -150,15 +150,68 @@ class Muby::Connection
|
|
150
150
|
c
|
151
151
|
end
|
152
152
|
|
153
|
+
TELNET_COMMANDS = {
|
154
|
+
240 => :end_of_sub_negotiation,
|
155
|
+
241 => :noop,
|
156
|
+
242 => :data_mark,
|
157
|
+
243 => :break,
|
158
|
+
249 => :go_ahead,
|
159
|
+
250 => :sub_negotiation,
|
160
|
+
251 => :will,
|
161
|
+
252 => :wont,
|
162
|
+
253 => :do,
|
163
|
+
254 => :dont,
|
164
|
+
255 => :iac
|
165
|
+
}
|
166
|
+
|
167
|
+
#
|
168
|
+
# This is not telnet command OR ansi, lets treat it as nice MUD text!
|
169
|
+
#
|
170
|
+
# Debug about it, add it to match buffer, add it to show buffer and show if we want to show.
|
171
|
+
# Then check it for triggers.
|
172
|
+
#
|
173
|
+
def handle_regular_character(c)
|
174
|
+
@matchBuffer = @matchBuffer + c.chr
|
175
|
+
append_show_buffer(c.chr)
|
176
|
+
manage_buffers(c)
|
177
|
+
end
|
178
|
+
|
153
179
|
def handle(c)
|
154
180
|
#
|
155
181
|
# The telnet support (just so we dont explode or something)
|
156
182
|
#
|
157
|
-
# We are just plain ignoring it atm.
|
183
|
+
# We are just plain ignoring most of it atm.
|
158
184
|
#
|
159
|
-
if c ==
|
160
|
-
c = getc
|
161
|
-
|
185
|
+
if TELNET_COMMANDS[c] == :iac # this is an "interpret as command"
|
186
|
+
c = getc
|
187
|
+
if (next_command = TELNET_COMMANDS[c]) == :iac # if the next one as well is an iac, we actually want to display a 255
|
188
|
+
handle_regular_character(c)
|
189
|
+
else
|
190
|
+
case next_command
|
191
|
+
when :do # ignore the option negotiation
|
192
|
+
c = getc
|
193
|
+
when :dont # ignore the option negotiation
|
194
|
+
c = getc
|
195
|
+
when :will # ignore the option negotiation
|
196
|
+
c = getc
|
197
|
+
when :wont # ignore the option negotiation
|
198
|
+
c = getc
|
199
|
+
when :noop # waf?
|
200
|
+
# do nothing
|
201
|
+
when :data_mark
|
202
|
+
warn("Got a data_mark (TELNET protocol) which I don't know how to handle. Expect strange behaviour...")
|
203
|
+
when :break
|
204
|
+
warn("Got a break (TELNET protocol) which I don't know how to handle. Expect strange behaviour...")
|
205
|
+
when :go_ahead
|
206
|
+
display_buffer # on a go ahead the server obviously wants us to display the @displayBuffer regardless of our conf.flush setting
|
207
|
+
when :sub_negotiation # we just skip ahead to the end of the sub negotiation
|
208
|
+
while TELNET_COMMANDS[c] != :end_of_sub_negotiation
|
209
|
+
c = getc
|
210
|
+
end
|
211
|
+
else
|
212
|
+
warn("Got an unknown TELNET command (#{c.chr}) which I don't know how to handle. Expect strange behaviour...")
|
213
|
+
end
|
214
|
+
end
|
162
215
|
elsif c == 27 # escape char! this is probably some ANSI color or shite
|
163
216
|
c = getc
|
164
217
|
if c.chr == "[" # this is an ansi-something that is more than one char long
|
@@ -233,15 +286,7 @@ class Muby::Connection
|
|
233
286
|
end
|
234
287
|
end
|
235
288
|
elsif !conf.broken_keycodes.include?(c)
|
236
|
-
|
237
|
-
# This is not telnet command OR ansi, lets treat it as nice MUD text!
|
238
|
-
#
|
239
|
-
# Debug about it, add it to match buffer, add it to show buffer and show if we want to show.
|
240
|
-
# Then check it for triggers.
|
241
|
-
#
|
242
|
-
@matchBuffer = @matchBuffer + c.chr
|
243
|
-
append_show_buffer(c.chr)
|
244
|
-
manage_buffers(c)
|
289
|
+
handle_regular_character(c)
|
245
290
|
end
|
246
291
|
end
|
247
292
|
|
@@ -283,7 +328,6 @@ class Muby::Connection
|
|
283
328
|
trigger(@matchBuffer, conf.remote_character_triggers, true)
|
284
329
|
if c == 10 || conf.flush
|
285
330
|
display_buffer
|
286
|
-
@showBuffer = []
|
287
331
|
if c == 10
|
288
332
|
trigger(@matchBuffer, conf.remote_triggers, false)
|
289
333
|
@matchBuffer = ""
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Kihlgren, Sy Ali
|
@@ -9,7 +9,7 @@ autorequire: muby
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02-
|
12
|
+
date: 2008-02-27 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|