--- mutt-1.3.25/PATCHES.orig Wed Jan 16 14:58:56 2002 +++ mutt-1.3.25/PATCHES Wed Jan 16 14:58:51 2002 @@ -0,0 +1 @@ +Feature patch: status-time 1.3.25 by Byrial Jensen --- mutt-1.3.25/curs_main.c.orig Thu Nov 8 09:56:02 2001 +++ mutt-1.3.25/curs_main.c Wed Jan 16 14:55:29 2002 @@ -546,7 +546,8 @@ menu_redraw_current (menu); } - if (menu->redraw & REDRAW_STATUS) + if ((menu->redraw & REDRAW_STATUS) || + update_status_time ()) { menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2); --- mutt-1.3.25/doc/manual.sgml.orig Wed Jan 16 15:00:10 2002 +++ mutt-1.3.25/doc/manual.sgml Wed Jan 16 14:57:23 2002 @@ -5767,6 +5767,7 @@ %u number of unread messages * %v Mutt version string %V currently active limit pattern, if any * +%[fmt] the current date and time. `fmt'' is expanded by the system call ``strftime''; a leading bang disables locales %>X right justify the rest of the string and pad with &dquot;X&dquot; %|X pad to the end of the line with &dquot;X&dquot; --- mutt-1.3.25/globals.h.orig Wed Nov 21 14:53:25 2001 +++ mutt-1.3.25/globals.h Wed Jan 16 14:57:40 2002 @@ -144,6 +144,7 @@ WHERE short PagerIndexLines; WHERE short ReadInc; WHERE short SendmailWait; +WHERE short StatusUpdate; WHERE short SleepTime INITVAL (1); WHERE short Timeout; WHERE short WrapMargin; --- mutt-1.3.25/init.h.orig Mon Dec 10 11:09:03 2001 +++ mutt-1.3.25/init.h Wed Jan 16 14:58:38 2002 @@ -2160,6 +2160,10 @@ ** Setting this variable causes the ``status bar'' to be displayed on ** the first line of the screen rather than near the bottom. */ + { "status_update", DT_NUM, R_NONE, UL &StatusUpdate, -1 }, + /* + ** .pp + */ { "strict_threads", DT_BOOL, R_RESORT|R_RESORT_INIT|R_INDEX, OPTSTRICTTHREADS, 0 }, /* ** .pp --- mutt-1.3.25/menu.c.orig Thu Dec 13 13:10:49 2001 +++ mutt-1.3.25/menu.c Wed Jan 16 14:55:36 2002 @@ -1045,3 +1045,23 @@ } /* not reached */ } + +int update_status_time () +{ + static time_t Last; + time_t now; + + if (StatusUpdate < 0) + return 0; + else if (StatusUpdate == 0) + return 1; + + now = time (NULL); + if (now - Last >= StatusUpdate) + { + Last = now; + return 1; + } + else + return 0; +} --- mutt-1.3.25/mutt_menu.h.orig Tue Sep 11 13:08:13 2001 +++ mutt-1.3.25/mutt_menu.h Wed Jan 16 14:55:36 2002 @@ -107,3 +107,5 @@ /* used in both the index and pager index to make an entry. */ void index_make_entry (char *, size_t, struct menu_t *, int); int index_color (int); + +int update_status_time (void); --- mutt-1.3.25/pager.c.orig Fri Dec 21 01:21:03 2001 +++ mutt-1.3.25/pager.c Wed Jan 16 14:55:36 2002 @@ -1712,7 +1712,7 @@ SETCOLOR (MT_COLOR_NORMAL); } - if ((redraw & REDRAW_INDEX) && index) + if (index && ((redraw & REDRAW_INDEX) || update_status_time ())) { /* redraw the pager_index indicator, because the * flags for this message might have changed. */ --- mutt-1.3.25/status.c.orig Fri Mar 3 11:10:14 2000 +++ mutt-1.3.25/status.c Wed Jan 16 14:55:36 2002 @@ -26,6 +26,7 @@ #include #include #include +#include static char *get_sort_str (char *buf, size_t buflen, int method) { @@ -275,6 +276,61 @@ case 0: *buf = 0; return (src); + + case '[': + { + int do_locales; + int len = sizeof (fmt) - 1; + + cp = fmt; + if (*src == '!') + { + do_locales = 0; + src++; + } + else + do_locales = 1; + + while (len > 0 && *src != ']') + { + if (*src == '%') + { + src++; + if (len >= 2) + { + *cp++ = '%'; + *cp++ = *src; + len -= 2; + } + else + break; /* not enough space */ + src++; + } + else + { + *cp++ = *src++; + len--; + } + } + *cp = 0; + src++; + + if (do_locales && Locale) + setlocale (LC_TIME, Locale); + + { + time_t now = time (NULL); + + strftime (tmp, sizeof (tmp), fmt, localtime (&now)); + } + + if (do_locales && Locale) + setlocale (LC_TIME, "C"); + + snprintf (fmt, sizeof (fmt), "%%%ss", prefix); + snprintf (buf, buflen, fmt, tmp); + } + break; default: snprintf (buf, buflen, "%%%s%c", prefix, op);