<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,7 +16,7 @@ Jabber::Simple - An extremely easy-to-use Jabber client library.
 
   # Get presence updates from your friends, and print them out to the console:
   # (admittedly, this one needs some work)
-  im.presence_updates { |update|
+  im.presence_updates do |update|
     from     = update[0].jid.strip.to_s
     status   = update[2].status
     presence = update[2].show
@@ -64,8 +64,8 @@ that is familiar to users of traditional instant messenger clients.
 = Copyright
 
 Jabber::Simple - An extremely easy-to-use Jabber client library.
-Copyright 2006-2008 Blaine Cook &lt;romeda@gmail.com&gt;. PubSub by
-Pablo Lorenzoni &lt;pablo@propus.com.br&gt;
+Copyright 2006-2008 Blaine Cook &lt;romeda@gmail.com&gt;.
+Various other contributions by several authors. Check AUTHORS file.
 
 Jabber::Simple is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,10 @@
 
 require 'rake/testtask'
 require 'rake/rdoctask'
-require 'rcov/rcovtask'
+begin
+  require 'rcov/rcovtask'
+rescue LoadError
+end
 
 desc &quot;Package Gem&quot;
 task :package do
@@ -41,7 +44,9 @@ Rake::RDocTask.new do |rdoc|
   rdoc.title = &quot;Jabber::Simple&quot;
 end
 
-Rcov::RcovTask.new do |t|
-  t.test_files = FileList['test/**/test*.rb'] 
-  t.rcov_opts &lt;&lt; &quot;--sort coverage&quot;
+if defined?(Rcov)
+  Rcov::RcovTask.new do |t|
+    t.test_files = FileList['test/**/test*.rb'] 
+    t.rcov_opts &lt;&lt; &quot;--sort coverage&quot;
+  end
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -96,9 +96,11 @@ module Jabber
     # passed in as the status_message argument.
     #
     # jabber = Jabber::Simple.new(&quot;me@example.com&quot;, &quot;password&quot;, &quot;Chat with me - Please!&quot;)
-    def initialize(jid, password, status = nil, status_message = &quot;Available&quot;)
+    def initialize(jid, password, status = nil, status_message = &quot;Available&quot;, host = nil, port=5222)
       @jid = jid
       @password = password
+      @host = host
+      @port = port
       @disconnected = false
       status(status, status_message)
       start_deferred_delivery_thread
@@ -252,6 +254,43 @@ module Jabber
       !queue(:received_messages).empty?
     end
 
+    # Returns an array of iq stanzas received since the last time
+    # iq_stanzas was called. There will be no stanzas in this queue
+    # unless you have enabled capture of &lt;iq/&gt; stanzas using the
+    # capture_iq_stanzas! method. Passing a block will yield each stanza in
+    # turn, allowing you to break part-way through processing (especially
+    # useful when your message handling code is not thread-safe (e.g.,
+    # ActiveRecord).
+    #
+    # e.g.:
+    #
+    #   jabber.capture_iq_stanzas!
+    #   jabber.iq_stanzas do |iq|
+    #     puts &quot;Received iq stanza from #{iq.from}&quot;
+    #   end
+    def iq_stanza(&amp;block)
+      dequeue(:iq_stanzas, &amp;block)
+    end
+
+    # Returns true if there are unprocessed iq stanzas waiting in the
+    # queue, false otherwise.
+    def iq_stanzas?
+      !queue(:iq_stanzas).empty?
+    end
+
+    # Tell the client to capture (or stop capturing) &lt;iq/&gt; stanzas
+    # addressed to it.  When the client is initially started, this
+    # is false.
+    def capture_iq_stanzas!(capture=true)
+      @iq_mutex.synchronize { @capture_iq_stanzas = capture }
+    end
+    
+    # Returns true if iq stanzas will be captured in the queue, as
+    # they arrive, false otherwise.
+    def capture_iq_stanzas?
+      @capture_iq_stanzas
+    end
+
     # Returns an array of presence updates received since the last time
     # presence_updates was called. Passing a block will yield each update in
     # turn, allowing you to break part-way through processing (especially
@@ -319,7 +358,7 @@ module Jabber
     def subscription_requests(&amp;block)
       dequeue(:subscription_requests, &amp;block)
     end
- 
+
     # Returns true if auto-accept subscriptions (friend requests) is enabled
     # (default), false otherwise.
     def accept_subscriptions?
@@ -480,7 +519,7 @@ module Jabber
       # Connect
       jid = JID.new(@jid)
       my_client = Client.new(@jid)
-      my_client.connect
+      my_client.connect(@host, @port)
       my_client.auth(@password)
       self.client = my_client
 
@@ -522,13 +561,19 @@ module Jabber
         end
       end
 
+      @iq_mutex = Mutex.new
+      capture_iq_stanzas!(false)
+      client.add_iq_callback do |iq|
+        queue(:iq_messages) &lt;&lt; iq if capture_iq_stanzas?
+      end
+
       @presence_updates = {}
       @presence_mutex = Mutex.new
       roster.add_presence_callback do |roster_item, old_presence, new_presence|
         simple_jid = roster_item.jid.strip.to_s
         presence = case new_presence.type
-                   when nil: new_presence.show || :online
-                   when :unavailable: :unavailable
+                   when nil then new_presence.show || :online
+                   when :unavailable then :unavailable
                    else
                      nil
                    end</diff>
      <filename>lib/xmpp4r-simple.rb</filename>
    </modified>
    <modified>
      <diff>@@ -263,11 +263,19 @@ class JabberSimpleTest &lt; Test::Unit::TestCase
 
   def assert_before(seconds, &amp;block)
     error = nil
+
+    # This is for Ruby 1.9.1 compatibility
+    assertion_exception_class = begin
+      MiniTest::Assertion
+    rescue NameError
+      Test::Unit::AssertionFailedError
+    end
+
     begin
       Timeout::timeout(seconds) {
         begin
           yield
-        rescue =&gt; e
+        rescue assertion_exception_class =&gt; e
           error = e
           sleep 0.5
           retry</diff>
      <filename>test/test_xmpp4r_simple.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 Gem::Specification.new do |s| 
   s.add_dependency('xmpp4r', '&gt;= 0.3.2')
-  s.add_development_dependency('rake')
-  s.add_development_dependency('rcov')
+  # s.add_development_dependency('rake')
+  # s.add_development_dependency('rcov')
   s.name = &quot;xmpp4r-simple&quot; 
   s.version = &quot;0.8.8&quot; 
   s.author = &quot;Blaine Cook&quot; 
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
   EOF
   s.files = %w( test/test_xmpp4r_simple.rb lib/xmpp4r-simple.rb README COPYING CHANGELOG ) 
   s.require_path = &quot;lib&quot; 
-  s.test_files = Dir.glob(&quot;test/test_*.rb&quot;)
+  s.test_files = [&quot;test/test_xmpp4r_simple.rb&quot;]
   s.has_rdoc = true 
   s.extra_rdoc_files = [&quot;README&quot;, &quot;COPYING&quot;] 
   s.rubyforge_project = &quot;xmpp4r-simple&quot;</diff>
      <filename>xmpp4r-simple.gemspec</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d2d3df7e1319e34b49ecb4157979645870fece1d</id>
    </parent>
    <parent>
      <id>174f1a4814515672bb74c92ed7ba05db77210a15</id>
    </parent>
  </parents>
  <author>
    <name>Pablo Lorenzoni</name>
    <email>pablo@propus.com.br</email>
  </author>
  <url>http://github.com/spectra/xmpp4r-simple/commit/84c7388b7260276d2691222da151328a9dc4f2d0</url>
  <id>84c7388b7260276d2691222da151328a9dc4f2d0</id>
  <committed-date>2009-03-18T10:55:21-07:00</committed-date>
  <authored-date>2009-03-18T10:55:21-07:00</authored-date>
  <message>Merge branch 'integrate'</message>
  <tree>631e773b4e31ec3ff8b0ea329ef402a20a5db026</tree>
  <committer>
    <name>Pablo Lorenzoni</name>
    <email>pablo@propus.com.br</email>
  </committer>
</commit>
