muby 0.7.10 → 0.7.11
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 +4 -2
- data/lib/muby/help.rb +3 -1
- metadata +1 -1
data/lib/muby/configuration.rb
CHANGED
data/lib/muby/connection.rb
CHANGED
@@ -141,6 +141,7 @@ class Muby::Connection
|
|
141
141
|
# Remove the trigger regexp if it is broken.
|
142
142
|
#
|
143
143
|
def trigger(matchBuffer, hash, skip_used = true)
|
144
|
+
rval = true
|
144
145
|
hash.each do |key, value|
|
145
146
|
if skip_used && @used_triggers.include?(key)
|
146
147
|
trace("#{key.inspect} has already been matched on this line, skipping it")
|
@@ -150,7 +151,7 @@ class Muby::Connection
|
|
150
151
|
if match = matchBuffer.match(key)
|
151
152
|
trace(matchBuffer + " matches " + key.inspect + ": .call'ing Proc")
|
152
153
|
# Run the procedure associated with that trigger:
|
153
|
-
@inputWindow.execute(value, @inputWindow, @outputWindow, match)
|
154
|
+
rval &&= @inputWindow.execute(value, @inputWindow, @outputWindow, match)
|
154
155
|
@used_triggers[key] = true if skip_used
|
155
156
|
end
|
156
157
|
# If we received an error with the regular expression:
|
@@ -160,6 +161,7 @@ class Muby::Connection
|
|
160
161
|
end
|
161
162
|
end
|
162
163
|
end
|
164
|
+
return rval
|
163
165
|
end
|
164
166
|
|
165
167
|
def feed(s)
|
@@ -361,7 +363,7 @@ class Muby::Connection
|
|
361
363
|
end
|
362
364
|
|
363
365
|
def run_remote_triggers
|
364
|
-
trigger(@matchBuffer, conf.remote_triggers, false)
|
366
|
+
@showBuffer = [] unless trigger(@matchBuffer, conf.remote_triggers, false)
|
365
367
|
@used_triggers = {}
|
366
368
|
end
|
367
369
|
|
data/lib/muby/help.rb
CHANGED
@@ -58,7 +58,9 @@ A line matching an anti gag and a gag will also be shown.",
|
|
58
58
|
:connect_triggers => "The connect triggers. Code in this array will be run in order when a connection is made.",
|
59
59
|
:startup_triggers => "The startup triggers. Code in this array will be run in order after the windows have been properly initialized.",
|
60
60
|
:remote_triggers => 'The remote triggers.
|
61
|
-
Each line received from the server will be checked against all regular expression keys in this hash,
|
61
|
+
Each line received from the server will be checked against all regular expression keys in this hash,
|
62
|
+
and all values to matching keys will be executed with three parameters: the input window, the output window and the match object.
|
63
|
+
Only if the return value of this execution is not false will the line be shown to the user.
|
62
64
|
Example: conf.remote_triggers[/^You feel dazed$/] = Proc.new do |inwin, outwin, match| inwin.set_status_message("dazed") end',
|
63
65
|
:remote_character_triggers => 'The remote character triggers.
|
64
66
|
All input from the server is added to a buffer that is cleared on newline and each time a new character is added to that buffer the buffer will be checked against all the regular expression keys in the remote_character_triggers.
|