summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--lib/feed2imap/config.rb3
-rw-r--r--lib/feed2imap/feed2imap.rb9
3 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 06d3165..c0c2764 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Feed2Imap 0.9 (XX/XX/2006)
============================
+* Per-feed dumpdir option (helps debugging)
* Now uses Content-Transfer-Encoding: 8bit (thanks Arnt Gulbrandsen
<arnt@gulbrandsen.priv.no>)
* Now supports Snowscripts, using the 'execurl' and 'filter' config
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb
index 3aea4bb..4c3a858 100644
--- a/lib/feed2imap/config.rb
+++ b/lib/feed2imap/config.rb
@@ -72,7 +72,7 @@ end
# A configured feed. simple data container.
class ConfigFeed
- attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash
+ attr_reader :name, :url, :imapaccount, :folder, :always_new, :execurl, :filter, :ignore_hash, :dumpdir
attr_accessor :body
def initialize(f, imapaccount, folder)
@@ -86,6 +86,7 @@ class ConfigFeed
@filter = f['filter']
@ignore_hash = f['ignore-hash'] || false
@freq = @freq.to_i if @freq
+ @dumpdir = f['dumpdir'] || nil
end
def needfetch(lastcheck)
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb
index a2474be..fcb483e 100644
--- a/lib/feed2imap/feed2imap.rb
+++ b/lib/feed2imap/feed2imap.rb
@@ -149,6 +149,15 @@ class Feed2Imap
end
end
end
+ # dump this feed if requested
+ if feed.dumpdir
+ mutex.synchronize do
+ if feed.body
+ fname = feed.dumpdir + '/' + feed.name + '-' + Time::now.xmlschema
+ File::open(fname, 'w') { |file| file.puts feed.body }
+ end
+ end
+ end
rescue Timeout::Error
mutex.synchronize do
n = @cache.fetch_failed(feed.name)