1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-29 01:13:08 +00:00
freebsd-ports/mail/mutt/files/extra-patch-greeting
Chris Rees bb040dde3e Move mail/mutt to mail/mutt14
Move mail/mutt-lite to mail/mutt14-lite

Move mail/mutt-devel to mail/mutt

Moving mail/mutt-devel-lite to mail/mutt-lite will follow next to avoid
breaking the cvs exporter

PR:		ports/169546
Suggested by:	obrien
Approved by:	maintainer
2012-07-22 09:15:04 +00:00

161 lines
4.6 KiB
Plaintext

diff -urN mutt-1.5.19/globals.h mutt-1.5.19-vc/globals.h
--- mutt-1.5.19/globals.h 2009-01-04 01:27:10.000000000 +0200
+++ mutt-1.5.19-vc/globals.h 2009-02-09 19:30:31.000000000 +0200
@@ -52,6 +52,7 @@
WHERE char *FolderFormat;
WHERE char *ForwFmt;
WHERE char *Fqdn;
+WHERE char *Greeting;
WHERE char *HdrFmt;
WHERE char *HistFile;
WHERE char *Homedir;
diff -urN mutt-1.5.19/hdrline.c mutt-1.5.19-vc/hdrline.c
--- mutt-1.5.19/hdrline.c 2009-01-05 21:20:53.000000000 +0200
+++ mutt-1.5.19-vc/hdrline.c 2009-02-09 19:30:31.000000000 +0200
@@ -741,3 +741,62 @@
{
mutt_FormatString (dst, dstlen, 0, s, hdr_format_str, (unsigned long) hfi, flags);
}
+
+/* %n = recipient name
+ * %u = user (login) name of recipient
+ * %v = first name of recipient */
+const char *
+greeting_string (char *dest,
+ size_t destlen,
+ size_t col,
+ char op,
+ const char *src,
+ const char *prefix,
+ const char *ifstring,
+ const char *elsestring,
+ unsigned long data,
+ format_flag flags)
+{
+ HEADER *hdr = (HEADER *)data;
+ char *p, buf2[SHORT_STRING];
+
+ dest[0] = '\0';
+ switch (op)
+ {
+ case 'n':
+ mutt_format_s (dest, destlen, prefix, mutt_get_name (hdr->env->to));
+ break;
+
+ case 'u':
+ if (hdr->env->to)
+ {
+ strfcpy (buf2, mutt_addr_for_display (hdr->env->to), sizeof (buf2));
+ if ((p = strpbrk (buf2, "%@")))
+ *p = '\0';
+ }
+ else
+ buf2[0] = '\0';
+ mutt_format_s (dest, destlen, prefix, buf2);
+ break;
+
+ case 'v':
+ if (hdr->env->to)
+ mutt_format_s (buf2, sizeof (buf2), prefix, mutt_get_name (hdr->env->to));
+ else if (hdr->env->cc)
+ mutt_format_s (buf2, sizeof (buf2), prefix, mutt_get_name (hdr->env->cc));
+ else
+ *buf2 = '\0';
+ if ((p = strpbrk (buf2, " %@")))
+ *p = '\0';
+ mutt_format_s (dest, destlen, prefix, buf2);
+ break;
+
+ default:
+ snprintf (dest, destlen, "%%%s%c", prefix, op);
+ break;
+ }
+ if (flags & M_FORMAT_OPTIONAL)
+ mutt_FormatString (dest, destlen, col, elsestring, greeting_string, data, flags);
+
+ return(src);
+}
diff -urN mutt-1.5.19/init.h mutt-1.5.19-vc/init.h
--- mutt-1.5.19/init.h 2009-01-05 21:20:53.000000000 +0200
+++ mutt-1.5.19-vc/init.h 2009-02-09 19:30:31.000000000 +0200
@@ -745,6 +745,22 @@
** .pp
** This setting defaults to the contents of the environment variable \fC$$$EMAIL\fP.
*/
+ { "greeting", DT_STR, R_NONE, UL &Greeting, UL "" },
+ /*
+ ** .pp
+ ** When set, this is the string that will precede every message as a
+ ** greeting phrase to the recipients.
+ ** .pp
+ ** ``Format strings'' are similar to the strings used in the ``C''
+ ** function printf to format output (see the man page for more detail).
+ ** The following sequences are defined in Mutt:
+ ** .pp
+ ** .dl
+ ** .dt %n .dd recipient name
+ ** .dt %u .dd user (login) name of recipient
+ ** .dt %v .dd first name of recipient
+ ** .de
+ */
{ "gecos_mask", DT_RX, R_NONE, UL &GecosMask, UL "^[^,]*" },
/*
** .pp
diff -urN mutt-1.5.19/PATCHES mutt-1.5.19-vc/PATCHES
--- mutt-1.5.19/PATCHES 2008-03-19 22:07:06.000000000 +0200
+++ mutt-1.5.19-vc/PATCHES 2009-02-09 19:30:31.000000000 +0200
@@ -0,0 +1 @@
+vc.greeting
diff -urN mutt-1.5.19/protos.h mutt-1.5.19-vc/protos.h
--- mutt-1.5.19/protos.h 2009-01-05 21:20:53.000000000 +0200
+++ mutt-1.5.19-vc/protos.h 2009-02-09 19:32:15.000000000 +0200
@@ -526,6 +526,9 @@
void ci_bounce_message (HEADER *, int *);
int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *);
+const char *greeting_string (char *, size_t, size_t, char, const char *, const char *,
+ const char *, const char *, unsigned long, format_flag);
+
/* prototypes for compatibility functions */
#ifndef HAVE_SETENV
diff -urN mutt-1.5.19/send.c mutt-1.5.19-vc/send.c
--- mutt-1.5.19/send.c.orig 2010-09-17 16:49:09.000000000 +0200
+++ mutt-1.5.19-vc/send.c 2010-09-17 16:53:15.000000000 +0200
@@ -469,6 +469,18 @@
}
}
+void mutt_make_greeting (HEADER *hdr, FILE *out, int flags)
+{
+ char buffer[STRING];
+ if (Greeting)
+ {
+ mutt_FormatString(buffer, sizeof(buffer), 0, Greeting, greeting_string,
+ (unsigned long) hdr, flags);
+ fputs(buffer, out);
+ fputc ('\n', out);
+ }
+}
+
void mutt_make_post_indent (CONTEXT *ctx, HEADER *cur, FILE *out)
{
char buffer[STRING];
@@ -1003,7 +1015,6 @@
}
}
-
/* look through the recipients of the message we are replying to, and if
we find an address that matches $alternates, we use that as the default
from field */
@@ -1439,6 +1450,8 @@
if (option (OPTHDRS))
process_user_header (msg->env);
+ mutt_make_greeting(msg, tempfp, flags);
+
if (flags & SENDBATCH)
mutt_copy_stream (stdin, tempfp);