<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,6 +4,10 @@ PostInstall.txt
 README.rdoc
 Rakefile
 lib/xmppbot.rb
+lib/xmppbot/bot.rb
+lib/xmppbot/message.rb
+lib/xmppbot/other.rb
+lib/xmppbot/presence.rb
 script/console
 script/destroy
 script/generate</diff>
      <filename>Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,56 @@
+Example of use :
 
-For more information on xmppbot, see http://xmppbot.rubyforge.org
+require 'xmppbot'
+
+class Johnny5 &lt; XMPPBot::Bot  
+  def connect
+    super do |status|
+      if status == XMPPBot::ConnectionEvents::CONNECT
+        announce_presence
+        register_callbacks
+      else
+        disconnect
+      end
+    end  
+  end
+  
+  def register_callbacks
+    on_presence_received do |pres|      
+      puts &quot;#{pres.from} is now #{pres.to_s}&quot; unless pres.to_s.strip == 
+&quot;&quot;
+    end
+      
+    on_message_received do |msg|
+      if msg.body == &quot;exit&quot;
+        disconnect
+      else
+        stanza=XMPPBot::Message.new
+        stanza.to=msg.from
+        stanza.body=&quot;You said : #{msg.body}&quot;
+        send(stanza)
+      end
+    end  
+  end
+end
+
+@bot = Johnny5.new
+@bot.jid = &quot;cripes@jaim.at&quot;
+@bot.password = &quot;cripes&quot;
+@bot.log_level = XMPPBot::Logging::INFO
+@bot.auto_accept_subscriptions = true
+
+@bot.connect
+
+#We pause the execution of the current thread to prevent the program 
+from exiting
+Thread.stop
 
-NOTE: Change this information in PostInstall.txt 
-You can also delete it if you don't want it.
+#Once the parsing thread exits, execution resumes here
+puts &quot;Connection terminated&quot;
 
 
+
+
+
+
+For more information on xmppbot, see http://xmppbot.rubyforge.org</diff>
      <filename>PostInstall.txt</filename>
    </modified>
    <modified>
      <diff>@@ -23,7 +23,6 @@ Warning : StropheRuby is very experimental at the moment. It is definitely NOT r
 How to use it :
   
 require 'xmppbot'
-
 def register_callbacks
   @bot.on_presence_received do |pres|
     puts &quot;#{pres.from} is now #{pres.to_s}&quot;</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -6,8 +6,7 @@
 
 module XMPPBot
   class Bot
-    attr_accessor :jid, :password, :log_level, :auto_accept_subscriptions
-      
+    attr_accessor :jid, :password, :log_level, :auto_accept_subscriptions      
     #connect, authenticate and start event loop
     def connect
       StropheRuby::EventLoop.prepare
@@ -30,15 +29,13 @@ module XMPPBot
       #start the event loop in a separate thread      
       Thread.new do
         Thread.current.abort_on_exception = true
-        
-        #StropheRuby::EventLoop.run(@ctx)
-        
+                
         @ctx.loop_status=1
         while @ctx.loop_status == 1
           StropheRuby::EventLoop.run_once(@ctx,1)
         end
       
-        #shutdown down strophe and wake up the calling thread 
+        #shutdown down strophe and wake up the calling thread
         StropheRuby::EventLoop.shutdown
         main_thread.wakeup
       end</diff>
      <filename>lib/xmppbot/bot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,8 +37,16 @@ module XMPPBot
       self.stanza.type=type
     end
   
+    def show
+      s=self.stanza.child_by_name(&quot;show&quot;)
+      s ? s.text : nil
+    end
+    
+    #returns the show (away, dnd, chat,xa). if there is none, returns the type which can be : unavailable
+    #subscribe,subscribed,unsubscribe,unsubscribed,probe or error.
     def to_s
