Class: ModSpox::Handlers::Invite

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

Instance Method Summary collapse

Constructor Details

#initialize(handlers) ⇒ Invite

Returns a new instance of Invite.



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

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

Instance Method Details

#process(string) ⇒ Object



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

def process(string)
    if(string =~ /^(.+?)!.*?INVITE\s(\S+)\s(.+)$/)
        source = find_model($1)
        target = find_model($2)
        channel = find_model($3)
        return Messages::Incoming::Invite.new(string, source, target, channel)
    else
        Logger.log('Failed to parse INVITE message')
        return nil
    end
end