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

Re: [PATCH] RFC 2369 support for list-reply



* Hugo Haas <hugo@xxxxxxxxx> [2004-07-18 12:10+0200]
> The attached patch is the beginning of support for RFC 2369. If an
> email address is found in the List-Post header, and if one uses the
> list-reply function, then this address is added to the list of
> recipients.

v1 had a minor issue: "NO" followed by some text wouldn't have been
recognized as a no. v2 fixes this issue.

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 13:00:43.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 (strncmp (p, "NO", 2))
+      {
+       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);

Attachment: signature.asc
Description: Digital signature