summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/config.rb11
-rw-r--r--lib/feed2imap/feed2imap.rb4
-rw-r--r--lib/feed2imap/itemtomail.rb6
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb
index f6ef634..c0bf4ac 100644
--- a/lib/feed2imap/config.rb
+++ b/lib/feed2imap/config.rb
@@ -64,7 +64,13 @@ class F2IConfig
s += "#{i}. #{f.name}\n"
s += " URL: #{f.url}\n"
s += " IMAP Account: #{f.imapaccount}\n"
- s += " Folder: #{f.folder}\n\n"
+ s += " Folder: #{f.folder}\n"
+
+ if not f.wrapto
+ s += " Not wrapped.\n"
+ end
+
+ s += "\n"
i += 1
end
s
@@ -73,7 +79,7 @@ end
# A configured feed. simple data container.
class ConfigFeed
- attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash, :dumpdir, :include_images
+ attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash, :dumpdir, :wrapto, :include_images
attr_accessor :body
def initialize(f, imapaccount, folder, f2iconfig)
@@ -88,6 +94,7 @@ class ConfigFeed
@ignore_hash = f['ignore-hash'] || false
@freq = @freq.to_i if @freq
@dumpdir = f['dumpdir'] || nil
+ @wrapto = if f['wrapto'] == nil then 72 else f['wrapto'].to_i end
@include_images = f2iconfig.include_images
if f['include-images']
@include_images = (f['include-images'] != 'false')
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb
index 63a00b8..ebae470 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, f.include_images)
+ email = item_to_mail(i, i.cacheditem.index, true, f.name, f.include_images, f.wrapto)
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, f.include_images)
+ email = item_to_mail(i, i.cacheditem.index, false, f.name, f.include_images, f.wrapto)
f.imapaccount.putmail(f.folder, email, i.date || Time::new)
end
end
diff --git a/lib/feed2imap/itemtomail.rb b/lib/feed2imap/itemtomail.rb
index 91e6c18..27fc362 100644
--- a/lib/feed2imap/itemtomail.rb
+++ b/lib/feed2imap/itemtomail.rb
@@ -47,7 +47,7 @@ class String
end
end
-def item_to_mail(item, index, updated, from = 'Feed2Imap', inline_images = false)
+def item_to_mail(item, index, updated, from = 'Feed2Imap', inline_images = false, wrapto = false)
message = RMail::Message::new
if item.creator and item.creator != ''
if item.creator.include?('@')
@@ -77,9 +77,9 @@ def item_to_mail(item, index, updated, from = 'Feed2Imap', inline_images = false
end
end
textpart = RMail::Message::new
- textpart.header['Content-Type'] = 'text/plain; charset=utf-8'
+ textpart.header['Content-Type'] = 'text/plain; charset=utf-8; format=flowed'
textpart.header['Content-Transfer-Encoding'] = '8bit'
- textpart.body = item.to_text
+ textpart.body = item.to_text(true, wrapto)
htmlpart = RMail::Message::new
htmlpart.header['Content-Type'] = 'text/html; charset=utf-8'
htmlpart.header['Content-Transfer-Encoding'] = '8bit'