def get_icon_path(s)
/https?:\/\/.+\/(\d+)\/.*?$/ =~ s.user.profile_image_url
cache_file = "%s/%s-%s%s" % [ config.plugins.notify_send.icon_cache_dir,
s.user.screen_name,
$+,
File.extname(s.user.profile_image_url) ]
unless File.exist?(cache_file)
Thread.new(s,cache_file) do |s,cache_file|
Dir.glob("#{config.plugins.notify_send.icon_cache_dir}/#{s.user.screen_name}-*") {|f| File.delete(f) }
begin
s.user.profile_image_url.sub!(/^https/,'http')
File.open(cache_file, 'wb') do |f|
f << open(URI.escape(s.user.profile_image_url)).read
end
rescue OpenURI::HTTPError
cache_file = "#{config.plugins.notify_send.icon_cache_dir}/default.png"
end
end
end
return cache_file
end