summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLucas Nussbaum <lucas@lucas-nussbaum.net>2012-04-26 10:14:51 +0200
committerLucas Nussbaum <lucas@lucas-nussbaum.net>2012-04-26 10:15:57 +0200
commit04db76a10d2f26e124731f7601722bfa2de61dfe (patch)
tree93165b5e73ee17fa1c0510362ea7dee473f650d6 /lib
parent5ff5b6d733136936af1789793e66d84df15731d5 (diff)
downloadfeed2imap-04db76a10d2f26e124731f7601722bfa2de61dfe.tar.gz
feed2imap-04db76a10d2f26e124731f7601722bfa2de61dfe.tar.bz2
feed2imap-04db76a10d2f26e124731f7601722bfa2de61dfe.zip
Use global sequence number
Using a per feed sequence number made it possible to have duplicate entries when several feeds were pointing to the same Maildir folder.
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/maildir.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/feed2imap/maildir.rb b/lib/feed2imap/maildir.rb
index 317f631..f05c60c 100644
--- a/lib/feed2imap/maildir.rb
+++ b/lib/feed2imap/maildir.rb
@@ -23,11 +23,9 @@ require 'fcntl'
class MaildirAccount
MYHOSTNAME = Socket.gethostname
- attr_reader :uri
+ @@seq_num = 0
- def initialize
- @seq_num = 0
- end
+ attr_reader :uri
def putmail(folder, mail, date = Time::now)
store_message(folder_dir(folder), date, nil) do |f|
@@ -169,8 +167,8 @@ class MaildirAccount
# Re-written and no longer shamelessly taken from
# http://gitorious.org/sup/mainline/blobs/master/lib/sup/maildir.rb
def new_maildir_basefn(date)
- fn = "#{date.to_i.to_s}.#{@seq_num.to_s}.#{MYHOSTNAME}"
- @seq_num = @seq_num + 1
+ fn = "#{date.to_i.to_s}.#{@@seq_num.to_s}.#{MYHOSTNAME}"
+ @@seq_num += 1
fn
end
end