Class: ModSpox::Handlers::Join
- Defined in:
- lib/mod_spox/handlers/Join.rb
Instance Method Summary collapse
-
#initialize(handlers) ⇒ Join
constructor
A new instance of Join.
- #process(string) ⇒ Object
Constructor Details
#initialize(handlers) ⇒ Join
Returns a new instance of Join.
4 5 6 |
# File 'lib/mod_spox/handlers/Join.rb', line 4 def initialize(handlers) handlers[:JOIN] = self end |
Instance Method Details
#process(string) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mod_spox/handlers/Join.rb', line 7 def process(string) if(string =~ /^:(\S+)\sJOIN :(\S+)$/) source = $1 chan = $2 if(source =~ /^(.+?)!(.+?)@(.+)$/) nick = find_model($1) nick.username = $2 nick.address = $3 nick.source = source nick.visible = true nick.save channel = find_model(chan) channel.nick_add(nick) return Messages::Incoming::Join.new(string, channel, nick) else Logger.log('Failed to parse source on JOIN message') end else Logger.log('Failed to parse JOIN message') end end |