]> git.cworth.org Git - sup/commitdiff
add #mark_as_deleted and #expunge to Redwood::IMAP. completely untested!
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Tue, 14 Oct 2008 01:14:29 +0000 (18:14 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Tue, 14 Oct 2008 01:15:21 +0000 (18:15 -0700)
Ditz-issue: 2673f091c15dd90222a59621a1842d4ef0a743f7

bugs/issue-2673f091c15dd90222a59621a1842d4ef0a743f7.yaml [new file with mode: 0644]
lib/sup/imap.rb

diff --git a/bugs/issue-2673f091c15dd90222a59621a1842d4ef0a743f7.yaml b/bugs/issue-2673f091c15dd90222a59621a1842d4ef0a743f7.yaml
new file mode 100644 (file)
index 0000000..df14160
--- /dev/null
@@ -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 <wmorgan-sup@masanjin.net>
+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 <wmorgan-sup@masanjin.net>
+  - created
+  - ""
+git_branch: 
index 1d369767c43106fdb19737244f172adbba8f644c..bb5780d5ca5ca12ccc443b4f9e40e0c4aa2b92b0 100644 (file)
@@ -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