Subject: [sup-talk] sup-sync-back imap support

From: [email-masked] (Dimitri Aivaliotis)
Date: Tue, 14 Oct 2008 01:06:55 +0200

Hi All,

First of all, I want to thank William for creating a very useful tool
that I've been using since version 0.0.6.  As a mail client, sup has
really grown up, and I look forward to seeing the work spawned by the
recent STS work released under Heliotrope.

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've been using sup exclusively with an IMAP source, and since it's
always been from one computer, I haven't missed the sync-back
functionality.  But now I've got the problem that I'm migrating from
one IMAP server to another, and I don't want to sync the thousands of
messages that only sup recognizes as spam.

If there's no response, I guess I'll cook up a patch sometime in the
next few weeks, as I'd really like to move away from my ageing
mailsystem.

Thanks,
- Dimitri

---

From: [email-masked] (William Morgan)
Date: Tue, 14 Oct 2008 13:18:37 -0700

Hi Dmitri,

> 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>

---

From: [email-masked] (William Morgan)
Date: Mon, 20 Oct 2008 17:01:59 -0700

Reformatted excerpts from Dimitri Aivaliotis's message of 2008-10-20:
> I've finally been able to give your patch a try.  It worked like a
> charm for me!

Cool, glad to hear it.