Class: ModSpox::Handlers::Notice
- Defined in:
- lib/mod_spox/handlers/Notice.rb
Instance Method Summary collapse
-
#initialize(handlers) ⇒ Notice
constructor
A new instance of Notice.
- #process(string) ⇒ Object
Constructor Details
#initialize(handlers) ⇒ Notice
Returns a new instance of Notice.
4 5 6 |
# File 'lib/mod_spox/handlers/Notice.rb', line 4 def initialize(handlers) handlers[:NOTICE] = self end |
Instance Method Details
#process(string) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mod_spox/handlers/Notice.rb', line 8 def process(string) if(string =~ /:(\S+)\sNOTICE\s(\S+)\s:(.+)$/) base_source = $1 target = $2 = $3 if(base_source =~ /\!/) source = find_model(base_source.gsub(/!.+$/, '')) if(base_source =~ /!(.+)@(.+)$/) source.username = $1 source.address = $2 source.source = base_source source.save end target = find_model(target) else source = base_source end return Messages::Incoming::Notice.new(string, source, target, ) else Logger.log('Failed to match NOTICE message') end end |