Class: IRC::Server::Modules::Netlog
- Inherits:
-
IRC::Server::Module
- Object
- IRC::Server::Module
- IRC::Server::Modules::Netlog
- Defined in:
- lib/failirc/server/modules/Netlog.rb
Instance Attribute Summary
Attributes inherited from IRC::Server::Module
Instance Method Summary collapse
-
#initialize(server) ⇒ Netlog
constructor
A new instance of Netlog.
- #netlog(chain, fromRef, toRef, message, level = nil) ⇒ Object
Methods inherited from IRC::Server::Module
Constructor Details
Instance Method Details
#netlog(chain, fromRef, toRef, message, level = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/failirc/server/modules/Netlog.rb', line 41 def netlog (chain, fromRef, toRef, , level=nil) if chain != :input return end from = fromRef.value to = toRef.value URI.extract().each {|uri| if match = uri.match('http://(beta\.)?(\w+?)\.netlog.com.*photo.*?(\d+)') country = match[2] url = match[3] code = "000000000#{url}".match(/(\d{3})(\d{3})\d{3}$/) .gsub!(/#{Regexp.escape(uri)}/, "http://#{country}.netlogstatic.com/p/oo/#{code[1]}/#{code[2]}/#{url}.jpg") elsif match = uri.match(/netlogstatic/) .gsub!(/#{Regexp.escape(uri)}/, uri.sub(/\/[to]{2}\//, '/oo/')) end } end |