]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/ircbot.rb
better failure to connect behaviour
[user/henk/code/ruby/rbot.git] / lib / rbot / ircbot.rb
index 1374929dce1f02cb97f944f9917c03a9eeb896d4..2443ec95d7ae0865423a2b4a4117245c55cb77ea 100644 (file)
@@ -51,9 +51,6 @@ class IrcBot
   # bot's Language data
   attr_reader :lang
 
-  # bot's configured addressing prefixes
-  attr_reader :addressing_prefixes
-
   # channel info for channels the bot is in
   attr_reader :channels
 
@@ -330,10 +327,10 @@ class IrcBot
   # begin event handling loop
   def mainloop
     while true
+      begin
       connect
       @timer.start
       
-      begin
         while true
           if @socket.select
             break unless reply = @socket.gets
@@ -355,6 +352,7 @@ class IrcBot
       end
       
       puts "disconnected"
+      @last_ping = nil
       @channels.clear
       @socket.clearq
       
@@ -568,6 +566,7 @@ class IrcBot
   # we'll ping the server every 30 seconds or so, and expect a response
   # before the next one come around..
   def start_server_pings
+    @last_ping = nil
     # stop existing timers if running
     unless @ping_timer.nil?
       @timer.remove @ping_timer
@@ -593,6 +592,7 @@ class IrcBot
           rescue
             debug "couldn't shutdown connection (already shutdown?)"
           end
+          @last_ping = nil
         end
       end
     }