From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 14 Oct 2008 13:18:37 -0700 Subject: [sup-talk] sup-sync-back imap support In-Reply-To: <55c107bf0810131606q2e9b8d16rc2de8d2d609b3841@mail.gmail.com> References: <55c107bf0810131606q2e9b8d16rc2de8d2d609b3841@mail.gmail.com> Message-ID: <1224015062-sup-5794@entry> Hi Dmitri, Reformatted excerpts from Dimitri Aivaliotis's message of 2008-10-13: > Now for the request: does anybody have a dusty patch to sup-sync-back > to make it work with IMAP sources lying around anywhere? Perhaps with > just functionality for --drop-spam? I don't have a patch, but I've just made a couple commits to the next branch to make this easier, at least as a one-off task. Unfortunately I haven't quite gotten it to work. Git pull and then try something like this: $ sh devel/console.sh [Tue Oct 14 13:06:24 -0700 2008] using character set encoding "UTF-8" [Tue Oct 14 13:06:24 -0700 2008] optional 'chronic' library not found (run 'gem install chronic' to install) [Tue Oct 14 13:06:24 -0700 2008] crypto: detected gpg binary in /usr/bin/gpg [Tue Oct 14 13:06:24 -0700 2008] loading index... [Tue Oct 14 13:06:24 -0700 2008] loaded index of 168 messages >> docids = Index.ferret.search("label:spam", :limit => :all).hits.map { |h| h.doc } => [166] >> imap_ids = docids.map { |id| Index.ferret[id][:source_info].to_i } => [12235610720003659] >> source = Index.sources.select { |s| s.is_a? IMAP }.first => #, errorn...> ## (or however you want to get the source. if you have more than one ## IMAP source, you'll have to look at Index.ferret[id][:source_id] as ## well, and match them up to the source.id for each source >> Index.ferret[166][:subject] => "__START_SUBJECT__ *****SPAM***** exclusive flash __END_SUBJECT__" ## (just making sure) >> source.mark_as_deleted imap_ids [Tue Oct 14 13:08:28 -0700 2008] Connecting to IMAP server xxx:993... [Tue Oct 14 13:08:28 -0700 2008] Logging in... [Tue Oct 14 13:08:28 -0700 2008] CRAM-MD5 authentication failed: Net::IMAP::NoResponseError. Trying LOGIN auth... [Tue Oct 14 13:08:29 -0700 2008] Successfully connected to imaps://xxx/. [Tue Oct 14 13:08:29 -0700 2008] fetching IMAP headers 1..183 [Tue Oct 14 13:08:30 -0700 2008] done fetching IMAP headers => [#[:Seen, :Deleted]}>] >> source.expunge [Tue Oct 14 13:08:36 -0700 2008] fetching IMAP headers 1..183 [Tue Oct 14 13:08:37 -0700 2008] done fetching IMAP headers => true Unfortunately the expunge command doesn't seem to have any actual effect. I'm not sure if this is because the server I'm using is broken, or what. It seems like this should work. So you can take it from here. I'm done trying to make IMAP act reasonable. :) -- William