* [sup-talk] message.list_address weirdness
@ 2010-12-27 10:07 Matthias Vallentin
2011-01-02 16:13 ` Matthias Vallentin
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Vallentin @ 2010-12-27 10:07 UTC (permalink / raw)
To: sup-talk
I cannot get message.list_address to match to add labels before adding
messages although the messages definitively have the List-Post header.
I found that message.list_address is sometimes a Person instance, which
suggest a bug in the code assigning the instance variable @list_address
(reformatted):
@list_address = if header["list-post"]
address = if header["list-post"] =~ /mailto:(.*?)[>\s$]/
$1
elsif header["list-post"] =~ /@/
header["list-post"] # just try the whole fucking thing
end
address && Person.from_address(address)
elsif header["x-mailing-list"]
Person.from_address header["x-mailing-list"]
end
This code looks erroneous in that Person.from_address returns a Person
instance in the elsif branch. Shouldn't that be a string of the address
instead, i.e.,
Person.from_address(header["x-mailing-list"]).email
? The same problem seems to appear in the conjunction
address && Person.from_address(address)
which should in my opinion be
address && Person.from_address(address).email
. Does that makes sense?
Matthias
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sup-talk] message.list_address weirdness
2010-12-27 10:07 [sup-talk] message.list_address weirdness Matthias Vallentin
@ 2011-01-02 16:13 ` Matthias Vallentin
0 siblings, 0 replies; 2+ messages in thread
From: Matthias Vallentin @ 2011-01-02 16:13 UTC (permalink / raw)
To: sup-talk
On Dec 27 2010 at 02:07AM PST, Matthias Vallentin wrote:
> I cannot get message.list_address to match to add labels before adding
> messages although the messages definitively have the List-Post header.
Actually, the proposed changes will cause a crash when replying to a
list address (i.e., hitting 'G'), which expects message.list_address to
return a Person object rather than a string containing the email
address. This is inconsistent with the wiki [1] and started my confusion
in the first place. Automatically adding labels for mailing lists would
then change from
if message.list_address =~ /sup-talk/
message.add_label "sup"
message.add_label "list"
end
to
if message.list_address and message.list_address.email =~ /sup-talk/
message.add_label "sup"
message.add_label "list"
end
in order to work correctly. In [1], list_address is documented to be of
type String, which should probably be changed to type Person. I find the
naming (list_address) slightly misleading because it suggest a plain
email address. What about introducing a new member message.list that
returns a Person object and making
message.list_{address,subscribe,unsubscribe} return a string?
Matthias
[1] http://sup.rubyforge.org/wiki/wiki.pl?AutoAddLabelsToNewMessages
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-02 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-27 10:07 [sup-talk] message.list_address weirdness Matthias Vallentin
2011-01-02 16:13 ` Matthias Vallentin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox