Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] sup-sync-back imap support
Date: Tue, 14 Oct 2008 13:18:37 -0700	[thread overview]
Message-ID: <1224015062-sup-5794@entry> (raw)
In-Reply-To: <55c107bf0810131606q2e9b8d16rc2de8d2d609b3841@mail.gmail.com>

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
  => #<Recoverable:0x2b86d8889c28 @mutex=#<Mutex:0x2b86d8889bd8>, 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
  => [#<struct Net::IMAP::FetchData seqno=153, attr={"FLAGS"=>[: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 <wmorgan-sup at masanjin.net>


  reply	other threads:[~2008-10-14 20:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13 23:06 Dimitri Aivaliotis
2008-10-14 20:18 ` William Morgan [this message]
     [not found]   ` <55c107bf0810201644m5888cb42r6087c016f071361b@mail.gmail.com>
2008-10-21  0:01     ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1224015062-sup-5794@entry \
    --to=wmorgan-sup@masanjin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox