From mboxrd@z Thu Jan 1 00:00:00 1970 From: jim@gonzul.net (Jim Cheetham) Date: Thu, 2 Jul 2009 22:14:23 +1200 Subject: [sup-talk] sent_source - singular or per-account? In-Reply-To: <1246502666-sup-1295@ntdws12.chass.utoronto.ca> References: <1246476925-sup-5046@ntdws12.chass.utoronto.ca> <1246502666-sup-1295@ntdws12.chass.utoronto.ca> Message-ID: On Thu, Jul 2, 2009 at 3:17 PM, Ben Walton wrote: > Excerpts from Jim Cheetham's message of Wed Jul 01 22:30:25 -0400 2009: > If I'm understanding you correctly, you want to write to a different > source depending on which address is used in the From. Almost; what I (could have) said was that I wanted to write to a different source depending on which account is in use for the current message; I wasn't fixating on the From address itself, although with a better understanding of the code you might declare that they are effectively the same anyway :-) > ?You'd either > need to make a separate config entry in each account that gets setup > (similar to the sendmail that you note) or provide the ability for the > user to select the sent box in some other way. Yes; and in either case I think we can't just override the current global sent_source, because this is being used to read messages from, in order to include them in the threads. > In the 'simpler' case where the decision is made based on account > used, you've got a chunk of static code making the choice and > defaulting as it would now. ?The hook would simply take the place of > the static decision maker. ?The decision has to be made per message > regardless of how it's implemented, so doing it in a hook is a better > option, imo. ?The Hook route would be slightly slower, since there are > extra activation records on the stack for the function calls, but it > should be negligible. Mmm, I think the hook route would expose you to a lot of change, because whenever a 'new' source (i.e. one not known about as load time) is declared in the hook, you'll have to remember it so it can be included in the index, and be available next time sup starts too. Whereas requiring sent_sources to be declared at load time only means they can be added as sources just like the current singular one is. I've been browsing the source this evening, I don't have a very good grasp of Ruby idiom but I do find it to be very readable in general :-) However, I've come to a halt in SentManager.write_sent_message, because I haven't figured out how @source.store_message relates to my store URI, and therefore the relevant store_message function. I mean, if :sent_store: is configured, how does @source get created from @source_uri? If we have multiple sent_sources, that contradicts the singleton SentManager, unless @source becomes a hash keyed off from_email ... at which point I'm pushing my Ruby skills too far for the evening. Any comments or specific code pointers welcomed! I'd be happy to attempt a patch for this, but I may need a little help ... -jim