1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-06 11:41:52 +00:00
freebsd-ports/mail/mutt/files/patch-date-conditional
Thomas Zander 5d30a915d6 Update to upstream release 1.9.2
Detailed maintainer log:
- Update to mutt 1.9.2
- Bring ats date-conditional back as a local patch file
  - Due to the patch not having versioning an update can break the port
    if the hash of the file changes
- Update greeting patch to 1.9.1

PR:		224374
Submitted by:	dereks@lifeofadishwasher.com (maintainer)
Differential Revision:	https://reviews.freebsd.org/D13509
2017-12-17 16:46:05 +00:00

98 lines
1.8 KiB
Plaintext

--- PATCHES.orig 2017-12-03 03:10:17 UTC
+++ PATCHES
@@ -0,0 +1 @@
+patch-1.5.0.ats.date_conditional.1
--- hdrline.c.orig 2017-12-03 03:10:17 UTC
+++ hdrline.c
@@ -428,6 +428,53 @@ hdr_format_str (char *dest,
const char *cp;
struct tm *tm;
time_t T;
+ int i = 0, invert = 0;
+
+ if (optional && (op == '[' || op == '(')) {
+ char *is;
+ T = time(NULL);
+ T -= (op == '(') ? hdr->received : hdr->date_sent;
+
+ is = (char *)prefix;
+ if( *is == '>' ) {
+ invert = 1;
+ ++is;
+ }
+
+ while( *is && *is != '?' ) {
+ int t = strtol (is, &is, 10);
+ switch (*(is++)) {
+ case '?':
+ break;
+ case 'y':
+ t *= 365 * 24 * 60 * 60;
+ break;
+ case 'M':
+ t *= 30 * 24 * 60 * 60;
+ break;
+ case 'w':
+ t *= 7 * 24 * 60 * 60;
+ break;
+ case 'd':
+ t *= 24 * 60 * 60;
+ break;
+ case 'h':
+ t *= 60 * 60;
+ break;
+ case 'm':
+ t *= 60;
+ break;
+ }
+ i += t;
+ }
+
+ if (i < 0)
+ i *= -1;
+
+ if( (T > i || T < -1*i) ^ invert )
+ optional = 0;
+ break;
+ }
p = dest;
--- muttlib.c.orig 2017-12-03 03:10:17 UTC
+++ muttlib.c
@@ -1335,7 +1335,16 @@ void mutt_FormatString (char *dest, /*
if (*src == '?')
{
flags |= MUTT_FORMAT_OPTIONAL;
- src++;
+ ch = *(++src); /* save the character to switch on */
+ cp = prefix;
+ ++src;
+ count = 0;
+ while (count < sizeof (prefix) && *src != '?')
+ {
+ *cp++ = *src++;
+ count++;
+ }
+ *cp = 0;
}
else
{
@@ -1351,12 +1360,12 @@ void mutt_FormatString (char *dest, /*
count++;
}
*cp = 0;
- }
- if (!*src)
- break; /* bad format */
+ if (!*src)
+ break; /* bad format */
- ch = *src++; /* save the character to switch on */
+ ch = *src++; /* save the character to switch on */
+ }
if (flags & MUTT_FORMAT_OPTIONAL)
{