Class: ModSpox::Handlers::Welcome
- Defined in:
- lib/mod_spox/handlers/Welcome.rb
Instance Method Summary collapse
-
#initialize(handlers) ⇒ Welcome
constructor
A new instance of Welcome.
-
#process(string) ⇒ Object
>> :holmes.freenode.net 001 spax :Welcome to the freenode IRC Network spax.
Methods inherited from Handler
Constructor Details
#initialize(handlers) ⇒ Welcome
Returns a new instance of Welcome.
5 6 7 |
# File 'lib/mod_spox/handlers/Welcome.rb', line 5 def initialize(handlers) handlers[RPL_WELCOME] = self end |
Instance Method Details
#process(string) ⇒ Object
>> :holmes.freenode.net 001 spax :Welcome to the freenode IRC Network spax
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mod_spox/handlers/Welcome.rb', line 9 def process(string) parse = string.dup begin parse.slice!(0) server = parse.slice!(0..parse.index(' ')-1) 2.times{parse.slice!(0..parse.index(' '))} nick = parse.slice!(0..parse.index(' ')-1) parse.slice!(0..parse.index(':')) nick = Models::Nick.find_or_create(:nick => nick) nick.botnick = true nick.visible = true nick.save return Messages::Incoming::Welcome.new(string, server, parse, nick, nil, nil) rescue Object => boom Logger.warn("Failed to parse welcome message: #{string}") raise boom end end |