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