Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Attempt at reply-from hook
@ 2009-06-01 23:18 Edward Z. Yang
  2009-06-02 22:09 ` Ingmar Vanhassel
  0 siblings, 1 reply; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-01 23:18 UTC (permalink / raw)


Hello,

I'm attempting to create a reply-from.rb hook that looks like this:

if message.has_label? 'twp':
    Person.from_address "Edward Z. Yang <edwardzyang at thewritingpot.com>"
end

Unfortunately, it doesn't seem to work. I'm running sup v0.7.

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-01 23:18 [sup-talk] Attempt at reply-from hook Edward Z. Yang
@ 2009-06-02 22:09 ` Ingmar Vanhassel
  2009-06-03  2:54   ` Edward Z. Yang
  0 siblings, 1 reply; 13+ messages in thread
From: Ingmar Vanhassel @ 2009-06-02 22:09 UTC (permalink / raw)


Excerpts from Edward Z. Yang's message of Tue Jun 02 01:18:26 +0200 2009:
> Hello,
> 
> I'm attempting to create a reply-from.rb hook that looks like this:
> 
> if message.has_label? 'twp':
>     Person.from_address "Edward Z. Yang <edwardzyang at thewritingpot.com>"
> end

if message.has_label? twp
    Person.from_address "Edward Z. Yang <edwardzyang at thewritingpot.com>"
end

> Unfortunately, it doesn't seem to work. I'm running sup v0.7.

If the above doesn't work, post some relevant error output.

> Cheers,
> Edward

Regards,
Ingmar


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-02 22:09 ` Ingmar Vanhassel
@ 2009-06-03  2:54   ` Edward Z. Yang
  2009-06-03 11:44     ` Ben Walton
  0 siblings, 1 reply; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-03  2:54 UTC (permalink / raw)


Excerpts from Ingmar Vanhassel's message of Tue Jun 02 18:09:16 -0400 2009:
> If the above doesn't work, post some relevant error output.

It silently fails. Is there any Sup way of making debug messages in
hooks?

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-03  2:54   ` Edward Z. Yang
@ 2009-06-03 11:44     ` Ben Walton
  2009-06-05  5:24       ` Edward Z. Yang
  0 siblings, 1 reply; 13+ messages in thread
From: Ben Walton @ 2009-06-03 11:44 UTC (permalink / raw)


Excerpts from Edward Z. Yang's message of Tue Jun 02 22:54:02 -0400 2009:

> It silently fails. Is there any Sup way of making debug messages in
> hooks?

Redwood::log "my message"

Then, look in the log buffer.

HTH.
-Ben

-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090603/2d66ef11/attachment.bin>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-03 11:44     ` Ben Walton
@ 2009-06-05  5:24       ` Edward Z. Yang
  2009-06-05 13:37         ` William Morgan
  0 siblings, 1 reply; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-05  5:24 UTC (permalink / raw)


Excerpts from Ben Walton's message of Wed Jun 03 07:44:24 -0400 2009:
> Redwood::log "my message"
> 
> Then, look in the log buffer.

I tried probing several ways.

- The reply-from.rb hook is being called.
- The message variable does exist.
- The message.has_label? "mylabel" returns false, as the body of the if
  statement never gets logged. (My contention is that the message very
  clearly has that label, so wtf).
- It is difficult to get a str representation of the message

