]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/ircbot.rb
ircbot: clean up ping timings on connect
[user/henk/code/ruby/rbot.git] / lib / rbot / ircbot.rb
index 35fc2dfd4ac128e548d0bb2ae42245048c2b950e..6c8d6332b38e16177709f0cd45655741909ee588 100644 (file)
@@ -211,11 +211,16 @@ class Bot
     @client.user
   end
 
-  # bot User in the client/server connection
+  # bot nick in the client/server connection
   def nick
     myself.nick
   end
 
+  # bot channels in the client/server connection
+  def channels
+    myself.channels
+  end
+
   # nick wanted by the bot. This defaults to the irc.nick config value,
   # but may be overridden by a manual !nick command
   def wanted_nick
@@ -463,11 +468,6 @@ class Bot
       exit 2
     end
 
-    # Time at which the last PING was sent
-    @last_ping = nil
-    # Time at which the last line was RECV'd from the server
-    @last_rec = nil
-
     @startup_time = Time.new
 
     begin
@@ -784,7 +784,7 @@ class Bot
       missing = Dir.chdir(template_dir) { Dir.glob('*/**') } - Dir.chdir(@botclass) { Dir.glob('*/**') }
       missing.map do |f|
         dest = File.join(@botclass, f)
-        FileUtils.mkdir_p(File.dirname dest)
+        FileUtils.mkdir_p(File.dirname(dest))
         FileUtils.cp File.join(template_dir, f), dest
       end
     else
@@ -901,6 +901,9 @@ class Bot
 
   # connect the bot to IRC
   def connect
+    # make sure we don't have any spurious ping checks running
+    # (and initialize the vars if this is the first time we connect)
+    stop_server_pings
     begin
       quit if $interrupted > 0
       @socket.connect