Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present
@ 2009-08-25  9:31 Israel Herraiz
  2009-09-01  2:58 ` William Morgan
  0 siblings, 1 reply; 7+ messages in thread
From: Israel Herraiz @ 2009-08-25  9:31 UTC (permalink / raw)


Hi,

I am subscribed to some lists that do not fill the list-post header,
but have a list-id header. I am not sure how standard-compliant is
that, but it would nice if Sup could identify those messages as list
messages.

Cheers,
Israel

---
 lib/sup/message.rb |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 56e66de..67f928c 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -34,7 +34,7 @@ class Message
 
   attr_reader :id, :date, :from, :subj, :refs, :replytos, :to, :source,
               :cc, :bcc, :labels, :attachments, :list_address, :recipient_email, :replyto,
-              :source_info, :list_subscribe, :list_unsubscribe
+              :source_info, :list_subscribe, :list_unsubscribe, :list_id
 
   bool_reader :dirty, :source_marked_read, :snippet_contains_encrypted_content
 
@@ -120,6 +120,13 @@ class Message
       else
         nil
       end
+     
+    @list_id =
+      if header["list-id"]
+        @list_id = header["list-id"].gsub(/^<|>$/, "")
+      else
+        nil
+      end
 
     @recipient_email = header["envelope-to"] || header["x-original-to"] || header["delivered-to"]
     @source_marked_read = header["status"] == "RO"
@@ -162,7 +169,7 @@ class Message
   end
 
   def snippet; @snippet || (chunks && @snippet); end
-  def is_list_message?; !@list_address.nil?; end
+  def is_list_message?; !@list_address.nil? || !@list_id.nil?; end
   def is_draft?; @source.is_a? DraftLoader; end
   def draft_filename
     raise "not a draft" unless is_draft?
-- 
1.6.4



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

* [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present
  2009-08-25  9:31 [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present Israel Herraiz
@ 2009-09-01  2:58 ` William Morgan
  2009-09-01  8:51   ` Israel Herraiz
  0 siblings, 1 reply; 7+ messages in thread
From: William Morgan @ 2009-09-01  2:58 UTC (permalink / raw)


Reformatted excerpts from Israel Herraiz's message of 2009-08-25:
> I am subscribed to some lists that do not fill the list-post header,
> but have a list-id header. I am not sure how standard-compliant is
> that, but it would nice if Sup could identify those messages as list
> messages.

Does this patch work for you?

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index ed27d3d..472b9dc 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -114,12 +114,11 @@ class Message
     @replytos = (header["in-reply-to"] || "").scan(/<(.+?)>/).map { |x| sanitize_me
 
     @replyto = Person.from_address header["reply-to"]
-    @list_address =
-      if header["list-post"]
-        @list_address = Person.from_address header["list-post"].gsub(/^<mailto:|>$/
-      else
-        nil
-      end
+    @list_address = if header["list-post"]
+      Person.from_address header["list-post"].gsub(/^<mailto:|>$/, "")
+    elsif header["list-id"]
+      Person.from_address header["list-id"].gsub(/^<:|>$/, "")
+    end
 
     @recipient_email = header["envelope-to"] || header["x-original-to"] || header["
     @source_marked_read = header["status"] == "RO"

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


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

* [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present
  2009-09-01  2:58 ` William Morgan
@ 2009-09-01  8:51   ` Israel Herraiz
  2009-09-04 13:56     ` William Morgan
  0 siblings, 1 reply; 7+ messages in thread
From: Israel Herraiz @ 2009-09-01  8:51 UTC (permalink / raw)


Excerpts from William Morgan's message of Tue Sep 01 04:58:47 +0200 2009:
> Does this patch work for you?

Yes, although list-id is not an address (it does not contain the "@"
symbol for instance). But I am happy with that patch :-).

Cheers,
Israel


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

* [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present
  2009-09-01  8:51   ` Israel Herraiz
@ 2009-09-04 13:56     ` William Morgan
  2009-09-07 22:46       ` Israel Herraiz
  0 siblings, 1 reply; 7+ messages in thread
From: William Morgan @ 2009-09-04 13:56 UTC (permalink / raw)


Reformatted excerpts from Israel Herraiz's message of 2009-09-01:
> Yes, although list-id is not an address (it does not contain the "@"
> symbol for instance). But I am happy with that patch :-).

Actually you're right. I think I prefer your patch. But based on the
code, it seems like reply-mode would crash if it got a message that
claims it's a list message but doesn't have a list address. Does it
actually work?
-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present
  2009-09-04 13:56     ` William Morgan
@ 2009-09-07 22:46       ` Israel Herraiz
  2009-09-08 12:25         ` William Morgan
  0 siblings, 1 reply; 7+ messages in thread
From: Israel Herraiz @ 2009-09-07 22:46 UTC (permalink / raw)


Excerpts from William Morgan's message of Fri Sep 04 15:56:41 +0200 2009:
> Actually you're right. I think I prefer your patch. But based on the
> code, it seems like reply-mode would crash if it got a message that
> claims it's a list message but doesn't have a list address. Does it
> actually work?

Umm. Yes, you are right. It fails because there is no list
address. Let me figure out another solution for this, I will send
another patch to the list.

Cheers,
Israel


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

* [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present
  2009-09-07 22:46       ` Israel Herraiz
@ 2009-09-08 12:25         ` William Morgan
  2009-09-08 12:41           ` Israel Herraiz
  0 siblings, 1 reply; 7+ messages in thread
From: William Morgan @ 2009-09-08 12:25 UTC (permalink / raw)


Reformatted excerpts from Israel Herraiz's message of 2009-09-07:
> Umm. Yes, you are right. It fails because there is no list
> address. Let me figure out another solution for this, I will send
> another patch to the list.

We need to figure out what the right behavior should be when replying to
a message that you know is a list message, but where you don't know the
list address. If there's a reliable way of extracting the list address
from another header (From?), we can use that, but I suspect there isn't.
If there isn't a reliable wa, then maybe the original behavior is fine
(don't treat it specially at all).
-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present
  2009-09-08 12:25         ` William Morgan
@ 2009-09-08 12:41           ` Israel Herraiz
  0 siblings, 0 replies; 7+ messages in thread
From: Israel Herraiz @ 2009-09-08 12:41 UTC (permalink / raw)


Excerpts from William Morgan's message of Tue Sep 08 14:25:50 +0200 2009:
> We need to figure out what the right behavior should be when replying to
> a message that you know is a list message, but where you don't know the
> list address. If there's a reliable way of extracting the list address
> from another header (From?), we can use that, but I suspect there isn't.
> If there isn't a reliable wa, then maybe the original behavior is fine
> (don't treat it specially at all).

Well, yes, after all, the broken thing here is the list, that does not
have a list-post header. So I guess that what should be fixed is that
list, not Sup :-).

I did not realize about the list address bug before sending the patch,
that's why I asked it to be merged. However, I am afraid you are
right, and I think it is worthless to implement this behavior.

Cheers,
Israel


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

end of thread, other threads:[~2009-09-08 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-25  9:31 [sup-talk] [PATCH] Identify list messages by list-id if list-post is not present Israel Herraiz
2009-09-01  2:58 ` William Morgan
2009-09-01  8:51   ` Israel Herraiz
2009-09-04 13:56     ` William Morgan
2009-09-07 22:46       ` Israel Herraiz
2009-09-08 12:25         ` William Morgan
2009-09-08 12:41           ` Israel Herraiz

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