]> git.pld-linux.org Git - packages/mutt.git/blame - mutt-bj.status-time.patch
- massive change: BR: openssl-devel >= 0.9.6m
[packages/mutt.git] / mutt-bj.status-time.patch
CommitLineData
6f7ac9b9 1diff -Nur mutt-1.3.25-2/curs_main.c mutt-1.3.25/curs_main.c
2--- mutt-1.3.25-2/curs_main.c Tue Jan 22 00:06:44 2002
3+++ mutt-1.3.25/curs_main.c Tue Jan 22 00:07:02 2002
4@@ -546,7 +546,7 @@
5 menu_redraw_current (menu);
6 }
7
8- if (menu->redraw & REDRAW_STATUS)
9+ if ((menu->redraw & REDRAW_STATUS) || update_status_time ())
10 {
11 menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
12 CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);
13diff -Nur mutt-1.3.25-2/globals.h mutt-1.3.25/globals.h
14--- mutt-1.3.25-2/globals.h Tue Jan 22 00:06:44 2002
15+++ mutt-1.3.25/globals.h Tue Jan 22 00:07:02 2002
16@@ -145,6 +145,7 @@
17 WHERE short ReadInc;
18 WHERE short SendmailWait;
19 WHERE short SleepTime INITVAL (1);
20+WHERE short StatusUpdate;
21 WHERE short Timeout;
22 WHERE short WrapMargin;
23 WHERE short WriteInc;
24diff -Nur mutt-1.3.25-2/init.h mutt-1.3.25/init.h
25--- mutt-1.3.25-2/init.h Tue Jan 22 00:06:44 2002
26+++ mutt-1.3.25/init.h Tue Jan 22 00:09:07 2002
27@@ -2119,6 +2119,9 @@
28 ** .dt %u .dd number of unread messages *
29 ** .dt %v .dd Mutt version string
30 ** .dt %V .dd currently active limit pattern, if any *
31+ ** .dt %[fmt] .dd the current date and time. ``fmt'' is
32+ ** expanded by the system call ``strftime'';
33+ ** a leading bang disables locales
34 ** .dt %>X .dd right justify the rest of the string and pad with "X"
35 ** .dt %|X .dd pad to the end of the line with "X"
36 ** .de
37@@ -2160,6 +2163,16 @@
38 ** Setting this variable causes the ``status bar'' to be displayed on
39 ** the first line of the screen rather than near the bottom.
40 */
41+ { "status_update", DT_NUM, R_NONE, UL &StatusUpdate, -1 },
42+ /*
43+ ** .pp
44+ ** This variable controls, if positive, the maximum interval in seconds
45+ ** before the time in the status line is updated. It is checked at
46+ ** every key press and after a keyboard $$timeout.
47+ ** If the value is zero, the status line will be updated at every check.
48+ ** If it is negative, the status time will only be updated
49+ ** if it necessary to update to the status line for some other reason.
50+ */
51 { "strict_threads", DT_BOOL, R_RESORT|R_RESORT_INIT|R_INDEX, OPTSTRICTTHREADS, 0 },
52 /*
53 ** .pp
54diff -Nur mutt-1.3.25-2/menu.c mutt-1.3.25/menu.c
55--- mutt-1.3.25-2/menu.c Tue Jan 22 00:06:44 2002
56+++ mutt-1.3.25/menu.c Tue Jan 22 00:07:02 2002
57@@ -1045,3 +1045,23 @@
58 }
59 /* not reached */
60 }
61+
62+int update_status_time ()
63+{
64+ static time_t Last;
65+ time_t now;
66+
67+ if (StatusUpdate < 0)
68+ return 0;
69+ else if (StatusUpdate == 0)
70+ return 1;
71+
72+ now = time (NULL);
73+ if (now - Last >= StatusUpdate)
74+ {
75+ Last = now;
76+ return 1;
77+ }
78+ else
79+ return 0;
80+}
81diff -Nur mutt-1.3.25-2/mutt_menu.h mutt-1.3.25/mutt_menu.h
82--- mutt-1.3.25-2/mutt_menu.h Tue Jan 22 00:06:44 2002
83+++ mutt-1.3.25/mutt_menu.h Tue Jan 22 00:07:02 2002
84@@ -107,3 +107,5 @@
85 /* used in both the index and pager index to make an entry. */
86 void index_make_entry (char *, size_t, struct menu_t *, int);
87 int index_color (int);
88+
89+int update_status_time (void);
90diff -Nur mutt-1.3.25-2/pager.c mutt-1.3.25/pager.c
91--- mutt-1.3.25-2/pager.c Tue Jan 22 00:06:44 2002
92+++ mutt-1.3.25/pager.c Tue Jan 22 00:07:02 2002
93@@ -1712,7 +1712,7 @@
94 SETCOLOR (MT_COLOR_NORMAL);
95 }
96
97- if ((redraw & REDRAW_INDEX) && index)
98+ if (index && ((redraw & REDRAW_INDEX) || update_status_time ()))
99 {
100 /* redraw the pager_index indicator, because the
101 * flags for this message might have changed. */
102diff -Nur mutt-1.3.25-2/status.c mutt-1.3.25/status.c
103--- mutt-1.3.25-2/status.c Tue Jan 22 00:06:44 2002
104+++ mutt-1.3.25/status.c Tue Jan 22 00:07:02 2002
105@@ -26,6 +26,7 @@
106 #include <string.h>
107 #include <ctype.h>
108 #include <unistd.h>
109+#include <locale.h>
110
111 static char *get_sort_str (char *buf, size_t buflen, int method)
112 {
113@@ -284,6 +285,61 @@
114 *buf = 0;
115 return (src);
116
117+ case '[':
118+ {
119+ int do_locales;
120+ int len = sizeof (fmt) - 1;
121+
122+ cp = fmt;
123+ if (*src == '!')
124+ {
125+ do_locales = 0;
126+ src++;
127+ }
128+ else
129+ do_locales = 1;
130+
131+ while (len > 0 && *src != ']')
132+ {
133+ if (*src == '%')
134+ {
135+ src++;
136+ if (len >= 2)
137+ {
138+ *cp++ = '%';
139+ *cp++ = *src;
140+ len -= 2;
141+ }
142+ else
143+ break; /* not enough space */
144+ src++;
145+ }
146+ else
147+ {
148+ *cp++ = *src++;
149+ len--;
150+ }
151+ }
152+ *cp = 0;
153+ src++;
154+
155+ if (do_locales && Locale)
156+ setlocale (LC_TIME, Locale);
157+
158+ {
159+ time_t now = time (NULL);
160+
161+ strftime (tmp, sizeof (tmp), fmt, localtime (&now));
162+ }
163+
164+ if (do_locales && Locale)
165+ setlocale (LC_TIME, "C");
166+
167+ snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
168+ snprintf (buf, buflen, fmt, tmp);
169+ }
170+ break;
171+
172 default:
173 snprintf (buf, buflen, "%%%s%c", prefix, op);
174 break;
175
This page took 0.13082 seconds and 4 git commands to generate.