<<< Date Index >>>     <<< Thread Index >>>

Re: list-reply and RFC 2369?



* Phil!Gregory <phil_g@xxxxxxxxx> [2004-07-17 16:40:00+0200]:
> I'm trying to see how difficult it would be to make list-reply honor the
> RFC 2369 List-Post: header if used on an email with no subscribed lists.
> Searching the archives turned up references to a RFC 2369 patch, but I
> haven't been able to find such a patch anywhere.

I was wondering the same thing a long time ago, but never went around
to implementing it. I had a look at the code needed today.

I have a patch which seems to work. The only caveat is that it doesn't
take into account special headers, only the address. For example, for
the following, the subject would not be set:

    List-Post: <mailto:moderator@xxxxxxxx?subject=list%20posting>

I guess it's an OK start. I'll propose it to the development list.

Regards,

Hugo

-- 
Hugo Haas - http://larve.net/people/hugo/
diff --exclude muttrc.man -ur mutt-1.5.6/mutt.h mutt-1.5.6+HH/mutt.h
--- mutt-1.5.6/mutt.h   2004-02-01 18:15:17.000000000 +0100
+++ mutt-1.5.6+HH/mutt.h        2004-07-18 11:43:15.000000000 +0200
@@ -550,6 +550,7 @@
   char *supersedes;
   char *date;
   char *x_label;
+  ADDRESS *list_post;
   LIST *references;            /* message references (in reverse order) */
   LIST *in_reply_to;           /* in-reply-to header content */
   LIST *userhdrs;              /* user defined headers */
diff --exclude muttrc.man -ur mutt-1.5.6/parse.c mutt-1.5.6+HH/parse.c
--- mutt-1.5.6/parse.c  2003-11-05 10:41:33.000000000 +0100
+++ mutt-1.5.6+HH/parse.c       2004-07-18 11:57:37.000000000 +0200
@@ -23,6 +23,7 @@
 #include "rfc2047.h"
 #include "rfc2231.h"
 #include "mutt_crypt.h"
+#include "url.h"
 
 #include <string.h>
 #include <ctype.h>
@@ -1064,6 +1065,35 @@
 
       matched = 1;
     }
+    else if (!ascii_strcasecmp (line + 1, "ist-Post"))
+    {
+      /* See RFC 2369 */
+      if (strcmp (p, "NO"))
+      {
+       char *tmp, *beg, *end;
+       if (!(beg = strchr (p, '<')))
+         goto endlistpost;
+       if ((tmp = safe_strdup (beg + 1)) == NULL)
+         goto endlistpost;
+
+       if (!(end = strchr (tmp, '>')))
+         goto endlistpost;       
+       *end = '\0';
+       if (url_check_scheme (tmp) != U_MAILTO)
+         goto endlistpost;
+       if (!(beg = strchr (tmp, ':')))
+         goto endlistpost;  
+       if ((end = strchr (++beg, '?')))
+         *end = '\0';
+       /* FIXME: we've just discarded everything which was after the
+          question mark; how to take it into account? */
+       url_pct_decode (beg);
+       e->list_post = rfc822_parse_adrlist (e->list_post, beg);
+      endlistpost:
+         FREE (&tmp);
+      }
+      matched = 1;
+    }
     break;
     
     case 'm':
diff --exclude muttrc.man -ur mutt-1.5.6/send.c mutt-1.5.6+HH/send.c
--- mutt-1.5.6/send.c   2004-02-01 18:10:58.000000000 +0100
+++ mutt-1.5.6+HH/send.c        2004-07-18 11:45:31.000000000 +0200
@@ -527,6 +527,10 @@
     tmp = find_mailing_lists (in->to, in->cc);
     rfc822_append (&out->to, tmp);
     rfc822_free_address (&tmp);
+    if (in->list_post)
+    {
+      rfc822_append (&out->to, in->list_post);
+    }
 
     if (in->mail_followup_to && hmfupto == M_YES &&
         default_to (&out->cc, in, flags & SENDLISTREPLY, hmfupto) == -1)
diff --exclude muttrc.man -ur mutt-1.5.6/url.c mutt-1.5.6+HH/url.c
--- mutt-1.5.6/url.c    2003-11-05 10:41:34.000000000 +0100
+++ mutt-1.5.6+HH/url.c 2004-07-18 11:54:06.000000000 +0200
@@ -40,7 +40,7 @@
 };
 
 
-static void url_pct_decode (char *s)
+void url_pct_decode (char *s)
 {
   char *d;
 
diff --exclude muttrc.man -ur mutt-1.5.6/url.h mutt-1.5.6+HH/url.h
--- mutt-1.5.6/url.h    2002-01-24 13:10:52.000000000 +0100
+++ mutt-1.5.6+HH/url.h 2004-07-18 11:50:52.000000000 +0200
@@ -27,6 +27,7 @@
 ciss_url_t;
 
 url_scheme_t url_check_scheme (const char *s);
+void url_pct_decode (char *s);
 int url_parse_file (char *d, const char *src, size_t dl);
 int url_parse_ciss (ciss_url_t *ciss, char *src);
 int url_ciss_tostring (ciss_url_t* ciss, char* dest, size_t len, int flags);