Class: ModSpox::Handlers::Part
- Defined in:
- lib/mod_spox/handlers/Part.rb
Instance Method Summary collapse
-
#initialize(handlers) ⇒ Part
constructor
A new instance of Part.
-
#process(string) ⇒ Object
:mod_spox!~mod_spox@host PART #m : :[email protected] PART #php.
Methods inherited from Handler
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
:mod_spox!~mod_spox@host PART #m : :[email protected] PART #php
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mod_spox/handlers/Part.rb', line 12 def process(string) string = string.dup orig = string.dup begin string.slice!(0) nick = find_model(string.slice!(0..string.index('!')-1)) 2.times{ string.slice!(0..string.index(' ')) } unless(string.index(' ').nil?) channel = find_model(string.slice!(0..string.index(' ')-1)) string.slice!(0..string.index(':')) else channel = find_model(string) string = '' end channel.remove_nick(nick) nick.visible = false if nick.channels.empty? nick.save_changes channel.save_changes return Messages::Incoming::Part.new(orig, channel, nick, string) rescue Object => boom Logger.error("Failed to parse PART message: #{orig}") raise boom end end |