1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-20 00:21:35 +00:00

- Add WITH_MUTT_GREETING_PATCH knob.

PR:		ports/107680
Submitted by:	Udo Schweigert <udo.schweigert@siemens.com> (maintainer)
This commit is contained in:
Martin Wilke 2007-01-09 22:10:26 +00:00
parent 135bbb848e
commit 33dd1af8b3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=181905
2 changed files with 154 additions and 0 deletions

View File

@ -104,6 +104,9 @@
# If you want to enable the assumed_charset option define:
# WITH_MUTT_ASSUMED_CHARSET_PATCH
#
# If you want to enable the `greeting' option define:
# WITH_MUTT_GREETING_PATCH
#
PORTNAME= mutt-devel
PORTVERSION= 1.5.13
@ -203,6 +206,11 @@ IGNORE= cannot install: the WITH_MUTT_SIDEBAR_PATCH and WITH_MUTT_NNTP are not c
IGNORE= cannot install: the WITH_MUTT_ASSUMED_CHARSET_PATCH and WITH_MUTT_NNTP are not compatible
.endif
.endif
.if defined(WITH_MUTT_GREETING_PATCH)
.if defined(WITH_MUTT_NNTP)
IGNORE= cannot install: the WITH_MUTT_GREETING_PATCH and WITH_MUTT_NNTP are not compatible
.endif
.endif
.if defined (MUTT_LITE)
WITHOUT_MUTT_XML= yes
@ -339,6 +347,11 @@ post-patch::
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-reverse_reply
.endif
.if defined(WITH_MUTT_GREETING_PATCH)
post-patch::
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-greeting
.endif
.if defined(WITHOUT_MUTT_FLOCK)
CONFIGURE_ARGS+= --disable-flock
.else

View File

@ -0,0 +1,141 @@
--- globals.h.orig 2006-08-11 12:07:12.000000000 +0300
+++ globals.h 2006-12-14 12:26:14.000000000 +0200
@@ -50,6 +50,7 @@
WHERE char *FolderFormat;
WHERE char *ForwFmt;
WHERE char *Fqdn;
+WHERE char *Greeting;
WHERE char *HdrFmt;
WHERE char *Homedir;
WHERE char *Hostname;
--- hdrline.c.orig 2006-04-28 22:43:51.000000000 +0300
+++ hdrline.c 2006-12-14 16:47:16.000000000 +0200
@@ -730,3 +730,61 @@
mutt_FormatString (dest, destlen, 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,
+ 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, elsestring, greeting_string, data, flags);
+
+ return(src);
+}
--- init.h.orig 2006-08-11 12:04:04.000000000 +0300
+++ init.h 2006-12-14 16:49:16.000000000 +0200
@@ -710,6 +710,22 @@
** a regular expression that will match the whole name so mutt will expand
** "Franklin" to "Franklin, Steve".
*/
+ { "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
+ */
{ "hdr_format", DT_SYN, R_NONE, UL "index_format", 0 },
/*
*/
--- PATCHES.orig 2006-08-11 13:55:43.000000000 +0300
+++ PATCHES 2006-12-14 15:59:14.000000000 +0200
@@ -0,0 +1 @@
+vc.greeting
--- protos.h.orig 2006-07-12 02:32:28.000000000 +0300
+++ protos.h 2006-12-14 15:43:09.000000000 +0200
@@ -509,4 +509,5 @@
void ci_bounce_message (HEADER *, int *);
int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *);
-
+const char *greeting_string (char *, size_t, char, const char *, const char *,
+ const char *, const char *, unsigned long, format_flag);
--- send.c.orig 2006-03-03 12:12:34.000000000 +0200
+++ send.c 2006-12-14 15:57:36.000000000 +0200
@@ -395,6 +395,18 @@
}
}
+void mutt_make_greeting (HEADER *hdr, FILE *out, int flags)
+{
+ char buffer[STRING];
+ if (Greeting)
+ {
+ mutt_FormatString(buffer, sizeof(buffer), 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];
@@ -1268,6 +1280,7 @@
if (option (OPTHDRS))
process_user_header (msg->env);
+ mutt_make_greeting(msg, tempfp, flags);
if (option (OPTSIGONTOP) && (! (flags & (SENDMAILX | SENDKEY)) && Editor && mutt_strcmp (Editor, "builtin") != 0))
append_signature (tempfp);