-      self.stanza.child_by_name(&quot;show&quot;).text rescue &quot;available&quot;
+      res = self.show
+      res ? res : self.type.to_s
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/xmppbot/presence.rb</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>pkg/xmppbot-0.0.1.gem</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>pkg/xmppbot-0.0.1.tgz</filename>
    </modified>
    <modified>
      <diff>@@ -4,6 +4,10 @@ PostInstall.txt
 README.rdoc
 Rakefile
 lib/xmppbot.rb
+lib/xmppbot/bot.rb
+lib/xmppbot/message.rb
+lib/xmppbot/other.rb
+lib/xmppbot/presence.rb
 script/console
 script/destroy
 script/generate</diff>
      <filename>pkg/xmppbot-0.0.1/Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,56 @@
+Example of use :
 
-For more information on xmppbot, see http://xmppbot.rubyforge.org
+require 'xmppbot'
+
+class Johnny5 &lt; XMPPBot::Bot  
+  def connect
+    super do |status|
+      if status == XMPPBot::ConnectionEvents::CONNECT
+        announce_presence
+        register_callbacks
+      else
+        disconnect
+      end
+    end  
+  end
+  
+  def register_callbacks
+    on_presence_received do |pres|      
+      puts &quot;#{pres.from} is now #{pres.to_s}&quot; unless pres.to_s.strip == 
+&quot;&quot;
+    end
+      
+    on_message_received do |msg|
+      if msg.body == &quot;exit&quot;
+        disconnect
+      else
+        stanza=XMPPBot::Message.new
+        stanza.to=msg.from
+        stanza.body=&quot;You said : #{msg.body}&quot;
+        send(stanza)
+      end
+    end  
+  end
+end
+
+@bot = Johnny5.new
+@bot.jid = &quot;cripes@jaim.at&quot;
+@bot.password = &quot;cripes&quot;
+@bot.log_level = XMPPBot::Logging::INFO
+@bot.auto_accept_subscriptions = true
+
+@bot.connect
+
+#We pause the execution of the current thread to prevent the program 
+from exiting
+Thread.stop
 
-NOTE: Change this information in PostInstall.txt 
-You can also delete it if you don't want it.
+#Once the parsing thread exits, execution resumes here
+puts &quot;Connection terminated&quot;
 
 
+
+
+
+
+For more information on xmppbot, see http://xmppbot.rubyforge.org</diff>
      <filename>pkg/xmppbot-0.0.1/PostInstall.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,26 +1,68 @@
 = xmppbot
 
-* FIX (url)
-
 == DESCRIPTION:
 
