]> git.pld-linux.org Git - packages/mutt.git/blob - mutt-bj.status-time.patch
- updated to 2.1.4
[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.20.b/curs_main.c   2009-07-14 12:34:25.000000000 +0200
3 +++ mutt-1.5.20/curs_main.c     2009-07-14 12:42:41.000000000 +0200
4 @@ -556,7 +556,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      mutt_window_move (MuttStatusWindow, 0, 0);
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 --- mutt-2.0.6/init.h.orig      2021-03-06 19:06:37.000000000 +0000
24 +++ mutt-2.0.6/init.h   2021-04-07 17:25:21.720777040 +0000
25 @@ -4197,6 +4197,8 @@
26    ** .dt %u  .dd number of unread messages *
27    ** .dt %v  .dd Mutt version string
28    ** .dt %V  .dd currently active limit pattern, if any *
29 +  ** .dt %[fmt] .dd the current date and time. ``fmt'' is
30 +  **                expanded by the system call ``strftime'';
31    ** .dt %>X .dd right justify the rest of the string and pad with ``X''
32    ** .dt %|X .dd pad to the end of the line with ``X''
33    ** .dt %*X .dd soft-fill with character ``X'' as pad
34 @@ -4248,6 +4250,16 @@
35    ** the first line of the screen rather than near the bottom. If $$help
36    ** is \fIset\fP, too it'll be placed at the bottom.
37    */
38 +  { "status_update",  DT_NUM, R_NONE, {.p=&StatusUpdate}, {.l=-1} },
39 +  /*
40 +  ** .pp
41 +  ** This variable controls, if positive, the maximum interval in seconds
42 +  ** before the time in the status line is updated. It is checked at
43 +  ** every key press and after a keyboard $$timeout.
44 +  ** If the value is zero, the status line will be updated at every check.
45 +  ** If it is negative, the status time will only be updated
46 +  ** if it necessary to update to the status line for some other reason.
47 +  */
48    { "strict_threads",  DT_BOOL, R_RESORT|R_RESORT_INIT|R_INDEX, {.l=OPTSTRICTTHREADS}, {.l=0} },
49    /*
50    ** .pp
51 diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/menu.c mutt-1.5.10/menu.c
52 --- mutt-1.5.10.orig/menu.c     2005-06-12 20:32:46.000000000 +0200
53 +++ mutt-1.5.10/menu.c  2005-10-07 09:28:24.000000000 +0200
54 @@ -1087,3 +1087,23 @@
55    }
56    /* not reached */
57  }
58 +
59 +int update_status_time ()
60 +{
61 +  static time_t Last;
62 +  time_t now;
63 +
64 +  if (StatusUpdate < 0)
65 +    return 0;
66 +  else if (StatusUpdate == 0)
67 +    return 1;
68 +
69 +  now = time (NULL);
70 +  if (now - Last >= StatusUpdate)
71 +  {
72 +    Last = now;
73 +    return 1;
74 +  }
75 +  else
76 +    return 0;
77 +}
78 diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/mutt_menu.h mutt-1.5.10/mutt_menu.h
79 --- mutt-1.5.10.orig/mutt_menu.h        2005-08-11 21:37:02.000000000 +0200
80 +++ mutt-1.5.10/mutt_menu.h     2005-10-07 09:28:59.000000000 +0200
81 @@ -112,4 +112,5 @@
82  void index_make_entry (char *, size_t, struct menu_t *, int);
83  COLOR_ATTR index_color (int);
84  
85 +int update_status_time (void);
86  #endif /* _MUTT_MENU_H_ */
87 diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/pager.c mutt-1.5.10/pager.c
88 --- mutt-1.5.10.orig/pager.c    2005-08-11 21:37:02.000000000 +0200
89 +++ mutt-1.5.10/pager.c 2005-10-07 09:28:24.000000000 +0200
90 @@ -1763,7 +1763,7 @@
91      }
92    }
93  
94 -  if ((pager_menu->redraw & REDRAW_INDEX) && rd->index)
95 +  if (( (pager_menu->redraw & REDRAW_INDEX) || update_status_time()) && rd->index)
96    {
97      /* redraw the pager_index indicator, because the
98       * flags for this message might have changed. */
99 diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/status.c mutt-1.5.10/status.c
100 --- mutt-1.5.10.orig/status.c   2005-10-07 09:28:10.000000000 +0200
101 +++ mutt-1.5.10/status.c        2005-10-07 09:28:24.000000000 +0200
102 @@ -303,6 +304,47 @@
103        *buf = 0;
104        return (src);
105  
106 +    case '[':
107 +      {
108 +       int len = sizeof (fmt) - 1;
109 +
110 +       cp = fmt;
111 +       if (*src == '!')
112 +       {
113 +         src++;
114 +       }
115 +
116 +       while (len > 0 && *src != ']')
117 +       {
118 +         if (*src == '%')
119 +         {
120 +           src++;
121 +           if (len >= 2)
122 +           {
123 +             *cp++ = '%';
124 +             *cp++ = *src;
125 +             len -= 2;
126 +           }
127 +           else
128 +             break; /* not enough space */
129 +           src++;
130 +         }
131 +         else
132 +         {
133 +           *cp++ = *src++;
134 +            len--;
135 +         }
136 +       }
137 +       *cp = 0;
138 +       src++;
139 +       time_t now = time (NULL);
140 +       strftime (tmp, sizeof (tmp), fmt, localtime (&now));
141 +
142 +       snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
143 +       snprintf (buf, buflen, fmt, tmp);
144 +      }
145 +      break;
146 +
147      default:
148        snprintf (buf, buflen, "%%%s%c", prefix, op);
149        break;
This page took 0.033846 seconds and 3 git commands to generate.