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
Search Repo:
Click here to lend your support to: irccat and make a donation at www.pledgie.com !
Add support for NickServ protected logins and privat channels
ivey (author)
Thu Mar 27 17:21:42 -0700 2008
commit  d92e4ed56832bc138d56854109947340fe90dcfc
tree    c0925b2e5a52a0c2084120003bf59c3599d2e6dc
parent  84d4b0d3b127fb8a9bdb091256b0828e68093bb2
...
55
56
57
58
 
59
60
61
...
55
56
57
 
58
59
60
61
0
@@ -55,7 +55,7 @@
0
 puts "irccat #{IrcCat::VERSION::STRING} (http://irccat.rubyforge.org/)"
0
 
0
 Thread.new {
0
- @bot = IrcCat::Bot.new(:host => @config['irc']['host'], :port => @config['irc']['port'], :nick => @config['irc']['nick'], :channel => @config['irc']['channel']'])
0
+ @bot = IrcCat::Bot.new(:host => @config['irc']['host'], :port => @config['irc']['port'], :nick => @config['irc']['nick'], :channel => @config['irc']['channel'], :nick_pass => @config['irc']['nick_pass'], :channel_pass => @config['irc']['channel_pass'])
0
 }
0
 Thread.new {
0
   @tcp = IrcCat::TcpServer.new(@bot, @config, @config['tcp']['host'], @config['tcp']['port'])
...
3
4
5
 
6
 
7
8
9
...
3
4
5
6
7
8
9
10
11
0
@@ -3,7 +3,9 @@
0
   host: 'irc.tty2.org'
0
   port: '6667'
0
   nick: irc_cat
0
+ nick_pass: foo
0
   channel: '#irc_cat'
0
+ channel_pass: bar
0
 
0
 # HTTP Server
0
 
...
6
7
8
9
 
10
11
12
13
...
106
107
108
109
 
110
111
112
113
114
 
115
116
117
...
119
120
121
 
 
 
 
122
123
124
...
6
7
8
 
9
10
11
12
13
...
106
107
108
 
109
110
111
112
113
 
114
115
116
117
...
119
120
121
122
123
124
125
126
127
128
0
@@ -6,7 +6,7 @@
0
 # The IRC bot
0
 class Bot
0
 
0
- attr_accessor :socket, :host, :port, :nick, :channel
0
+ attr_accessor :socket, :host, :port, :nick, :channel, :nick_pass, :channel_pass
0
   
0
   # Initialize the bot with default values
0
   def initialize(constructor = H.new)
0
0
@@ -106,12 +106,12 @@
0
   # Automatic events
0
   
0
   def join_channels
0
- sendln "JOIN #{@channel}}"
0
+ sendln "JOIN #{@channel} #{@channel_pass}"
0
   end
0
   
0
   
0
   def auto_rejoin(channel)
0
- sendln "JOIN ##{channel}}"
0
+ sendln "JOIN ##{channel} #{@channel_pass}"
0
   end
0
   
0
   def login
0
@@ -119,6 +119,10 @@
0
       #user = @mail.split("@")
0
       sendln "NICK #{@nick}"
0
       sendln "USER irc_cat . . :#{@realname}"
0
+ if @nick_pass
0
+ puts "logging in to NickServ"
0
+ sendln "PRIVMSG NICKSERV :identify #{@nick_pass}"
0
+ end
0
     rescue Exception => e
0
       err e
0
     end

Comments

    No one has commented yet.