summaryrefslogtreecommitdiff
path: root/lib/feed2imap
diff options
context:
space:
mode:
Diffstat (limited to 'lib/feed2imap')
-rw-r--r--lib/feed2imap/maildir.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/feed2imap/maildir.rb b/lib/feed2imap/maildir.rb
index a18e5aa..76678e2 100644
--- a/lib/feed2imap/maildir.rb
+++ b/lib/feed2imap/maildir.rb
@@ -25,6 +25,10 @@ class MaildirAccount
attr_reader :uri
+ def initialize
+ @seq_num = 0
+ end
+
def putmail(folder, mail, date = Time::now)
store_message(folder_dir(folder), date, nil) do |f|
f.puts(mail)
@@ -84,7 +88,6 @@ class MaildirAccount
end
def store_message(dir, date, info, &block)
- # TODO: handle `date'
guarantee_maildir(dir)
@@ -93,7 +96,7 @@ class MaildirAccount
timer = 30
fd = nil
while timer >= 0
- new_fn = new_maildir_basefn
+ new_fn = new_maildir_basefn(date)
tmp_path = File.join(dir, 'tmp', new_fn)
new_path = File.join(dir, 'new', new_fn)
begin
@@ -160,11 +163,12 @@ class MaildirAccount
return (colon and basename.slice(colon + 1, -1))
end
- # Shamelessly taken from
+ # Re-written and no longer shamelessly taken from
# http://gitorious.org/sup/mainline/blobs/master/lib/sup/maildir.rb
- def new_maildir_basefn
- Kernel::srand()
- "#{Time.now.to_i.to_s}.#{$$}#{Kernel.rand(1000000)}.#{MYHOSTNAME}"
+ def new_maildir_basefn(date)
+ fn = "#{date.to_i.to_s}.#{@seq_num.to_s}.#{MYHOSTNAME}"
+ @seq_num = @seq_num + 1
+ fn
end
end
2014-06-29passmenu: type text with xdotoolJason A. Donenfeld2-3/+17 2014-06-29edit: Don't go into a crazy loop. Instead prompt.Jason A. Donenfeld1-2/+1 2014-06-29git: do not trap tmpdir removalJason A. Donenfeld1-1/+0 2014-06-29darwin: fix mktemp argument orderJason A. Donenfeld1-1/+1 2014-06-29darwin: properly ejects ramdisksJason A. Donenfeld2-15/+20 2014-06-29Allow options in EDITOR variableJason A. Donenfeld2-2/+3 2014-06-29keepassx2pass: Substitute empty string for NoneAndrew Spiers1-1/+4 2014-06-16emacs: Use PASSWORD_STORE_CLIP_TIME env variableSvend Sorensen1-4/+7 2014-06-16emacs: Use when instead of if/prognSvend Sorensen1-5/+4 2014-06-16emacs: Update pass website URLSvend Sorensen1-1/+1 2014-05-27Update for new URL.Jason A. Donenfeld3-3/+3 2014-05-14Bump version1.6.2Jason A. Donenfeld1-1/+1 2014-05-14Don't define tmpdir on git init.Jason A. Donenfeld1-4/+3 2014-05-14Disable secmem warning when discovering keysmilki2-2/+2 2014-05-10edit: Quote editor so tests work in spaced directories.Jason A. Donenfeld1-1/+1 2014-05-10reencryption: Properly escape input to sedJason A. Donenfeld1-1/+1 2014-05-10git: use secure tmp directoryJason A. Donenfeld1-4/+11 2014-05-10configure git to decrypt gpg files automaticallySamuel Le Thiec1-0/+5 2014-05-08completion: add new generate flagsJason A. Donenfeld3-2/+7 2014-05-08inplace: mutually exclusive with forceJason A. Donenfeld2-3/+3 2014-05-08usage: tab to spacesJason A. Donenfeld1-1/+1 2014-05-08generate: use nice ansi colors instead.Jason A. Donenfeld1-3/+2 2014-05-08zsh: posix compatible sed fix for zsh-completionJason A. Donenfeld1-1/+1 2014-05-07Implement interactive init functionSvend Sorensen1-0/+8 2014-05-07Implement interactive rename functionSvend Sorensen1-0/+7 2014-05-07Reorder interactive function to match order of helper functionsSvend Sorensen1-13/+13 2014-05-07Make edit helper function name consistent with other helpersSvend Sorensen1-1/+1 2014-05-07Factor out password completing-read functionSvend Sorensen1-4/+8 2014-05-07Add dash to Package-RequiresSvend Sorensen1-1/+1 2014-05-06Force sane sort order.Jason A. Donenfeld1-2/+2 2014-05-06generate: add --in-place optionJason A. Donenfeld4-9/+33