Class: ModSpox::Handlers::Quit

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

Instance Method Summary collapse

Constructor Details

#initialize(handlers) ⇒ Quit

Returns a new instance of Quit.



4
5
6
# File 'lib/mod_spox/handlers/Quit.rb', line 4

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

Instance Method Details

#process(string) ⇒ Object



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

def process(string)
    if(string =~ /^:(\S+)\sQUIT\s:(.+)$/)
        reason = $2
        nick = find_model($1.gsub(/!.+$/, ''))
        nick.clear_channels
        nick.visible = false
        nick.save
        return Messages::Incoming::Quit.new(string, nick, reason)
    else
        Logger.log('Failed to parse KICK message')
    end
end