Bug 81549

Summary: mail/mutt-devel: add reverse_reply patch
Product: Ports & Packages Reporter: Ed Schouten <ed>
Component: Individual Port(s)Assignee: Pav Lucistnik <pav>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Ed Schouten 2005-05-27 11:30:01 UTC
This patch adds support for Mutt's reverse_reply patch, which gives you the ability to set an option which tries to resolve the correct names when replying to an email message. So if someone emails to a group of people without specifying the names with the addresses and you already have some of them in your aliases, Mutt will add the name to the To: and Cc: headers when replying.

Something like reverse_alias, but then for replying to messages. The patch is based on:

http://www.df7cb.de/projects/mutt/reverse_reply/patch-1.5.6.cb.reverse_reply.2

Fix: Below is a patch which should be applied to the ports tree to add a special build option called WITH_MUTT_REVERSE_REPLY_PATCH:
How-To-Repeat: n/a
Comment 1 Pav Lucistnik freebsd_committer 2005-05-28 15:36:37 UTC
Dear maintainer of FreeBSD port mail/mutt-devel, please take a look at

http://www.freebsd.org/cgi/query-pr.cgi?q=81549

Do you approve this patch?

-- 
Pav Lucistnik <pav@oook.cz>
              <pav@FreeBSD.org>

It whines, glows and fades...
Comment 2 Pav Lucistnik freebsd_committer 2005-05-28 15:36:39 UTC
State Changed
From-To: open->feedback

Asked maintainer for approval 


Comment 3 Pav Lucistnik freebsd_committer 2005-05-28 15:36:39 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pav

Track
Comment 4 Udo.Schweigert 2005-05-29 10:11:24 UTC
On Sat, May 28, 2005 at 16:36:37 +0200, Pav Lucistnik wrote:
> Dear maintainer of FreeBSD port mail/mutt-devel, please take a look at
> 
> http://www.freebsd.org/cgi/query-pr.cgi?q=81549
> 
> Do you approve this patch?

I have changed that a little (most important was to change the plist
accordingly). Please commit the attached patch.

Also: cvs add files/extra-patch-reverse_reply ;-)

Best regards

-- 
Udo Schweigert, Siemens AG   | Voice      : +49 89 636 42170
CT IC CERT, Siemens CERT     | Fax        : +49 89 636 41166
D-81730 Muenchen / Germany   | email      : udo.schweigert@siemens.com

diff -ru  /usr/ports/mail/mutt-devel/Makefile ./Makefile
--- /usr/ports/mail/mutt-devel/Makefile	Wed May 18 19:50:14 2005
+++ ./Makefile	Sun May 29 09:39:35 2005
@@ -93,6 +93,9 @@
 # If you do not want mutt to use the flock() function define:
 #  WITHOUT_MUTT_FLOCK
 #
+# If you want to enable reverse_reply option define:
+#  WITH_MUTT_REVERSE_REPLY_PATCH
+#
 
 PORTNAME=	mutt-devel
 PORTVERSION=	1.5.9
@@ -309,6 +312,11 @@
 	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-aspell
 .endif
 
+.if defined(WITH_MUTT_REVERSE_REPLY_PATCH)
+pre-configure::
+	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-reverse_reply
+.endif
+
 .if defined(WITHOUT_MUTT_FLOCK)
 CONFIGURE_ARGS+=	--disable-flock
 .else
@@ -447,6 +455,9 @@
 .endif
 .if defined(WITH_MUTT_IDN)
 SCRIPTS_ENV+=	MUTT_IDN="yes"