-FIX (describe your package)
+Simple implementation on top of StropheRuby(http://github.com/flamontagne/strophe_ruby/).
+It's for those who want to build simple xmpp bots quickly. It features only the essential :
+- auto accept subscriptions
+- callback for received messages
+- callback for received presences
+- a method to send messages and presences
+- That's it
+
+Warning : StropheRuby is very experimental at the moment. It is definitely NOT ready for production!
 
 == FEATURES/PROBLEMS:
 
-* FIX (list of features or problems)
+- Only tested under Debian
+- No TLS support for now. It will work once TLS with OpenSSL is working in Strophe (http://code.stanziq.com/strophe)
+
 
 == SYNOPSIS:
 
-  FIX (code sample of usage)
+How to use it :
+  
+require 'xmppbot'
+def register_callbacks
+  @bot.on_presence_received do |pres|
+    puts &quot;#{pres.from} is now #{pres.to_s}&quot;
+  end
+    
+  @bot.on_message_received do |msg|
+    if msg.body == &quot;exit&quot;
+      @bot.disconnect
+    else
+      stanza=XMPPBot::Message.new
+      stanza.to=msg.from
+      stanza.body=&quot;You said : #{msg.body}&quot;
+      @bot.send(stanza)
+    end
+  end
+end
+
+
+@bot=XMPPBot::Bot.new
+@bot.jid=&quot;bot@example.com&quot;
+@bot.password=&quot;secret&quot;
+@bot.log_level = XMPPBot::Logging::DEBUG
+@bot.auto_accept_subscriptions = true
+
+@bot.connect do |status|
+  if status == XMPPBot::ConnectionEvents::CONNECT
+    @bot.announce_presence
+    register_callbacks
+  else
+    @bot.disconnect
+  end
+end  
 
 == REQUIREMENTS:
 
-* FIX (list of requirements)
+* Compile and install StropheRuby (http://github.com/flamontagne/stropheruby)
 
 == INSTALL:
 
-* FIX (sudo gem install, anything else)
+* For now you can install the GEM in the pkg directory. Remember that you need StropheRuby to use XMPPBot ()
 
 == LICENSE:
 
@@ -45,4 +87,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</diff>
      <filename>pkg/xmppbot-0.0.1/README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -2,213 +2,10 @@ $:.unshift(File.dirname(__FILE__)) unless
    $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
 
 require 'strophe_ruby'
+require 'xmppbot/bot'
+require 'xmppbot/message'
+require 'xmppbot/presence'
+require 'xmppbot/other'
 module XMPPBot
-VERSION = '0.0.1'
-    class Bot
-        attr_accessor :jid, :password, :log_level, :auto_accept_subscriptions
-      
-        def connect
-            StropheRuby::EventLoop.prepare
-            @ctx=StropheRuby::Context.new(@log_level)
-            @conn=StropheRuby::Connection.new(@ctx)
-            @conn.jid = @jid
-            @conn.password= @password
-            @conn.connect do |status|
-                accept_subscriptions if auto_accept_subscriptions
-                keep_alive
-                yield(status)
-            end
-
-            #FIXME: The following call works perfectly... but when you try stopping the program with CTRL-C, it produces a XMPP event watcher error.
-            #See the run_once method in strophe/src/event.c for details. For now I do my own control loop and call run_once manually
-            #Thread.new {EventLoop.run(@ctx)}
-
-            return if @ctx.loop_status != 0
-            @ctx.loop_status = 1        
-            th= Thread.new do
-                Thread.current.abort_on_exception = true    
-                while (@ctx.loop_status == 1) do 
-                    StropheRuby::EventLoop.run_once(@ctx, 1)
-                end
-                Thread.main.wakeup
-            end            
-        end
-
-        def keep_alive
-            Thread.new do
-                loop do
-                    difference = (@last_send || Time.now) + 90 - Time.now
-                    if difference &lt;= 0
-                        self.announce_presence
-                        sleep(90)
-                    else
-                        sleep(difference)
-                    end
-                end
-            end
-        end
-
-        def accept_subscriptions    
-            self.on_presence_received do |pres|
-                if pres.stanza.type == &quot;subscribe&quot;
-                    stanza = StropheRuby::Stanza.new
-                    stanza.name = &quot;presence&quot;
-                    stanza.type = &quot;subscribed&quot;
-                    stanza.set_attribute(&quot;to&quot;,pres.stanza.attribute(&quot;from&quot;))
-                    self.send_stanza(stanza)
-                    stanza.release
-                    
-                    stanza = StropheRuby::Stanza.new
-                    stanza.name = &quot;presence&quot;
-                    stanza.type = &quot;subscribe&quot;
-                    stanza.set_attribute(&quot;to&quot;,pres.stanza.attribute(&quot;from&quot;))
-                    self.send_stanza(stanza)                    
-                    stanza.release
-                end
-            end
-        end
-
-        def disconnect    
-            StropheRuby::EventLoop.stop(@ctx)
-            @conn.release
-            @ctx.free
-            StropheRuby::EventLoop.shutdown        
-        end
-        
-        def send(obj)
-            if obj.respond_to?(:stanza)
-                send_stanza(obj.stanza)      
-            else
-                raise(&quot;native Stanza object has not been set&quot;)
-            end
-        end
-        
-        def send_stanza(stanza)
-            @conn.send(stanza)
-            @last_send=Time.now
-        end
-
-        def announce_presence
-            presence = StropheRuby::Stanza.new
-            presence.name=&quot;presence&quot;
-            presence.set_attribute(&quot;show&quot;, &quot;available&quot;)
-            self.send_stanza(presence)
-            presence.release
-        end
-
-        def on_message_received
-            @conn.add_handler(&quot;message&quot;) do |stanza|
-                yield(Message.new(stanza)) if Message.new(stanza).body
-            end
-        end
-
-        def on_presence_received
-            @conn.add_handler(&quot;presence&quot;) do |stanza|
-                yield(Presence.new(stanza))
-            end
-        end        
-    end
-
-    class Presence
-        attr_reader :stanza  
-    
-        def initialize(stanza=nil)
-            if stanza
-                @stanza=stanza
-            else
-                @stanza = StropheRuby::Stanza.new
-            end
-        end
-        
-        def from
-            self.stanza.attribute(&quot;from&quot;)
-        end
-
-        def to
-            self.stanza.attribute(&quot;to&quot;)
-        end
-        
-        def to=(to)
-            self.stanza.set_attribute(&quot;to&quot;,to)
-        end
-        
-        def type
-            self.stanza.type
-        end
-        
-        def type=(type)
-            self.stanza.type=type
-        end
-        
-        def to_s
-            self.stanza.child_by_name(&quot;show&quot;).text rescue &quot;available&quot;
-        end
-    end
-    
-    class Message
-        attr_reader :stanza
-        def initialize(stanza=nil)
-            if stanza
-                @stanza=stanza
-            else
-                @stanza=StropheRuby::Stanza.new
-                @stanza.name=&quot;message&quot;
-                @stanza.type=&quot;chat&quot;
-            end
-        end
-    
-        def from
-            self.stanza.attribute(&quot;from&quot;) rescue nil
-        end
-        def from=(value)
-            self.stanza.set_attribute(&quot;from&quot;,value.to_s)
-        end
-        
-        def type
-            self.stanza.type
-        end
-        
-        def type=(type)
-            self.stanza.type=type
-        end
-    
-    
-        def body
-            self.stanza.child_by_name(&quot;body&quot;).text rescue nil
-        end
-    
-        def body=(str)
-            children = self.stanza.children
-    
-            if children      
-                children.children.text = str
-            else  
-                body_stanza = StropheRuby::Stanza.new
-                body_stanza.name=&quot;body&quot;
-    
-                text_stanza = StropheRuby::Stanza.new
-                text_stanza.text=str
-    
-                body_stanza.add_child(text_stanza)    
-                self.stanza.add_child(body_stanza)
-            end
-        end
-    
-        def to=(to)
-            self.stanza.set_attribute(&quot;to&quot;,to)
-        end    
-    end
-    
-    class ConnectionEvents
-        CONNECT = StropheRuby::ConnectionEvents::CONNECT
-        DISCONNECT = StropheRuby::ConnectionEvents::DISCONNECT
-        FAIL = StropheRuby::ConnectionEvents::FAIL
-    end
-    
-    class Logging
-        INFO = StropheRuby::Logging::INFO
-        WARN = StropheRuby::Logging::WARN
-        ERROR = StropheRuby::Logging::ERROR
-        DEBUG = StropheRuby::Logging::DEBUG
-    end
+  VERSION = '0.0.1'  
 end
\ No newline at end of file</diff>
      <filename>pkg/xmppbot-0.0.1/lib/xmppbot.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bc52302b283117b1b7bcc6b9048f880cf948b2bc</id>
    </parent>
  </parents>
  <author>
    <name>Frank</name>
    <email>flamontagne@gmail.com</email>
  </author>
  <url>http://github.com/flamontagne/xmppbot/commit/0074558befe70b1f47d7420d5bfd69ee602bed7c</url>
  <id>0074558befe70b1f47d7420d5bfd69ee602bed7c</id>
  <committed-date>2008-12-12T10:47:32-08:00</committed-date>
  <authored-date>2008-12-12T10:47:32-08:00</authored-date>
  <message>put example of use in  PostInstall</message>
  <tree>eba0475b0ab72db4921a5775982511d64f63b9b5</tree>
  <committer>
    <name>Frank</name>
    <email>flamontagne@gmail.com</email>
  </committer>
</commit>
