Class: ModSpox::Handlers::Part

Inherits:
Handler
  • Object
show all
Defined in:
lib/mod_spox/handlers/Part.rb

Instance Method Summary collapse

Constructor Details

#initialize(handlers) ⇒ Part

Returns a new instance of Part.



5
6
7
# File 'lib/mod_spox/handlers/Part.rb', line 5

def initialize(handlers)
    handlers[:PART] = self
end

Instance Method Details

#process(string) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mod_spox/handlers/Part.rb', line 8

def process(string)
    if(string =~ /^:(\S+) PART (\S+) (.*)$/)
        channel = find_model($2)
        nick = find_model($1.gsub(/!.+$/, ''))
        channel.nick_remove(nick)
        return Messages::Incoming::Part.new(string, channel, nick, $3)
    else
        Logger.log('Failed to parse PART message')
        return nil
    end
end