diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2005-07-22 08:59:13 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2005-07-22 08:59:13 +0000 |
commit | 146beb0d171a4158abd4e8f7f39c69013aeea99e (patch) | |
tree | ddf49e3946615ea5b392e817c27e9e6e05d82b8a /lib/feed2imap/config.rb | |
parent | 6941a59386d4d7d6de2c505dda54912e9a163f71 (diff) | |
download | feed2imap-146beb0d171a4158abd4e8f7f39c69013aeea99e.tar.gz feed2imap-146beb0d171a4158abd4e8f7f39c69013aeea99e.tar.bz2 feed2imap-146beb0d171a4158abd4e8f7f39c69013aeea99e.zip |
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@39 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap/config.rb | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb index d61d415..8899ef5 100644 --- a/lib/feed2imap/config.rb +++ b/lib/feed2imap/config.rb @@ -37,13 +37,14 @@ class F2IConfig @conf['feeds'] ||= [] @feeds = [] @imap_accounts = ImapAccounts::new - @conf['feeds'].each { |f| - uri = URI::parse(f['target']) - path = uri.path - path = path[1..-1] if path[0,1] == '/' - @feeds.push(ConfigFeed::new(f['name'], f['url'], - @imap_accounts.add_account(uri), path)) - } + @conf['feeds'].each do |f| + if f['disable'].nil? + uri = URI::parse(f['target']) + path = uri.path + path = path[1..-1] if path[0,1] == '/' + @feeds.push(ConfigFeed::new(f, @imap_accounts.add_account(uri), path)) + end + end end def to_s @@ -72,8 +73,17 @@ class ConfigFeed attr_reader :name, :url, :imapaccount, :folder attr_accessor :body - def initialize(name, url, imapaccount, folder) - @name, @url, @imapaccount, @folder = name, url, imapaccount, folder - url.sub!(/^feed:/, '') + def initialize(f, imapaccount, folder) + @name = f['name'] + @url = f['url'] + @url.sub!(/^feed:/, '') if @url =~ /^feed:/ + @imapaccount, @folder = imapaccount, folder + @freq = f['min-frequency'] + @freq = @freq.to_i if @freq + end + + def needfetch(lastcheck) + return true if @freq.nil? + return (lastcheck + @freq * 3600) < Time::now end end |