Subject: [sup-talk] Sup sources question

From: [email-masked] (Marcus Williams)
Date: Thu, 08 Nov 2007 11:18:51 +0000

I cocked up when I set up one of my sources so that I added a sent
folder from imap to sup without the sent label.

What I thought I'd do is sup-dump, sup-sync everything again and then
restore my settings. Then I remembered I'd noticed that you have a
source_id in the ferret index, so I can search for messages marked
with that source_id and add the label in manually. The only problem is
I dont know the source_id (although its easy to find out in the
console.sh).

What I'm thinking is, rather than use an auto-generated id which I
assume is some index into the source.yaml could you not name the
sources in some way in the yaml so that you can then use this name to
look up certain sources? This would also stop your source.yaml and
your source_id's getting out of sync which I assume they can if you
add a source to your yaml file in the middle somewhere. On startup you
could check for uniqueness if needed.

Does this make sense?

Marcus

---

From: [email-masked] (Marcus Williams)
Date: Thu, 08 Nov 2007 11:21:06 +0000

> could check for uniqueness if needed.

Rather embarrassingly, I just noticed the id flag in sources.yaml
which probably does exactly this :)

Ignore the noise..

---

From: [email-masked] (William Morgan)
Date: Sun, 11 Nov 2007 20:03:47 -0800

Excerpts from Marcus Williams's message of Thu Nov 08 03:18:51 -0800 2007:
> with that source_id and add the label in manually.

Just curious if you managed to make this work. I sent an example to the
list a few weeks back about using console.sh to do just this sort of
thing.

-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Marcus Williams)
Date: Mon, 12 Nov 2007 13:29:30 +0000

> list a few weeks back about using console.sh to do just this sort of

Yep - cleaned up all of my sources without having to resync. I wrote a
little wrapper tool to do it, might clean up that and post it some
time. For info, the way I did it was almost exactly the way you
suggested (to be run in console.sh):

# remove inbox label and add sent label on all messages coming from a
# single source (id is 3)
Index.ferret.search_each("source_id:3", :limit => :all) do |id, score|
  m = Index.build_message id
  puts "Modifying #{m.id}\t[#{m.labels.join ','}]"
  m.labels.uniq!
  m.labels -= [:inbox] unless m.labels.include? :starred
  m.labels += [:sent]
  puts ".......to #{m.id}\t[#{m.labels.join ','}]"
  Index.sync_message m
end
Index.ferret.optimize

I did notice some messages had a lot of repeated labels. Not sure why,
but calling uniq! fixed it.

Marcus

---

From: [email-masked] (William Morgan)
Date: Mon, 12 Nov 2007 09:20:44 -0800

> but calling uniq! fixed it.

Interesting. Well, I'll throw a uniq into the index saving code for good
measure.