I am still stymied.

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-05  5:24       ` Edward Z. Yang
@ 2009-06-05 13:37         ` William Morgan
  2009-06-06  0:09           ` Edward Z. Yang
  0 siblings, 1 reply; 13+ messages in thread
From: William Morgan @ 2009-06-05 13:37 UTC (permalink / raw)


Reformatted excerpts from Edward Z. Yang's message of 2009-06-04:
> The message.has_label? "mylabel" returns false, as the body of the if
> statement never gets logged. (My contention is that the message very
> clearly has that label, so wtf).

Try has_label? :mylabel. Sup represents labels as symbols instead of as
strings.

Sorry about that. The hook system is in need of much documentation.

A good environment for playing around with this stuff is to run the console:

  w at drspaceman:~/devel/sup$ sh devel/console.sh 
  [...]
  >> Index.run_query "label:potato"
  => [1000]
  >> m = Index.build_message 1000
  => #<Redwood::Message:0x7f187b394ac8 [...]>
  >> m.labels
  => [:inbox, :unread, :potato]
  >> m.has_label? :potato
  => true
  >> m.has_label? "potato"
  => false

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-05 13:37         ` William Morgan
@ 2009-06-06  0:09           ` Edward Z. Yang
  2009-06-08 21:34             ` William Morgan
  0 siblings, 1 reply; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-06  0:09 UTC (permalink / raw)


Excerpts from William Morgan's message of Fri Jun 05 09:37:02 -0400 2009:
> Try has_label? :mylabel. Sup represents labels as symbols instead of as
> strings.

Great! My hook works now. This is the sort of functionality that I think
is worth generalizing and implementing as a configuration twiddle (one,
I think, that should be on by default.)

> A good environment for playing around with this stuff is to run the console:
> 
>   w at drspaceman:~/devel/sup$ sh devel/console.sh 
>   [...]
>   >> Index.run_query "label:potato"
>   => [1000]
>   >> m = Index.build_message 1000
>   => #<Redwood::Message:0x7f187b394ac8 [...]>
>   >> m.labels
>   => [:inbox, :unread, :potato]
>   >> m.has_label? :potato
>   => true
>   >> m.has_label? "potato"
>   => false

Nice!

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-06  0:09           ` Edward Z. Yang
@ 2009-06-08 21:34             ` William Morgan
  2009-06-08 21:59               ` Edward Z. Yang
  0 siblings, 1 reply; 13+ messages in thread
From: William Morgan @ 2009-06-08 21:34 UTC (permalink / raw)


Reformatted excerpts from Edward Z. Yang's message of 2009-06-05:
> Great! My hook works now. This is the sort of functionality that I
> think is worth generalizing and implementing as a configuration
> twiddle (one, I think, that should be on by default.)

I have a strong preference for hooks over configuration variables. Look
at the .muttrc documentation for why.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-08 21:34             ` William Morgan
@ 2009-06-08 21:59               ` Edward Z. Yang
       [not found]                 ` <1244502124-sup-7043@cabinet>
  0 siblings, 1 reply; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-08 21:59 UTC (permalink / raw)


Excerpts from William Morgan's message of Mon Jun 08 17:34:31 -0400 2009:
> I have a strong preference for hooks over configuration variables. Look
> at the .muttrc documentation for why.

There's an interesting usability argument there.  Right now, I still (possibly
naively) believe that if you organize your configuration properly, you can
have an arbitrarily large amount of it.

What's your opinion on making this default behavior, with no configuration
twiddle?

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
       [not found]                 ` <1244502124-sup-7043@cabinet>
@ 2009-06-09  0:12                   ` Edward Z. Yang
       [not found]                     ` <1244518550-sup-6361@cabinet>
  0 siblings, 1 reply; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-09  0:12 UTC (permalink / raw)


Excerpts from Marc Hartstein's message of Mon Jun 08 19:09:16 -0400 2009:
> Reading the thread, it's not clear exactly what your hook does, or what
> behavior you want as the default.  I didn't see anything which said what
> you were trying to accomplish.

My apologies.

My sup email comes from three distinct sources, and as part of my
configuration they get a label as such (mit, twp or ita).  This label
is the most visible way of telling me which source my mail came from.

I am subscribed to numerous mailing lists, however, which do not
explicitly list my mail address in To or CC. As a result, Sup defaults
to my "main address".

What I would like Sup to do is look at the label, find the appropriate
source, and use the email in the source to populate the From field.
This is different from what you describe below.

> Attempting to figure it out from your code samples, I'm guessing that
> you're trying to get sup to always reply with a from address of the
> known address of yours found in the recipient list of the email being
> relied to, if any?

If Sup doesn't do the correct thing in this case, this additional hook
would be useful.

> I do get the sense that there might be a lot of people out there who
> want to use the default (always use default account) behavior, so I'm
> not sure about switching the default.  I wouldn't exactly be against it,
> though.

I would argue that most people have at least a personal and a work
email account, and that it is not appropriate to conflate the two.
They can write a hook that overrides an address (or, horror horror,
a twiddle in sources) to do it.

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
       [not found]                     ` <1244518550-sup-6361@cabinet>
