diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-28 17:11:39 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-28 17:11:39 +0000 |
commit | c76db2ff694d65e4391b7ec6d59c58aa0330cefe (patch) | |
tree | 4803b2c9815752b890a93dd12e4e259b0e0062b1 | |
parent | 696efbfb6ad3f40c313c17b22041e12c3196a7e9 (diff) |
ircbot: improve quit/restart message propagation
-rw-r--r-- | lib/rbot/ircbot.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 98562d27..87d4f3eb 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -1012,8 +1012,8 @@ class Bot sendq "TOPIC #{where} :#{topic}", where, 2 end - def disconnect(message = nil) - message = @lang.get("quit") if (message.nil? || message.empty?) + def disconnect(message=nil) + message = @lang.get("quit") if (!message || message.empty?) if @socket.connected? debug "Clearing socket" @socket.clearq @@ -1033,9 +1033,9 @@ class Bot end # disconnect from the server and cleanup all plugins and modules - def shutdown(message = nil) + def shutdown(message=nil) @quit_mutex.synchronize do - debug "Shutting down:" + debug "Shutting down: #{message}" ## No we don't restore them ... let everything run through # begin # trap("SIGINT", "DEFAULT") @@ -1045,7 +1045,7 @@ class Bot # debug "failed to restore signals: #{e.inspect}\nProbably running on windows?" # end debug "\tdisconnecting..." - disconnect + disconnect(message) debug "\tsaving ..." save debug "\tcleaning up ..." @@ -1073,9 +1073,9 @@ class Bot end # totally shutdown and respawn the bot - def restart(message = false) - msg = message ? message : "restarting, back in #{@config['server.reconnect_wait']}..." - shutdown(msg) + def restart(message=nil) + message = "restarting, back in #{@config['server.reconnect_wait']}..." if (!message || message.empty?) + shutdown(message) sleep @config['server.reconnect_wait'] begin # now we re-exec |