Re: [PATCH] RFC 2369 support for list-reply
Hi Thomas.
* Thomas Glanzmann <sithglan@xxxxxxxxxxxxxxxxxxxx> [2004-07-18 17:11:33+0200]:
> thnx for providing the patch. However to make it work with imap and List
> replying *if message was NOT opened* before you need to add the
> list-post header to the want_headers in imap/message.c
Thanks. Attached is v3 which is v2 plus LIST-POST added to
want_headers.
Regards,
Hugo
--
Hugo Haas - http://larve.net/people/hugo/
diff --exclude muttrc.man -ur mutt-1.5.6/imap/message.c
mutt-1.5.6+HH/imap/message.c
--- mutt-1.5.6/imap/message.c 2003-11-05 10:41:36.000000000 +0100
+++ mutt-1.5.6+HH/imap/message.c 2004-07-18 20:03:28.000000000 +0200
@@ -55,7 +55,7 @@
IMAP_HEADER h;
int rc, mfhrc, oldmsgcount;
int fetchlast = 0;
- const char *want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES
CONTENT-TYPE IN-REPLY-TO REPLY-TO LINES X-LABEL";
+ const char *want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES
CONTENT-TYPE IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL";
ctx = idata->ctx;
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);