@ 2009-06-09  4:06                       ` Edward Z. Yang
  2009-06-09 16:52                       ` William Morgan
  1 sibling, 0 replies; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-09  4:06 UTC (permalink / raw)


Excerpts from Marc Hartstein's message of Mon Jun 08 23:46:48 -0400 2009:
> I think that's beyond what I'd personally think of as a "configuration
> twiddle", though...

Perhaps.

> You'd do it by, what, having a 1:1 mapping between email addresses and
> labels somewhere in the configuration, anything coming to the email
> address gets the label, and any reply to a message with the label
> (however it got it) gets the email address?

Yes.

> (It's also not as though the hook to only use your default address is
> hard to write.)

Indeed.

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
       [not found]                     ` <1244518550-sup-6361@cabinet>
  2009-06-09  4:06                       ` Edward Z. Yang
@ 2009-06-09 16:52                       ` William Morgan
  2009-06-11  3:38                         ` Edward Z. Yang
  1 sibling, 1 reply; 13+ messages in thread
From: William Morgan @ 2009-06-09 16:52 UTC (permalink / raw)


Reformatted excerpts from Marc Hartstein's message of 2009-06-08:
> I think that's beyond what I'd personally think of as a "configuration
> twiddle", though...

I tend to agree. I completely understand the use case, and I agree it's
probably a common one, but this is exactly the kind of thing I want to
address with hooks instead of with configuration. (Not that there's
*really* a distinction between these two things in the first place.)

Then when the next guy comes along and says, "I like this but I want my
from address based on X instead of the label", I can also avoid having
to do any work.

Edward, if you want to invest time on making this particular scheme easy
for users, I would be happy to include contributed hooks as part of the
Sup distribution, and you can supply one that reads a simple
configuration file and produces this behavior.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [sup-talk] Attempt at reply-from hook
  2009-06-09 16:52                       ` William Morgan
@ 2009-06-11  3:38                         ` Edward Z. Yang
  0 siblings, 0 replies; 13+ messages in thread
From: Edward Z. Yang @ 2009-06-11  3:38 UTC (permalink / raw)


Excerpts from William Morgan's message of Tue Jun 09 12:52:37 -0400 2009:
> Edward, if you want to invest time on making this particular scheme easy
> for users, I would be happy to include contributed hooks as part of the
> Sup distribution, and you can supply one that reads a simple
> configuration file and produces this behavior.

The thing is that this needs no configuration: sources.yaml will
tell us the correspondence between label and email.  If anything,
I would bill this as an improvement to the "From" detection algorithm.

Cheers,
Edward


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-06-11  3:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-01 23:18 [sup-talk] Attempt at reply-from hook Edward Z. Yang
2009-06-02 22:09 ` Ingmar Vanhassel
2009-06-03  2:54   ` Edward Z. Yang
2009-06-03 11:44     ` Ben Walton
2009-06-05  5:24       ` Edward Z. Yang
2009-06-05 13:37         ` William Morgan
2009-06-06  0:09           ` Edward Z. Yang
2009-06-08 21:34             ` William Morgan
2009-06-08 21:59               ` Edward Z. Yang
     [not found]                 ` <1244502124-sup-7043@cabinet>
2009-06-09  0:12                   ` Edward Z. Yang
     [not found]                     ` <1244518550-sup-6361@cabinet>
2009-06-09  4:06                       ` Edward Z. Yang
2009-06-09 16:52                       ` William Morgan
2009-06-11  3:38                         ` Edward Z. Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox