Changeset View
Changeset View
Standalone View
Standalone View
mail/mutt/files/extra-patch-smartdate
--- mutt.h | --- hdrline.c.orig 2017-02-24 18:29:36 UTC | ||||
+++ mutt.h | |||||
@@ -133,6 +133,16 @@ | |||||
M_FORMAT_NOFILTER = (1<<7) /* do not allow filtering on this pass */ | |||||
} format_flag; | |||||
+/* flags for SmartDate */ | |||||
+typedef enum { | |||||
+ FUTURE = 1, | |||||
+ SMARTTIME = 2, | |||||
+ YESTERDAY = 3, | |||||
+ WEEKDAY = 4, | |||||
+ STANDARD = 5, | |||||
+ ANCIENT = 6 | |||||
+} smartdate_type; | |||||
+ | |||||
/* types for mutt_add_hook() */ | |||||
#define M_FOLDERHOOK 1 | |||||
#define M_MBOXHOOK (1<<1) | |||||
--- hdrline.c | |||||
+++ hdrline.c | +++ hdrline.c | ||||
@@ -231,6 +231,89 @@ | @@ -248,6 +248,89 @@ static char *apply_subject_mods (ENVELOP | ||||
* %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label) | * %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label) | ||||
* %Z = status flags */ | * %Z = status flags */ | ||||
+static void | +static void | ||||
+format_smartdate( char *buf, size_t max, struct tm *tm, smartdate_type type ) | +format_smartdate( char *buf, size_t max, struct tm *tm, smartdate_type type ) | ||||
+{ | +{ | ||||
+ char *strftime_fmt = NULL; | + char *strftime_fmt = NULL; | ||||
+ | + | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
+ } | + } | ||||
+ | + | ||||
+ format_smartdate( buf, max, tm, type ); | + format_smartdate( buf, max, tm, type ); | ||||
+} | +} | ||||
+ | + | ||||
static const char * | static const char * | ||||
hdr_format_str (char *dest, | hdr_format_str (char *dest, | ||||
size_t destlen, | size_t destlen, | ||||
@@ -462,7 +545,13 @@ | @@ -421,7 +504,13 @@ hdr_format_str (char *dest, | ||||
tm = gmtime (&T); | |||||
} | |||||
if (!do_locales) | |||||
setlocale (LC_TIME, "C"); | |||||
- strftime (buf2, sizeof (buf2), dest, tm); | - strftime (buf2, sizeof (buf2), dest, tm); | ||||
+ /* Identify the non-strftime smartdate pattern (%@) */ | + /* Identify the non-strftime smartdate pattern (%@) */ | ||||
+ if( strncmp( dest, "%@", 2 ) == 0 ) { | + if( strncmp( dest, "%@", 2 ) == 0 ) { | ||||
+ smartdate( buf2, sizeof( buf2 ), tm ); | + smartdate( buf2, sizeof( buf2 ), tm ); | ||||
+ } | + } | ||||
+ else { | + else { | ||||
+ strftime (buf2, sizeof (buf2), dest, tm); | + strftime (buf2, sizeof (buf2), dest, tm); | ||||
+ } | + } | ||||
if (!do_locales) | |||||
setlocale (LC_TIME, ""); | |||||
if (do_locales) | --- mutt.h.orig 2017-02-24 18:29:36 UTC | ||||
setlocale (LC_TIME, "C"); | +++ mutt.h | ||||
@@ -134,6 +134,16 @@ typedef enum | |||||
MUTT_FORMAT_NOFILTER = (1<<7) /* do not allow filtering on this pass */ | |||||
} format_flag; | |||||
+/* flags for SmartDate */ | |||||
+typedef enum { | |||||
+ FUTURE = 1, | |||||
+ SMARTTIME = 2, | |||||
+ YESTERDAY = 3, | |||||
+ WEEKDAY = 4, | |||||
+ STANDARD = 5, | |||||
+ ANCIENT = 6 | |||||
+} smartdate_type; | |||||
+ | |||||
/* types for mutt_add_hook() */ | |||||
#define MUTT_FOLDERHOOK 1 | |||||
#define MUTT_MBOXHOOK (1<<1) |