From: William Morgan Date: Tue, 14 Oct 2008 01:14:29 +0000 (-0700) Subject: add #mark_as_deleted and #expunge to Redwood::IMAP. completely untested! X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=7749ea37e2204edae4e168b41629c50b4da15677;p=sup add #mark_as_deleted and #expunge to Redwood::IMAP. completely untested! Ditz-issue: 2673f091c15dd90222a59621a1842d4ef0a743f7 --- diff --git a/bugs/issue-2673f091c15dd90222a59621a1842d4ef0a743f7.yaml b/bugs/issue-2673f091c15dd90222a59621a1842d4ef0a743f7.yaml new file mode 100644 index 0000000..df14160 --- /dev/null +++ b/bugs/issue-2673f091c15dd90222a59621a1842d4ef0a743f7.yaml @@ -0,0 +1,19 @@ +--- !ditz.rubyforge.org,2008-03-06/issue +title: make sup-sync-back work on IMAP folders +desc: "" +type: :feature +component: sup-sync-back +release: +reporter: William Morgan +status: :unstarted +disposition: +creation_time: 2008-10-14 01:14:08.690909 Z +references: [] + +id: 2673f091c15dd90222a59621a1842d4ef0a743f7 +log_events: +- - 2008-10-14 01:14:09.898338 Z + - William Morgan + - created + - "" +git_branch: diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index 1d36976..bb5780d 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -114,6 +114,19 @@ class IMAP < Source end synchronized :raw_message + def mark_as_deleted ids + ids = [ids].flatten # accept single arguments + unsynchronized_scan_mailbox + imap_ids = ids.map { |i| @imap_state[i] && @imap_state[i][:id] }.compact + @imap.store imap_ids, "+FLAGS", [:Deleted] + end + synchronized :mark_as_deleted + + def expunge + @imap.expunge + end + synchronized :expunge + def connect return if @imap safely { } # do nothing! @@ -259,7 +272,7 @@ private %w(RFC822.SIZE INTERNALDATE).each do |w| raise FatalSourceError, "requested data not in IMAP response: #{w}" unless imap_stuff.attr[w] end - + msize, mdate = imap_stuff.attr['RFC822.SIZE'] % 10000000, Time.parse(imap_stuff.attr["INTERNALDATE"]) sprintf("%d%07d", mdate.to_i, msize).to_i end