muby 0.7.10 → 0.7.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ require 'ncurses'
4
4
  module Muby
5
5
 
6
6
 
7
- VERSION = "0.7.10" unless defined?(Muby::VERSION)
7
+ VERSION = "0.7.11" unless defined?(Muby::VERSION)
8
8
 
9
9
  #
10
10
  # The class that encapsulates all configuration.
@@ -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
 
@@ -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, and all values to matching keys will be executed with three parameters: the input window, the output window and the match object.
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.
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.10
4
+ version: 0.7.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Kihlgren, Sy Ali