Class: RbIRC
- Inherits:
-
Object
- Object
- RbIRC
- Defined in:
- lib/rbirc.rb
Class Method Summary collapse
-
.start(server, nick, channel) ⇒ Object
It should connect after that and will start showing essentially raw IRC.
Class Method Details
.start(server, nick, channel) ⇒ Object
It should connect after that and will start showing essentially raw IRC
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rbirc.rb', line 8 def self.start(server, nick, channel) puts "Starting connect to #{server} with nick #{nick}" sock = TCPSocket.new(server, 6667) while stuff = sock.gets if stuff.include? "Couldn't" sock.puts "USER #{nick} #{nick} #{nick} :#{nick}\r\n", 'UTF-8' sock.puts "NICK #{nick}\r\n" , 'UTF-8' sock.puts "JOIN #{channel}\r\n" end puts stuff end while line = sock.gets if line.include? "PING" ping = Array.new ping = line.split(':') sock.puts "PONG : #{ping[1]}\r\n" end end end |