+.endif
+.if defined(WITH_MUTT_REVERSE_REPLY_PATCH)
+SCRIPTS_ENV+=	MUTT_REVERSE_REPLY_PATCH="yes"
 .endif
 
 .if !defined(NOPORTDOCS)
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-reverse_reply ./files/extra-patch-reverse_reply
--- /usr/ports/mail/mutt-devel/files/extra-patch-reverse_reply	Thu Jan  1 01:00:00 1970
+++ ./files/extra-patch-reverse_reply	Sun May 29 09:49:24 2005
@@ -0,0 +1,92 @@
+diff -u PATCHES PATCHES
+--- PATCHES
++++ PATCHES
+@@ -0,0 +1 @@
++patch-1.5.6.cb.reverse_reply.2
+--- init.h.orig	2005-03-01 16:56:02.000000000 +0100
++++ init.h	2005-05-25 18:20:57.000000000 +0200
+@@ -2257,6 +2257,13 @@
+   ** possibly including eventual real names.  When it is unset, mutt will
+   ** override any such real names with the setting of the $realname variable.
+   */
++  { "reverse_reply",	DT_BOOL, R_NONE, OPTREVREPLY, 0 },
++  /*
++  ** .pp
++  ** When set, this variable uses the name from your aliases in the To and Cc
++  ** headers of reply mails you send, like $reverse_alias does in the index.
++  ** When unset, the headers taken from the original mail are left unchanged.
++  */
+   { "rfc2047_parameters", DT_BOOL, R_NONE, OPTRFC2047PARAMS, 0 },
+   /*
+   ** .pp
+--- mutt.h.orig	2005-02-28 16:13:57.000000000 +0100
++++ mutt.h	2005-05-25 18:20:57.000000000 +0200
+@@ -410,6 +410,7 @@
+   OPTREVALIAS,
+   OPTREVNAME,
+   OPTREVREAL,
++  OPTREVREPLY,
+   OPTRFC2047PARAMS,
+   OPTSAVEADDRESS,
+   OPTSAVEEMPTY,
+--- protos.h.orig	2005-02-01 09:59:02.000000000 +0100
++++ protos.h	2005-05-25 18:20:57.000000000 +0200
+@@ -84,6 +84,7 @@
+ ADDRESS *mutt_get_address (ENVELOPE *, char **);
+ ADDRESS *mutt_lookup_alias (const char *s);
+ ADDRESS *mutt_remove_duplicates (ADDRESS *);
++ADDRESS *mutt_reverse_address (ADDRESS *);
+ ADDRESS *mutt_expand_aliases (ADDRESS *);
+ ADDRESS *mutt_parse_adrlist (ADDRESS *, const char *);
+ 
+--- send.c.orig	2005-02-03 19:47:53.000000000 +0100
++++ send.c	2005-05-25 18:20:57.000000000 +0200
+@@ -588,6 +588,10 @@
+   /* the CC field can get cluttered, especially with lists */
+   env->to = mutt_remove_duplicates (env->to);
+   env->cc = mutt_remove_duplicates (env->cc);
++  if (option (OPTREVREPLY)){
++	env->to = mutt_reverse_address (env->to);
++	env->cc = mutt_reverse_address (env->cc);
++  }
+   env->cc = mutt_remove_xrefs (env->to, env->cc);
+ }
+ 
+--- sendlib.c.orig	2005-02-21 05:45:57.000000000 +0100
++++ sendlib.c	2005-05-25 18:20:57.000000000 +0200
+@@ -2341,6 +2341,35 @@
+   }
+ }
+ 
++/* given a list of addresses, return a list of reverse_alias'ed addresses */
++ADDRESS *mutt_reverse_address (ADDRESS *addr)
++{
++  ADDRESS *top,*tmp,*alias;
++
++  if (addr == NULL)
++    return NULL;
++
++  if ((alias = alias_reverse_lookup (addr)) && alias->personal) {
++    tmp = rfc822_cpy_adr_real(alias);
++    tmp->next = addr->next;
++    addr->next = NULL;
++    rfc822_free_address(&addr);
++    addr = tmp;
++  }
++
++  for (top = addr; top->next != NULL; top = tmp) {
++    tmp = top->next;
++    if ((alias = alias_reverse_lookup (tmp)) && alias->personal) {
++      top->next = rfc822_cpy_adr_real(alias);
++      top->next->next = tmp->next;
++      tmp->next = NULL;
++      rfc822_free_address(&tmp);
++      tmp = top->next;
++    }
++  }
++  return addr;
++}
++
+ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, char *fcc)
+ {
+   CONTEXT f;
diff -ru  /usr/ports/mail/mutt-devel/scripts/generate-plist ./scripts/generate-plist
--- /usr/ports/mail/mutt-devel/scripts/generate-plist	Sun May  8 16:54:08 2005
+++ ./scripts/generate-plist	Sun May 29 09:41:23 2005
@@ -160,6 +160,9 @@
     if [ "$MUTT_IDN" = "yes" ]; then
       html=$(($html + 1))
     fi
+    if [ "$MUTT_REVERSE_REPLY_PATCH" = "yes" ]; then
+      html=$(($html + 1))
+    fi
     if [ "$MUTT_SLAVE_HTML_PAGES" != "" ]; then
       html=$(($html + $MUTT_SLAVE_HTML_PAGES))
     fi
Comment 5 Udo.Schweigert 2005-05-29 10:11:24 UTC
On Sat, May 28, 2005 at 16:36:37 +0200, Pav Lucistnik wrote:
> Dear maintainer of FreeBSD port mail/mutt-devel, please take a look at
> 
> http://www.freebsd.org/cgi/query-pr.cgi?q=81549
> 
> Do you approve this patch?

I have changed that a little (most important was to change the plist
accordingly). Please commit the attached patch.

Also: cvs add files/extra-patch-reverse_reply ;-)

