diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb index 7266e0aad..cc8c302c3 100644 --- a/lib/sup/draft.rb +++ b/lib/sup/draft.rb @@ -20,10 +20,9 @@ def write_draft PollManager.poll_from @source end + # This works for all sources, not only sup://drafts def discard m - raise ArgumentError, "not a draft: source id #{m.source.id.inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect}" unless m.source.id.to_i == DraftManager.source_id - Index.delete m.id - File.delete @source.fn_for_offset(m.source_info) rescue Errono::ENOENT + m.remove_label :draft UpdateManager.relay self, :single_message_deleted, m end end diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb index 84236beed..d014d89be 100644 --- a/lib/sup/maildir.rb +++ b/lib/sup/maildir.rb @@ -193,6 +193,10 @@ def valid? id File.exists? File.join(@dir, id) end + def fn_for_offset offset + return File.join(@dir, offset) + end + private def new_maildir_basefn