Skip to content

Commit

Permalink
Reply to PING (3.7.2) and wait for RPL_MYINFO (5.1) to signal good co…
Browse files Browse the repository at this point in the history
…nnection registration. See RFC2812.
  • Loading branch information
sanko authored and pjhyett committed Jan 12, 2009
1 parent 8cb49f8 commit 8038947
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions services/irc.rb
Expand Up @@ -28,6 +28,24 @@
irc.puts "NICK #{botname}"
irc.puts "USER #{botname} 8 * :GitHub IRCBot"

begin
Timeout.timeout(10) do
loop {
begin
recv = irc.gets
if(recv =~ / 004 #{botname} /)
break
end
if(recv =~ /^PING\s*:\s*(.*)$/)
irc.puts "PONG #{$1}"
end
end
}
end
rescue Timeout::Error
throw :halt, 400
end

rooms.each do |room|
room, pass = room.split("::")
irc.puts "JOIN #{room} #{pass}"
Expand Down

0 comments on commit 8038947

Please sign in to comment.