Class: ModSpox::Handlers::Invite
- Defined in:
- lib/mod_spox/handlers/Invite.rb
Instance Method Summary collapse
-
#initialize(handlers) ⇒ Invite
constructor
A new instance of Invite.
-
#process(string) ⇒ Object
:spax!~spox@host INVITE spox :#m.
Methods inherited from Handler
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
:spax!~spox@host INVITE spox :#m
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mod_spox/handlers/Invite.rb', line 9 def process(string) orig = string.dup string = string.dup begin string.slice!(0) source = find_model(string.slice!(0..string.index('!')-1)) 2.times{ string.slice!(0..string.index(' ')) } target = find_model(string.slice!(0..string.index(' ')-1)) string.slice!(0..string.index(':')) channel = find_model(string.strip) return Messages::Incoming::Invite.new(orig, source, target, channel) rescue Object => boom Logger.error("Failed to parse INVITE message: #{orig}") raise boom end end |