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