* [sup-talk] reply-from.rb troubles
@ 2010-01-15 16:03 Philipp Überbacher
2010-01-15 18:41 ` Tero Tilus
0 siblings, 1 reply; 15+ messages in thread
From: Philipp Überbacher @ 2010-01-15 16:03 UTC (permalink / raw)
To: sup-talk
It currently looks like this:
if message.has_label?(:mailinglists)
Person.from_address("<hollunder@lavabit.com>")
elsif message.has_label?(:murks_lavabit)
Person.from_address("<murks@lavabit.com>")
end
Yet it replies to messages with label mailinglists using murks@... which is the default address.
I really don't know what to do...
Regards,
Philipp
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-15 16:03 [sup-talk] reply-from.rb troubles Philipp Überbacher
@ 2010-01-15 18:41 ` Tero Tilus
2010-01-15 20:38 ` Philipp Überbacher
0 siblings, 1 reply; 15+ messages in thread
From: Tero Tilus @ 2010-01-15 18:41 UTC (permalink / raw)
To: sup-talk
Philipp Überbacher, 2010-01-15 18:03:
> It currently looks like this:
>
> if message.has_label?(:mailinglists)
> Person.from_address("<hollunder@lavabit.com>")
> elsif message.has_label?(:murks_lavabit)
> Person.from_address("<murks@lavabit.com>")
> end
>
> Yet it replies to messages with label mailinglists using murks@.
Have you tried[1] what Person.from_address("<hollunder@lavabit.com>")
actually returns? I bet its nil and thus sup uses default address.
You can try it interactively for example using sup console, it is your
dearest friend when you debug.
Iirc #from_address expects plain email address. Try
if message.has_label?(:mailinglists)
Person.from_address("hollunder@lavabit.com")
elsif message.has_label?(:murks_lavabit)
Person.from_address("murks@lavabit.com")
end
--
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-15 18:41 ` Tero Tilus
@ 2010-01-15 20:38 ` Philipp Überbacher
2010-01-16 21:38 ` Tero Tilus
0 siblings, 1 reply; 15+ messages in thread
From: Philipp Überbacher @ 2010-01-15 20:38 UTC (permalink / raw)
To: sup-talk
Excerpts from Tero Tilus's message of Fri Jan 15 19:41:15 +0100 2010:
> Philipp Überbacher, 2010-01-15 18:03:
> > It currently looks like this:
> >
> > if message.has_label?(:mailinglists)
> > Person.from_address("<hollunder@lavabit.com>")
> > elsif message.has_label?(:murks_lavabit)
> > Person.from_address("<murks@lavabit.com>")
> > end
> >
> > Yet it replies to messages with label mailinglists using murks@.
>
> Have you tried[1] what Person.from_address("<hollunder@lavabit.com>")
> actually returns? I bet its nil and thus sup uses default address.
> You can try it interactively for example using sup console, it is your
> dearest friend when you debug.
>> Person.from_address("<hollunder@lavabit.com>")
=> #<Redwood::Person:0x7f6d045b1ff8
@email="hollunder@lavabit.com",
@name="hollunder">
> Iirc #from_address expects plain email address. Try
>
> if message.has_label?(:mailinglists)
> Person.from_address("hollunder@lavabit.com")
> elsif message.has_label?(:murks_lavabit)
> Person.from_address("murks@lavabit.com")
> end
Changing that changed nothing, as I'm writing this it's at default
again and I have to edit it manually.
I usually restarted sup, this time I did clear_hooks tough, which
returned nil.
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-15 20:38 ` Philipp Überbacher
@ 2010-01-16 21:38 ` Tero Tilus
2010-01-17 2:01 ` Philipp Überbacher
0 siblings, 1 reply; 15+ messages in thread
From: Tero Tilus @ 2010-01-16 21:38 UTC (permalink / raw)
To: sup-talk
Philipp Überbacher, 2010-01-15 22:38:
>> Have you tried[1] what Person.from_address("<hollunder@lavabit.com>")
>> actually returns?
>
> >> Person.from_address("<hollunder@lavabit.com>")
> => #<Redwood::Person:0x7f6d045b1ff8
> @email="hollunder@lavabit.com",
> @name="hollunder">
So no problem there. Does your log show anything when replying? If
not, you could add logging to your hook (logging things you do in your
hooks ain't a bad habit).
if message.has_label?(:mailinglists)
info "Looks like replying to a mailinglist."
Person.from_address("hollunder@lavabit.com")
elsif message.has_label?(:murks_lavabit)
info "Looks like replying as murks."
Person.from_address("murks@lavabit.com")
end
--
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-16 21:38 ` Tero Tilus
@ 2010-01-17 2:01 ` Philipp Überbacher
2010-01-17 15:24 ` William Morgan
0 siblings, 1 reply; 15+ messages in thread
From: Philipp Überbacher @ 2010-01-17 2:01 UTC (permalink / raw)
To: sup-talk
Excerpts from Tero Tilus's message of Sat Jan 16 22:38:16 +0100 2010:
> Philipp Überbacher, 2010-01-15 22:38:
> >> Have you tried[1] what Person.from_address("<hollunder@lavabit.com>")
> >> actually returns?
> >
> > >> Person.from_address("<hollunder@lavabit.com>")
> > => #<Redwood::Person:0x7f6d045b1ff8
> > @email="hollunder@lavabit.com",
> > @name="hollunder">
>
> So no problem there. Does your log show anything when replying? If
> not, you could add logging to your hook (logging things you do in your
> hooks ain't a bad habit).
>
> if message.has_label?(:mailinglists)
> info "Looks like replying to a mailinglist."
> Person.from_address("hollunder@lavabit.com")
> elsif message.has_label?(:murks_lavabit)
> info "Looks like replying as murks."
> Person.from_address("murks@lavabit.com")
> end
>
I added said lines but after attempting a reply I don't see the messages
in any log files. So far I've discovered in ~/.sup/ exception-log.txt
and sup-exception-log.txt but I see none of these entries in there.
Where are those supposed to end up?
Regards,
Philipp
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 2:01 ` Philipp Überbacher
@ 2010-01-17 15:24 ` William Morgan
2010-01-17 15:43 ` Philipp Überbacher
0 siblings, 1 reply; 15+ messages in thread
From: William Morgan @ 2010-01-17 15:24 UTC (permalink / raw)
To: sup-talk
Reformatted excerpts from Philipp Überbacher's message of 2010-01-16:
> I added said lines but after attempting a reply I don't see the
> messages in any log files. So far I've discovered in ~/.sup/
> exception-log.txt and sup-exception-log.txt but I see none of these
> entries in there. Where are those supposed to end up?
In the log buffer. If you hit ';' you'll see it.
--
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 15:24 ` William Morgan
@ 2010-01-17 15:43 ` Philipp Überbacher
2010-01-17 16:01 ` William Morgan
0 siblings, 1 reply; 15+ messages in thread
From: Philipp Überbacher @ 2010-01-17 15:43 UTC (permalink / raw)
To: sup-talk
Excerpts from William Morgan's message of Sun Jan 17 16:24:36 +0100 2010:
> Reformatted excerpts from Philipp Überbacher's message of 2010-01-16:
> > I added said lines but after attempting a reply I don't see the
> > messages in any log files. So far I've discovered in ~/.sup/
> > exception-log.txt and sup-exception-log.txt but I see none of these
> > entries in there. Where are those supposed to end up?
>
> In the log buffer. If you hit ';' you'll see it.
Thanks. Now when replying to this message I see:
[Sun Jan 17 16:37:06 +0100 2010] Looks like replying to a mailinglist.
Yet it doesn't use the right address.
This is the hook:
if message.has_label? :mailinglists
info "Looks like replying to a mailinglist."
Person.from_address "<hollunder@lavabit.com>"
elsif message.has_label? :murks_lavabit
info "Looks like replying with default."
Person.from_address "<murks@lavabit.com>"
end
So it seems the issue is that
Person.from_address "<hollunder@lavabit.com>"
doesn't get executed or doesn't work for some reason.
I don't know what's the issue here...
Thanks,
Philipp
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 15:43 ` Philipp Überbacher
@ 2010-01-17 16:01 ` William Morgan
2010-01-17 16:40 ` Philipp Überbacher
0 siblings, 1 reply; 15+ messages in thread
From: William Morgan @ 2010-01-17 16:01 UTC (permalink / raw)
To: sup-talk
Reformatted excerpts from Philipp Überbacher's message of 2010-01-17:
> So it seems the issue is that
> Person.from_address "<hollunder@lavabit.com>"
> doesn't get executed or doesn't work for some reason.
>
> I don't know what's the issue here...
When I copy your code to my reply-from.rb, add a label "mailinglists" to
a message, and reply, I see "From: hollunder <hollunder@lavabit.com>".
So, it works for me...
You can add more logging and see what Person object it's returning.
Failing that, you can add some info statements to reply-mode.rb and see
what's happening in there.
--
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 16:01 ` William Morgan
@ 2010-01-17 16:40 ` Philipp Überbacher
2010-01-17 18:30 ` Cameron Matheson
0 siblings, 1 reply; 15+ messages in thread
From: Philipp Überbacher @ 2010-01-17 16:40 UTC (permalink / raw)
To: sup-talk
Excerpts from William Morgan's message of Sun Jan 17 17:01:31 +0100 2010:
> Reformatted excerpts from Philipp Überbacher's message of 2010-01-17:
> > So it seems the issue is that
> > Person.from_address "<hollunder@lavabit.com>"
> > doesn't get executed or doesn't work for some reason.
> >
> > I don't know what's the issue here...
>
> When I copy your code to my reply-from.rb, add a label "mailinglists" to
> a message, and reply, I see "From: hollunder <hollunder@lavabit.com>".
> So, it works for me...
>
> You can add more logging and see what Person object it's returning.
> Failing that, you can add some info statements to reply-mode.rb and see
> what's happening in there.
Now I did:
if message.has_label? :mailinglists
info "Looks like replying to a mailinglist."
Person.from_address "<hollunder@lavabit.com>"
a = Person.from_address "<hollunder@lavabit.com>"
info 'This is Person.from_address "<hollunder@lavabit.com>": '
elsif message.has_label? :murks_lavabit
info "Looks like replying with default."
Person.from_address "<murks@lavabit.com>"
end
Which is probably not clever, but I got:
[Sun Jan 17 17:38:17 +0100 2010] Looks like replying to a mailinglist.
[Sun Jan 17 17:38:17 +0100 2010] This is Person.from_address
"<hollunder@lavabit.com>":
[Sun Jan 17 17:38:17 +0100 2010] reply-from returned non-Person, using
default from.
It seems this is trying to tell me what's wrong..
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 16:40 ` Philipp Überbacher
@ 2010-01-17 18:30 ` Cameron Matheson
2010-01-17 19:23 ` Philipp Überbacher
0 siblings, 1 reply; 15+ messages in thread
From: Cameron Matheson @ 2010-01-17 18:30 UTC (permalink / raw)
To: sup-talk
Excerpts from Philipp Überbacher's message of Sun Jan 17 09:40:36 -0700 2010:
> Now I did:
> if message.has_label? :mailinglists
> info "Looks like replying to a mailinglist."
> Person.from_address "<hollunder@lavabit.com>"
> a = Person.from_address "<hollunder@lavabit.com>"
> info 'This is Person.from_address "<hollunder@lavabit.com>": '
> elsif message.has_label? :murks_lavabit
> info "Looks like replying with default."
> Person.from_address "<murks@lavabit.com>"
> end
>
> Which is probably not clever, but I got:
> [Sun Jan 17 17:38:17 +0100 2010] Looks like replying to a mailinglist.
> [Sun Jan 17 17:38:17 +0100 2010] This is Person.from_address
> "<hollunder@lavabit.com>":
> [Sun Jan 17 17:38:17 +0100 2010] reply-from returned non-Person, using
> default from.
>
> It seems this is trying to tell me what's wrong..
It looks like your hook is now returning the output of info instead of a
person. Try this:
if message.has_label? :mailinglists
info "Looks like replying to a mailinglist."
Person.from_address "<hollunder@lavabit.com>"
p = Person.from_address "<hollunder@lavabit.com>"
info "This is person #{p.full_address}"
p
elsif message.has_label? :murks_lavabit
info "Looks like replying with default."
Person.from_address "<murks@lavabit.com>"
end
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 18:30 ` Cameron Matheson
@ 2010-01-17 19:23 ` Philipp Überbacher
2010-01-17 19:45 ` William Morgan
0 siblings, 1 reply; 15+ messages in thread
From: Philipp Überbacher @ 2010-01-17 19:23 UTC (permalink / raw)
To: sup-talk
Excerpts from Cameron Matheson's message of Sun Jan 17 19:30:30 +0100 2010:
> Excerpts from Philipp Überbacher's message of Sun Jan 17 09:40:36 -0700 2010:
> > Now I did:
> > if message.has_label? :mailinglists
> > info "Looks like replying to a mailinglist."
> > Person.from_address "<hollunder@lavabit.com>"
> > a = Person.from_address "<hollunder@lavabit.com>"
> > info 'This is Person.from_address "<hollunder@lavabit.com>": '
> > elsif message.has_label? :murks_lavabit
> > info "Looks like replying with default."
> > Person.from_address "<murks@lavabit.com>"
> > end
> >
> > Which is probably not clever, but I got:
> > [Sun Jan 17 17:38:17 +0100 2010] Looks like replying to a mailinglist.
> > [Sun Jan 17 17:38:17 +0100 2010] This is Person.from_address
> > "<hollunder@lavabit.com>":
> > [Sun Jan 17 17:38:17 +0100 2010] reply-from returned non-Person, using
> > default from.
> >
> > It seems this is trying to tell me what's wrong..
>
> It looks like your hook is now returning the output of info instead of a
> person. Try this:
>
> if message.has_label? :mailinglists
> info "Looks like replying to a mailinglist."
> Person.from_address "<hollunder@lavabit.com>"
> p = Person.from_address "<hollunder@lavabit.com>"
> info "This is person #{p.full_address}"
> p
> elsif message.has_label? :murks_lavabit
> info "Looks like replying with default."
> Person.from_address "<murks@lavabit.com>"
> end
This is the output:
[Sun Jan 17 20:21:19 +0100 2010] Looks like replying to a mailinglist.
[Sun Jan 17 20:21:19 +0100 2010] This is person hollunder
<hollunder@lavabit.com>
btw., does anyone have tips regarding copy/pasting with vim? I always
have to trim lots of whitespace.
Regards,
Philipp
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 19:23 ` Philipp Überbacher
@ 2010-01-17 19:45 ` William Morgan
2010-01-17 20:08 ` Philipp Überbacher
0 siblings, 1 reply; 15+ messages in thread
From: William Morgan @ 2010-01-17 19:45 UTC (permalink / raw)
To: sup-talk
Reformatted excerpts from Philipp Überbacher's message of 2010-01-17:
> [Sun Jan 17 20:21:19 +0100 2010] Looks like replying to a mailinglist.
> [Sun Jan 17 20:21:19 +0100 2010] This is person hollunder
> <hollunder@lavabit.com>
You see this and *then*, in the reply-mode buffer, you see a different
address in the From: field? I don't see how that's possible.
> btw., does anyone have tips regarding copy/pasting with vim? I always
> have to trim lots of whitespace.
:set :paste should do it.
--
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 19:45 ` William Morgan
@ 2010-01-17 20:08 ` Philipp Überbacher
2010-01-17 20:36 ` William Morgan
0 siblings, 1 reply; 15+ messages in thread
From: Philipp Überbacher @ 2010-01-17 20:08 UTC (permalink / raw)
To: sup-talk
Excerpts from William Morgan's message of Sun Jan 17 20:45:38 +0100 2010:
> Reformatted excerpts from Philipp Überbacher's message of 2010-01-17:
> > [Sun Jan 17 20:21:19 +0100 2010] Looks like replying to a mailinglist.
> > [Sun Jan 17 20:21:19 +0100 2010] This is person hollunder
> > <hollunder@lavabit.com>
>
> You see this and *then*, in the reply-mode buffer, you see a different
> address in the From: field? I don't see how that's possible.
>
> > btw., does anyone have tips regarding copy/pasting with vim? I always
> > have to trim lots of whitespace.
>
> :set :paste should do it.
But this is exactly what I see in the log when replying to this message:
[Sun Jan 17 21:00:33 +0100 2010] Looks like replying to a mailinglist.
[Sun Jan 17 21:00:33 +0100 2010] This is person hollunder
<hollunder@lavabit.com>
And the address was set to murks@lavabit.com again..
Now that you say this is impossible, I had a look at my before-edit.rb
and suspect it to be the culprit, since it ends with:
else
header["From"] = "Philipp Überbacher <murks@lavabit.com>"
end
Now how can one do both without trouble, replying sanely and using a sane address for new messages?
And sorry for the trouble, I should have thought about that other hook earlier..
Regards,
Philipp
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 20:08 ` Philipp Überbacher
@ 2010-01-17 20:36 ` William Morgan
2010-01-20 21:50 ` hollunder
0 siblings, 1 reply; 15+ messages in thread
From: William Morgan @ 2010-01-17 20:36 UTC (permalink / raw)
To: sup-talk
Reformatted excerpts from Philipp Überbacher's message of 2010-01-17:
> Now that you say this is impossible, I had a look at my before-edit.rb
> and suspect it to be the culprit, since it ends with:
> else
> header["From"] = "Philipp Überbacher <murks@lavabit.com>"
> end
Hah, nice catch. That would do it.
> Now how can one do both without trouble, replying sanely and using a
> sane address for new messages?
I think the proper answer is to change reply-mode, so that any addresses
set by the reply-* hooks overrides anything set by the before-edit hook.
In the mean time, you can probably work around this with a nasty hack: in
before-edit hook, if the "In-reply-to" header is set, don't set the From
address (because it is a reply, and will have been set by the reply-from
hook).
--
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [sup-talk] reply-from.rb troubles
2010-01-17 20:36 ` William Morgan
@ 2010-01-20 21:50 ` hollunder
0 siblings, 0 replies; 15+ messages in thread
From: hollunder @ 2010-01-20 21:50 UTC (permalink / raw)
To: sup-talk
Excerpts from William Morgan's message of Sun Jan 17 21:36:01 +0100 2010:
> Reformatted excerpts from Philipp Überbacher's message of 2010-01-17:
> > Now that you say this is impossible, I had a look at my before-edit.rb
> > and suspect it to be the culprit, since it ends with:
> > else
> > header["From"] = "Philipp Überbacher <murks@lavabit.com>"
> > end
>
> Hah, nice catch. That would do it.
>
> > Now how can one do both without trouble, replying sanely and using a
> > sane address for new messages?
>
> I think the proper answer is to change reply-mode, so that any addresses
> set by the reply-* hooks overrides anything set by the before-edit hook.
>
> In the mean time, you can probably work around this with a nasty hack: in
> before-edit hook, if the "In-reply-to" header is set, don't set the From
> address (because it is a reply, and will have been set by the reply-from
> hook).
It took me a while to get to it since I was kind of afraid of ruby, but
I tried today and it seems to work like this:
if header["In-reply-to"] = nil
if header["To"] =~ /talk|list|lists|linux|devel|user|daw/
header["From"] = "Philipp Überbacher <hollunder@lavabit.com>"
else
header["From"] = "Philipp Überbacher <murks@lavabit.com>"
end
end
Thanks a lot. I recommended sup today on my distros mailinglist and briefly showed it to some colleagues who had never seen something like it.
Regards,
Philipp
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2010-01-20 21:55 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-15 16:03 [sup-talk] reply-from.rb troubles Philipp Überbacher
2010-01-15 18:41 ` Tero Tilus
2010-01-15 20:38 ` Philipp Überbacher
2010-01-16 21:38 ` Tero Tilus
2010-01-17 2:01 ` Philipp Überbacher
2010-01-17 15:24 ` William Morgan
2010-01-17 15:43 ` Philipp Überbacher
2010-01-17 16:01 ` William Morgan
2010-01-17 16:40 ` Philipp Überbacher
2010-01-17 18:30 ` Cameron Matheson
2010-01-17 19:23 ` Philipp Überbacher
2010-01-17 19:45 ` William Morgan
2010-01-17 20:08 ` Philipp Überbacher
2010-01-17 20:36 ` William Morgan
2010-01-20 21:50 ` hollunder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox