diff options
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap.rb | 8 | ||||
-rw-r--r-- | lib/feed2imap/config.rb | 2 | ||||
-rw-r--r-- | lib/feed2imap/feed2imap.rb | 4 | ||||
-rw-r--r-- | lib/feed2imap/html2text-parser.rb | 2 | ||||
-rw-r--r-- | lib/feed2imap/httpfetcher.rb | 20 | ||||
-rw-r--r-- | lib/feed2imap/imap.rb | 4 | ||||
-rw-r--r-- | lib/feed2imap/rubyimap.rb | 2 | ||||
-rw-r--r-- | lib/feed2imap/textconverters.rb | 3 |
8 files changed, 21 insertions, 24 deletions
diff --git a/lib/feed2imap.rb b/lib/feed2imap.rb index f813f27..094c64f 100644 --- a/lib/feed2imap.rb +++ b/lib/feed2imap.rb @@ -1,9 +1 @@ require 'feed2imap/feed2imap' -require 'feed2imap/cache' -require 'feed2imap/channel' -require 'feed2imap/config' -require 'feed2imap/httpfetcher' -require 'feed2imap/imap' -require 'feed2imap/rexml_patch' -require 'feed2imap/rubymail_patch' -require 'feed2imap/textconverters' diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb index 8899ef5..0483423 100644 --- a/lib/feed2imap/config.rb +++ b/lib/feed2imap/config.rb @@ -40,7 +40,7 @@ class F2IConfig @conf['feeds'].each do |f| if f['disable'].nil? uri = URI::parse(f['target']) - path = uri.path + path = URI::unescape(uri.path) path = path[1..-1] if path[0,1] == '/' @feeds.push(ConfigFeed::new(f, @imap_accounts.add_account(uri), path)) end diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb index ee46acb..a35c23a 100644 --- a/lib/feed2imap/feed2imap.rb +++ b/lib/feed2imap/feed2imap.rb @@ -28,6 +28,10 @@ require 'logger' require 'thread' class Feed2Imap + def Feed2Imap.version + return F2I_VERSION + end + def initialize(verbose, cacherebuild, configfile) @logger = Logger::new(STDOUT) if verbose diff --git a/lib/feed2imap/html2text-parser.rb b/lib/feed2imap/html2text-parser.rb index 51bebfe..35793fc 100644 --- a/lib/feed2imap/html2text-parser.rb +++ b/lib/feed2imap/html2text-parser.rb @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =end -require 'feed2imap/sgml-parser.rb' +require 'feed2imap/sgml-parser' # this class provides a simple SGML parser that removes HTML tags class HTML2TextParser < SGMLParser diff --git a/lib/feed2imap/httpfetcher.rb b/lib/feed2imap/httpfetcher.rb index 3ec69da..c72fc32 100644 --- a/lib/feed2imap/httpfetcher.rb +++ b/lib/feed2imap/httpfetcher.rb @@ -17,20 +17,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =end -require 'feed2imap' require 'net/http' # get openssl if available begin - require 'net/https' -rescue +require 'net/https' +rescue LoadError end require 'uri' -if defined?(F2I_VERSION) - USERAGENT = "Feed2Imap v#{F2I_VERSION} http://home.gna.org/feed2imap/" -else - USERAGENT = 'Feed2Imap http://home.gna.org/feed2imap/' -end # max number of redirections MAXREDIR = 5 @@ -40,10 +34,16 @@ class HTTPFetcher def HTTPFetcher::fetcher(baseuri, uri, lastcheck, recursion) http = Net::HTTP::new(uri.host, uri.port) http.use_ssl = true if uri.scheme == 'https' + if defined?(Feed2Imap) + useragent = "Feed2Imap v#{Feed2Imap.version} http://home.gna.org/feed2imap/" + else + useragent = 'Feed2Imap http://home.gna.org/feed2imap/' + end + if lastcheck == Time::at(0) - req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => USERAGENT }) + req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => useragent }) else - req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => USERAGENT, 'If-Modified-Since' => lastcheck.httpdate}) + req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => useragent, 'If-Modified-Since' => lastcheck.httpdate}) end if uri.userinfo login, pw = uri.userinfo.split(':') diff --git a/lib/feed2imap/imap.rb b/lib/feed2imap/imap.rb index dca2ed4..20f8ccb 100644 --- a/lib/feed2imap/imap.rb +++ b/lib/feed2imap/imap.rb @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Imap connection handling require 'feed2imap/rubyimap' begin - require 'openssl' -rescue +require 'openssl' +rescue LoadError end require 'uri' diff --git a/lib/feed2imap/rubyimap.rb b/lib/feed2imap/rubyimap.rb index 82d5b29..e564b8d 100644 --- a/lib/feed2imap/rubyimap.rb +++ b/lib/feed2imap/rubyimap.rb @@ -17,7 +17,7 @@ require "socket" require "monitor" require "digest/md5" begin - require "openssl" +require "openssl" rescue LoadError end diff --git a/lib/feed2imap/textconverters.rb b/lib/feed2imap/textconverters.rb index 418083f..c6ae326 100644 --- a/lib/feed2imap/textconverters.rb +++ b/lib/feed2imap/textconverters.rb @@ -17,7 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =end -require 'uri' # for URI::regexp +# for URI::regexp +require 'uri' require 'feed2imap/html2text-parser' # This class provides various converters |