--- mutt-1.5.8/PATCHES~ never +++ mutt-1.5.8/PATCHES Tue Feb 22 15:34:44 CST 2005 @@ -1,0 +1 @@ +patch-1.5.8.ats.date_conditional.1 diff -Pur mutt-1.5.8-base/hdrline.c mutt-1.5.8/hdrline.c --- mutt-1.5.8-base/hdrline.c Sat Feb 12 12:53:35 2005 +++ mutt-1.5.8/hdrline.c Tue Feb 22 15:34:44 2005 @@ -322,6 +322,53 @@ 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; diff -Pur mutt-1.5.8-base/muttlib.c mutt-1.5.8/muttlib.c --- mutt-1.5.8-base/muttlib.c Sat Feb 12 13:30:16 2005 +++ mutt-1.5.8/muttlib.c Tue Feb 22 15:34:44 2005 @@ -956,7 +956,16 @@ if (*src == '?') { flags |= M_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 { @@ -972,12 +981,12 @@ 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 & M_FORMAT_OPTIONAL) {