public
Rubygem
Description: irccat is like `cat`, but here, the STDOUT is an IRC channel.
Homepage: http://irccat.rubyforge.org/
Clone URL: git://github.com/webs/irccat.git
Click here to lend your support to: irccat and make a donation at www.pledgie.com !
added a trap for INT in the bot
webs (author)
Sun Feb 17 10:13:56 -0800 2008
commit  a847846f5a01ef4e5fe4ca9453f95fbc3d717a28
tree    62ef174c4f1c606de203fda6d403212b8f05900f
parent  604bb9a08153c4f10d3e0900e2a5235b4d32c416
...
63
64
65
66
 
67
...
63
64
65
 
66
67
0
@@ -63,4 +63,4 @@ Thread.new {
0
 Thread.new {
0
   @http = IrcCat::HttpServer.new(@bot, @config, @config['http']['host'], @config['http']['port'])
0
 } if @config['http']['enabled']
0
-@bot.run
0
+@bot.run
0
\ No newline at end of file
...
28
29
30
 
 
 
 
 
 
 
 
31
32
33
...
68
69
70
 
 
 
 
 
71
72
73
...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
...
76
77
78
79
80
81
82
83
84
85
86
0
@@ -28,6 +28,14 @@ class Bot
0
     @socket = TCPSocket.open(@host, @port)
0
     login
0
     
0
+ trap(:INT) {
0
+ puts "Bye bye."
0
+ self.sexit('God^WConsole killed me')
0
+ sleep 1
0
+ @socket.close
0
+ exit
0
+ }
0
+
0
     
0
     threads=[]
0
     
0
@@ -68,6 +76,11 @@ class Bot
0
     sendln "PRIVMSG #{chan} :#{msg}"
0
   end
0
   
0
+ # Send EXIT
0
+ def sexit(message='quit')
0
+ sendln("QUIT :#{message}")
0
+ end
0
+
0
   private
0
   
0
   # Sends a message to the server

Comments

    No one has commented yet.