summaryrefslogtreecommitdiff
path: root/lib/feed2imap
diff options
context:
space:
mode:
Diffstat (limited to 'lib/feed2imap')
-rw-r--r--lib/feed2imap/config.rb13
-rw-r--r--lib/feed2imap/feed2imap.rb4
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb
index 4c3a858..f6ef634 100644
--- a/lib/feed2imap/config.rb
+++ b/lib/feed2imap/config.rb
@@ -26,7 +26,7 @@ DEFCACHE = ENV['HOME'] + '/.feed2imap.cache'
# Feed2imap configuration
class F2IConfig
- attr_reader :imap_accounts, :cache, :feeds, :dumpdir, :updateddebug, :max_failures
+ attr_reader :imap_accounts, :cache, :feeds, :dumpdir, :updateddebug, :max_failures, :include_images
# Load the configuration from the IO stream
# TODO should do some sanity check on the data read.
@@ -38,13 +38,14 @@ class F2IConfig
@feeds = []
@max_failures = (@conf['max-failures'] || 10).to_i
@updateddebug = (@conf['debug-updated'] and @conf['debug-updated'] != 'false')
+ @include_images = (@conf['include-images'] and @conf['include-images'] != 'false')
@imap_accounts = ImapAccounts::new
@conf['feeds'].each do |f|
if f['disable'].nil?
uri = URI::parse(f['target'])
path = URI::unescape(uri.path)
path = path[1..-1] if path[0,1] == '/'
- @feeds.push(ConfigFeed::new(f, @imap_accounts.add_account(uri), path))
+ @feeds.push(ConfigFeed::new(f, @imap_accounts.add_account(uri), path, self))
end
end
end
@@ -72,10 +73,10 @@ end
# A configured feed. simple data container.
class ConfigFeed
- attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash, :dumpdir
+ attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash, :dumpdir, :include_images
attr_accessor :body
- def initialize(f, imapaccount, folder)
+ def initialize(f, imapaccount, folder, f2iconfig)
@name = f['name']
@url = f['url']
@url.sub!(/^feed:/, '') if @url =~ /^feed:/
@@ -87,6 +88,10 @@ class ConfigFeed
@ignore_hash = f['ignore-hash'] || false
@freq = @freq.to_i if @freq
@dumpdir = f['dumpdir'] || nil
+ @include_images = f2iconfig.include_images
+ if f['include-images']
+ @include_images = (f['include-images'] != 'false')
+ end
end
def needfetch(lastcheck)
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb
index a7fa627..63a00b8 100644
--- a/lib/feed2imap/feed2imap.rb
+++ b/lib/feed2imap/feed2imap.rb
@@ -230,13 +230,13 @@ class Feed2Imap
begin
if !cacherebuild
updateditems.each do |i|
- email = item_to_mail(i, i.cacheditem.index, true, f.name, true)
+ email = item_to_mail(i, i.cacheditem.index, true, f.name, f.include_images)
f.imapaccount.updatemail(f.folder, email,
i.cacheditem.index, i.date || Time::new)
end
# reverse is needed to upload older items first (fixes gna#8986)
newitems.reverse.each do |i|
- email = item_to_mail(i, i.cacheditem.index, false, f.name, true)
+ email = item_to_mail(i, i.cacheditem.index, false, f.name, f.include_images)
f.imapaccount.putmail(f.folder, email, i.date || Time::new)
end
end