Well, I'm not too proud, but this on a cron job does what I need! If I get some time to dig into the sup source, I might have a stronger opinion about how/whether to integrate this sort of thing. My instinct is "no", sup copes with messages being moved around under it, and offlineimap does the right thing too.
#!/usr/bin/ruby
require 'mail'
BASE = "/home/mattbee/mail"
SOURCE = "#{BASE}/sup.sent"
FROM_ADDRESS_TO_SENT_FOLDER_MAP = {
"matthew@work" => "#{BASE}/Work/Sent",
"matthew@personal" => "#{BASE}/Personal/Sent",
"matthew@othercompany" => "#{BASE}/Othercompany/Sent"
}
%w( cur new ).each do |d|
d = "#{SOURCE}/#{d}"
Dir.new(d).entries.each do |e|
f = "#{d}/#{e}"
next unless File.file?(f)
mail = Mail.read(f)
maildir = FROM_ADDRESS_TO_SENT_FOLDER_MAP[mail.from.first]
if !maildir
STDERR.print "Unknown From address in #{f}\n"
else
# STDERR.print "Moving #{f} to #{maildir}\n"
File.rename(f, "#{maildir}/cur/#{e}")
end
end
end