<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>specs/queue_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -9,9 +9,8 @@ module Isaac
   #   Isaac.execute do
   #     msg 'harryjr', 'you're awesome'
   #   end
-  def self.execute(&amp;block)
-    # add params?
-    app.execute(&amp;block)
+  def self.execute(params={}, &amp;block)
+    app.execute(params, &amp;block)
   end
 
   Config = Struct.new(:nick, :server, :port, :username, :realname)
@@ -67,7 +66,8 @@ module Isaac
     #       # Execute this if you try to send a message to a non-existing nick/channel.
     #     end
     def on(type, match=nil, &amp;block)
-      @events[type] &lt;&lt; Event.new(match, block)
+      @events[type] &lt;&lt; e = Event.new(match, block)
+      return e
     end
 
     def execute(params={}, &amp;block) #:nodoc:
@@ -75,7 +75,6 @@ module Isaac
       @queue &lt;&lt; event.invoke(params)
     end
 
-    private
     def event(type, matcher)
       @events[type].detect {|e| matcher =~ e.match}
     end
@@ -85,10 +84,12 @@ module Isaac
         puts &quot;Connecting to #{@config.server} at port #{@config.port}&quot;
         @irc = TCPSocket.open(@config.server, @config.port)
         puts &quot;Connection established.&quot;
+
         @queue = Queue.new(@irc)
         @queue &lt;&lt; &quot;NICK #{@config.nick}&quot;
         @queue &lt;&lt; &quot;USER #{@config.username} foobar foobar :#{@config.realname}&quot;
         @queue &lt;&lt; @events[:connect].first.invoke if @events[:connect].first
+
         while line = @irc.gets
           handle line
         end
@@ -124,7 +125,7 @@ module Isaac
       end
     end
   end
-
+  
   class Queue #:nodoc:
     attr_accessor :lock
     def initialize(socket)
@@ -137,7 +138,8 @@ module Isaac
 
     # I luvz Rubyz
     def &lt;&lt; (msg)
-      (@queue &lt;&lt; msg).flatten!
+      # .flatten! returns nill if no modifications were made, thus we do this. 
+      @queue = (@queue &lt;&lt; msg).flatten
     end
 
     # To prevent excess flood no more than 1472 bytes will be sent to the</diff>
      <filename>lib/isaac.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,10 @@ require '../lib/isaac.rb'
 include Isaac
 
 describe Application do
+  before do
+    @app = Isaac.app
+  end
+
   it 'configures' do
     config do |c|
       c.nick = &quot;awesome&quot;
@@ -22,4 +26,9 @@ describe Application do
     context.rain_check(&quot;date&quot;)
     context.commands.should eql([&quot;PRIVMSG miss_teen :can i take a rain check on the date?&quot;])
   end
+
+  it 'creates events' do
+    event = on(:channel, /matchy/) { msg channel, 'oh, matching!' }
+    @app.event(:channel, 'this should be matchy!!').should eql(event)
+  end
 end</diff>
      <filename>specs/application_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5d90e76a4813d41b138b57e279949abdfdb9587b</id>
    </parent>
  </parents>
  <author>
    <name>ichverstehe</name>
    <email>ichverstehe@gmail.com</email>
  </author>
  <url>http://github.com/sr/isaac/commit/afeb9c65e7cf765895e7e66c67ea515f42ed404a</url>
  <id>afeb9c65e7cf765895e7e66c67ea515f42ed404a</id>
  <committed-date>2008-10-07T09:00:45-07:00</committed-date>
  <authored-date>2008-10-07T08:49:50-07:00</authored-date>
  <message>minor changes, fixes, spec.</message>
  <tree>09ea0d3bc764ebcf308f2206c097cd113d2d2413</tree>
  <committer>
    <name>ichverstehe</name>
    <email>ichverstehe@gmail.com</email>
  </committer>
</commit>
