Class: ModSpox::Handlers::Quit

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

Instance Method Summary collapse

Methods inherited from Handler

#preprocess

Constructor Details

#initialize(handlers) ⇒ Quit

Returns a new instance of Quit.



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

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

Instance Method Details

#process(string) ⇒ Object

:spox!~spox@host QUIT :Ping timeout



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mod_spox/handlers/Quit.rb', line 10

def process(string)
    orig = string.dup
    string = string.dup
    begin
        string.slice!(0)
        nick = find_model(string.slice!(0..string.index('!')-1))
        string.slice!(0..string.index(':'))
        nick.remove_all_channels
        nick.visible = false
        nick.save
        return Messages::Incoming::Quit.new(orig, nick, string)
    rescue Object => boom
        Logger.error("Failed to parse QUIT message: #{orig}")
        raise boom
    end
end