Best regards

-- 
Udo Schweigert, Siemens AG   | Voice      : +49 89 636 42170
CT IC CERT, Siemens CERT     | Fax        : +49 89 636 41166
D-81730 Muenchen / Germany   | email      : udo.schweigert@siemens.com

diff -ru  /usr/ports/mail/mutt-devel/Makefile ./Makefile
--- /usr/ports/mail/mutt-devel/Makefile	Wed May 18 19:50:14 2005
+++ ./Makefile	Sun May 29 09:39:35 2005
@@ -93,6 +93,9 @@
 # If you do not want mutt to use the flock() function define:
 #  WITHOUT_MUTT_FLOCK
 #
+# If you want to enable reverse_reply option define:
+#  WITH_MUTT_REVERSE_REPLY_PATCH
+#
 
 PORTNAME=	mutt-devel
 PORTVERSION=	1.5.9
@@ -309,6 +312,11 @@
 	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-aspell
 .endif
 
+.if defined(WITH_MUTT_REVERSE_REPLY_PATCH)
+pre-configure::
+	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-reverse_reply
+.endif
+
 .if defined(WITHOUT_MUTT_FLOCK)
 CONFIGURE_ARGS+=	--disable-flock
 .else
@@ -447,6 +455,9 @@
 .endif
 .if defined(WITH_MUTT_IDN)
 SCRIPTS_ENV+=	MUTT_IDN="yes"
