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