+.endif
+.if defined(WITH_MUTT_REVERSE_REPLY_PATCH)
+SCRIPTS_ENV+=	MUTT_REVERSE_REPLY_PATCH="yes"
 .endif
 
 .if !defined(NOPORTDOCS)
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-reverse_reply ./files/extra-patch-reverse_reply
--- /usr/ports/mail/mutt-devel/files/extra-patch-reverse_reply	Thu Jan  1 01:00:00 1970
+++ ./files/extra-patch-reverse_reply	Sun May 29 09:49:24 2005
@@ -0,0 +1,92 @@
+diff -u PATCHES PATCHES
+--- PATCHES
++++ PATCHES
+@@ -0,0 +1 @@
++patch-1.5.6.cb.reverse_reply.2
+--- init.h.orig	2005-03-01 16:56:02.000000000 +0100
++++ init.h	2005-05-25 18:20:57.000000000 +0200
+@@ -2257,6 +2257,13 @@
+   ** possibly including eventual real names.  When it is unset, mutt will
+   ** override any such real names with the setting of the $realname variable.
+   */
++  { "reverse_reply",	DT_BOOL, R_NONE, OPTREVREPLY, 0 },
++  /*
++  ** .pp
++  ** When set, this variable uses the name from your aliases in the To and Cc
++  ** headers of reply mails you send, like $reverse_alias does in the index.
++  ** When unset, the headers taken from the original mail are left unchanged.
++  */
+   { "rfc2047_parameters", DT_BOOL, R_NONE, OPTRFC2047PARAMS, 0 },
+   /*
+   ** .pp
+--- mutt.h.orig	2005-02-28 16:13:57.000000000 +0100
++++ mutt.h	2005-05-25 18:20:57.000000000 +0200
+@@ -410,6 +410,7 @@
+   OPTREVALIAS,
+   OPTREVNAME,
+   OPTREVREAL,
++  OPTREVREPLY,
+   OPTRFC2047PARAMS,
+   OPTSAVEADDRESS,
+   OPTSAVEEMPTY,
+--- protos.h.orig	2005-02-01 09:59:02.000000000 +0100
++++ protos.h	2005-05-25 18:20:57.000000000 +0200
+@@ -84,6 +84,7 @@
+ ADDRESS *mutt_get_address (ENVELOPE *, char **);
+ ADDRESS *mutt_lookup_alias (const char *s);
+ ADDRESS *mutt_remove_duplicates (ADDRESS *);
++ADDRESS *mutt_reverse_address (ADDRESS *);
+ ADDRESS *mutt_expand_aliases (ADDRESS *);
+ ADDRESS *mutt_parse_adrlist (ADDRESS *, const char *);
+ 
+--- send.c.orig	2005-02-03 19:47:53.000000000 +0100
++++ send.c	2005-05-25 18:20:57.000000000 +0200
+@@ -588,6 +588,10 @@
+   /* the CC field can get cluttered, especially with lists */
+   env->to = mutt_remove_duplicates (env->to);
+   env->cc = mutt_remove_duplicates (env->cc);
++  if (option (OPTREVREPLY)){
++	env->to = mutt_reverse_address (env->to);
++	env->cc = mutt_reverse_address (env->cc);
++  }
+   env->cc = mutt_remove_xrefs (env->to, env->cc);
+ }
+ 
+--- sendlib.c.orig	2005-02-21 05:45:57.000000000 +0100
++++ sendlib.c	2005-05-25 18:20:57.000000000 +0200
+@@ -2341,6 +2341,35 @@
+   }
+ }
+ 
++/* given a list of addresses, return a list of reverse_alias'ed addresses */
++ADDRESS *mutt_reverse_address (ADDRESS *addr)
++{
++  ADDRESS *top,*tmp,*alias;
++
++  if (addr == NULL)
++    return NULL;
++
++  if ((alias = alias_reverse_lookup (addr)) && alias->personal) {
++    tmp = rfc822_cpy_adr_real(alias);
++    tmp->next = addr->next;
++    addr->next = NULL;
++    rfc822_free_address(&addr);
++    addr = tmp;
++  }
++
++  for (top = addr; top->next != NULL; top = tmp) {
++    tmp = top->next;
++    if ((alias = alias_reverse_lookup (tmp)) && alias->personal) {
++      top->next = rfc822_cpy_adr_real(alias);
++      top->next->next = tmp->next;
++      tmp->next = NULL;
++      rfc822_free_address(&tmp);
++      tmp = top->next;
++    }
++  }
++  return addr;
++}
++
+ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, char *fcc)
+ {
+   CONTEXT f;
diff -ru  /usr/ports/mail/mutt-devel/scripts/generate-plist ./scripts/generate-plist
--- /usr/ports/mail/mutt-devel/scripts/generate-plist	Sun May  8 16:54:08 2005
+++ ./scripts/generate-plist	Sun May 29 09:41:23 2005
@@ -160,6 +160,9 @@
     if [ "$MUTT_IDN" = "yes" ]; then
       html=$(($html + 1))
     fi
+    if [ "$MUTT_REVERSE_REPLY_PATCH" = "yes" ]; then
+      html=$(($html + 1))
+    fi
     if [ "$MUTT_SLAVE_HTML_PAGES" != "" ]; then
       html=$(($html + $MUTT_SLAVE_HTML_PAGES))
     fi
Comment 6 Pav Lucistnik freebsd_committer 2005-05-29 10:39:51 UTC
State Changed
From-To: feedback->closed

Committed, thanks!