View | Details | Raw Unified | Return to bug 205284 | Differences between
and this patch

Collapse All | Expand All

(-)./files/extra-patch-sidebar (-868 / +952 lines)
Lines 1-123 Link Here
1
Taken from http://lunar-linux.org/~tchan/mutt/patch-1.5.23.sidebar.20140412.txt
1
Based on http://lunar-linux.org/~tchan/mutt/patch-1.5.24.sidebar.20151111.txt
2
 - Fixed some flaws with regard to handling of "/" instead of "." for IMAP folders and other shortcommings.
2
3
3
diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c
4
*** mutt-1.5.24-orig/buffy.c	2015-08-30 12:06:38.000000000 -0500
4
*** mutt-1.5.23-orig/buffy.c.orig	2015-08-30 19:06:38.000000000 +0200
5
--- mutt-1.5.24/buffy.c	2015-09-16 23:18:13.000000000 -0500
5
--- mutt-1.5.23/buffy.c	2015-09-10 09:31:22.000000000 +0200
6
***************
6
@@ -161,6 +161,49 @@
7
*** 161,166 ****
7
   }
8
--- 161,209 ----
8
 }
9
    }
9
 
10
  }
10
+static int buffy_compare_name(const void *a, const void *b) {
11
  
11
+  const BUFFY *b1 = * (BUFFY * const *) a;
12
+ static int buffy_compare_name(const void *a, const void *b) {
12
+  const BUFFY *b2 = * (BUFFY * const *) b;
13
+   const BUFFY *b1 = * (BUFFY * const *) a;
13
+
14
+   const BUFFY *b2 = * (BUFFY * const *) b;
14
+  return mutt_strcoll(b1->path, b2->path);
15
+ 
15
+}
16
+   return mutt_strcoll(b1->path, b2->path);
16
+
17
+ }
17
+static BUFFY *buffy_sort(BUFFY *b)
18
+ 
18
+{
19
+ static BUFFY *buffy_sort(BUFFY *b)
19
+  BUFFY *tmp = b;
20
+ {
20
+  int buffycount = 0;
21
+   BUFFY *tmp = b;
21
+  BUFFY **ary;
22
+   int buffycount = 0;
22
+  int i;
23
+   BUFFY **ary;
23
+
24
+   int i;
24
+  if (!option(OPTSIDEBARSORT))
25
+ 
25
+    return b;
26
+   if (!option(OPTSIDEBARSORT))
26
+
27
+     return b;
27
+  for (; tmp != NULL; tmp = tmp->next)
28
+ 
28
+    buffycount++;
29
+   for (; tmp != NULL; tmp = tmp->next)
29
+
30
+     buffycount++;
30
+  ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
31
+ 
31
+
32
+   ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
32
+  tmp = b;
33
+ 
33
+  for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
34
+   tmp = b;
34
+    ary[i] = tmp;
35
+   for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
35
+  }
36
+     ary[i] = tmp;
36
+
37
+   }
37
+  qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
38
+ 
38
+
39
+   qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
39
+  for (i = 0; i < buffycount - 1; i++) {
40
+ 
40
+    ary[i]->next = ary[i+1];
41
+   for (i = 0; i < buffycount - 1; i++) {
41
+  }
42
+     ary[i]->next = ary[i+1];
42
+  ary[buffycount - 1]->next = NULL;
43
+   }
43
+  for (i = 1; i < buffycount; i++) {
44
+   ary[buffycount - 1]->next = NULL;
44
+    ary[i]->prev = ary[i-1];
45
+   for (i = 1; i < buffycount; i++) {
45
+  }
46
+     ary[i]->prev = ary[i-1];
46
+  ary[0]->prev = NULL;
47
+   }
47
+
48
+   ary[0]->prev = NULL;
48
+  tmp = ary[0];
49
+ 
49
+  free(ary);
50
+   tmp = ary[0];
50
+  return tmp;
51
+   free(ary);
51
+}
52
+   return tmp;
52
+
53
+ }
53
 BUFFY *mutt_find_mailbox (const char *path)
54
+ 
54
 {
55
  BUFFY *mutt_find_mailbox (const char *path)
55
   BUFFY *tmp = NULL;
56
  {
56
@@ -196,9 +239,13 @@
57
    BUFFY *tmp = NULL;
57
 static BUFFY *buffy_new (const char *path)
58
***************
58
 {
59
*** 196,204 ****
59
   BUFFY* buffy;
60
--- 239,251 ----
60
+  char rp[PATH_MAX];
61
  static BUFFY *buffy_new (const char *path)
61
+  char *r;
62
  {
62
 
63
    BUFFY* buffy;
63
   buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
64
+   char rp[PATH_MAX];
64
   strfcpy (buffy->path, path, sizeof (buffy->path));
65
+   char *r;
65
+  r = realpath(path, rp);
66
  
66
+  strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
67
    buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
67
   buffy->next = NULL;
68
    strfcpy (buffy->path, path, sizeof (buffy->path));
68
   buffy->magic = 0;
69
+   r = realpath(path, rp);
69
 
70
+   strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
70
@@ -243,8 +290,8 @@
71
    buffy->next = NULL;
71
     p = realpath (buf, f1);
72
    buffy->magic = 0;
72
     for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
73
  
73
     {
74
***************
74
-      q = realpath ((*tmp)->path, f2);
75
*** 243,250 ****
75
-      if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
76
      p = realpath (buf, f1);
76
+      q = (*tmp)->realpath;
77
      for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
77
+      if (mutt_strcmp (p ? p : buf, q) == 0)
78
      {
78
       {
79
!       q = realpath ((*tmp)->path, f2);
79
 	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
80
!       if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
80
 	break;
81
        {
81
@@ -282,6 +329,7 @@
82
  	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
82
     else
83
  	break;
83
       (*tmp)->size = 0;
84
--- 290,297 ----
84
   }
85
      p = realpath (buf, f1);
85
+  Incoming = buffy_sort(Incoming);
86
      for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
86
   return 0;
87
      {
87
 }
88
!       q = (*tmp)->realpath;
88
 
89
!       if (mutt_strcmp (p ? p : buf, q) == 0)
89
@@ -306,6 +354,11 @@
90
        {
90
       return 0;
91
  	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
91
   }
92
  	break;
92
 
93
***************
93
+  if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
94
*** 282,287 ****
94
+      mailbox->new = 1;
95
--- 329,335 ----
95
+      return 1;
96
      else
96
+  }
97
        (*tmp)->size = 0;
97
+
98
    }
98
   if ((dirp = opendir (path)) == NULL)
99
+   Incoming = buffy_sort(Incoming);
99
   {
100
    return 0;
100
     mailbox->magic = 0;
101
  }
101
@@ -357,6 +410,73 @@
102
  
102
 
103
***************
103
   return 0;
104
*** 306,311 ****
104
 }
105
--- 354,364 ----
105
+  
106
        return 0;
106
+/* update message counts for the sidebar */
107
    }
107
+void buffy_maildir_update (BUFFY* mailbox)
108
  
108
+{
109
+   if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
110
+       mailbox->new = 1;
111
+       return 1;
112
+   }
113
+ 
114
    if ((dirp = opendir (path)) == NULL)
115
    {
116
      mailbox->magic = 0;
117
***************
118
*** 357,362 ****
119
--- 410,482 ----
120
  
121
    return 0;
122
  }
123
+   
124
+  /* update message counts for the sidebar */
125
+ void buffy_maildir_update (BUFFY* mailbox)
126
+ {
109
+  char path[_POSIX_PATH_MAX];
127
+  char path[_POSIX_PATH_MAX];
110
+  DIR *dirp;
128
+  DIR *dirp;
111
+  struct dirent *de;
129
+  struct dirent *de;
112
+  char *p;
130
+  char *p;
113
+
131
+ 
114
+  if(!option(OPTSIDEBAR))
132
+  if(!option(OPTSIDEBAR))
115
+      return;
133
+      return;
116
+
134
+ 
117
+  mailbox->msgcount = 0;
135
+  mailbox->msgcount = 0;
118
+  mailbox->msg_unread = 0;
136
+  mailbox->msg_unread = 0;
119
+  mailbox->msg_flagged = 0;
137
+  mailbox->msg_flagged = 0;
120
+
138
+ 
121
+  snprintf (path, sizeof (path), "%s/new", mailbox->path);
139
+  snprintf (path, sizeof (path), "%s/new", mailbox->path);
122
+        
140
+        
123
+  if ((dirp = opendir (path)) == NULL)
141
+  if ((dirp = opendir (path)) == NULL)
Lines 125-157 Link Here
125
+    mailbox->magic = 0;
143
+    mailbox->magic = 0;
126
+    return;
144
+    return;
127
+  } 
145
+  } 
128
+      
146
+        
129
+  while ((de = readdir (dirp)) != NULL)
147
+  while ((de = readdir (dirp)) != NULL)
130
+  {
148
+  {
131
+    if (*de->d_name == '.')
149
+    if (*de->d_name == '.')
132
+      continue;
150
+      continue;
133
+
151
+ 
134
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
152
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
135
+      mailbox->new = 1;
153
+      mailbox->new = 1;
136
+      mailbox->msgcount++;
154
+      mailbox->msgcount++;
137
+      mailbox->msg_unread++;
155
+      mailbox->msg_unread++;
138
+    }
156
+    }
139
+  }
157
+  }
140
+
158
+ 
141
+  closedir (dirp);
159
+  closedir (dirp);
142
+  snprintf (path, sizeof (path), "%s/cur", mailbox->path);
160
+  snprintf (path, sizeof (path), "%s/cur", mailbox->path);
143
+        
161
+        
144
+  if ((dirp = opendir (path)) == NULL)
162
+  if ((dirp = opendir (path)) == NULL)
145
+  {   
163
+  {   
146
+    mailbox->magic = 0;
164
+   mailbox->magic = 0;
147
+    return;
165
+    return;
148
+  } 
166
+  } 
149
+      
167
+        
150
+  while ((de = readdir (dirp)) != NULL)
168
+  while ((de = readdir (dirp)) != NULL)
151
+  {
169
+  {
152
+    if (*de->d_name == '.')
170
+    if (*de->d_name == '.')
153
+      continue;
171
+      continue;
154
+
172
+ 
155
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
173
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
156
+      mailbox->msgcount++;
174
+      mailbox->msgcount++;
157
+      if ((p = strstr (de->d_name, ":2,"))) {
175
+      if ((p = strstr (de->d_name, ":2,"))) {
Lines 164-238 Link Here
164
+      }
182
+      }
165
+    }
183
+    }
166
+  }
184
+  }
167
+
185
+ 
168
+  mailbox->sb_last_checked = time(NULL);
186
+  mailbox->sb_last_checked = time(NULL);
169
+  closedir (dirp);
187
+  closedir (dirp);
170
+}
188
+ }
171
+
189
+ 
172
 /* returns 1 if mailbox has new mail */ 
190
  /* returns 1 if mailbox has new mail */ 
173
 static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
191
  static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
174
 {
192
  {
175
@@ -368,7 +488,7 @@
193
***************
176
   else
194
*** 368,374 ****
177
     statcheck = sb->st_mtime > sb->st_atime
195
    else
178
       || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
196
      statcheck = sb->st_mtime > sb->st_atime
179
-  if (statcheck)
197
        || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
180
+  if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
198
!   if (statcheck)
181
   {
199
    {
182
     if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
200
      if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
183
     {
201
      {
184
@@ -388,6 +508,27 @@
202
--- 488,494 ----
185
   return rc;
203
    else
186
 }
204
      statcheck = sb->st_mtime > sb->st_atime
187
 
205
        || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
188
+/* update message counts for the sidebar */
206
!   if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
189
+void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
207
    {
190
+{
208
      if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
191
+  CONTEXT *ctx = NULL;
209
      {
192
+
210
***************
193
+  if(!option(OPTSIDEBAR))
211
*** 388,393 ****
194
+      return;
212
--- 508,534 ----
195
+  if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
213
    return rc;
196
+      return; /* no check necessary */
214
  }
197
+
215
  
198
+  ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
216
+ /* update message counts for the sidebar */
199
+  if(ctx)
217
+ void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
200
+  {
218
+ {
201
+    mailbox->msgcount = ctx->msgcount;
219
+   CONTEXT *ctx = NULL;
202
+    mailbox->msg_unread = ctx->unread;
220
+ 
203
+    mailbox->msg_flagged = ctx->flagged;
221
+   if(!option(OPTSIDEBAR))
204
+    mailbox->sb_last_checked = time(NULL);
222
+       return;
205
+    mx_close_mailbox(ctx, 0);
223
+   if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
206
+  }
224
+       return; /* no check necessary */
207
+}
225
+ 
208
+
226
+   ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
209
 int mutt_buffy_check (int force)
227
+   if(ctx)
210
 {
228
+   {
211
   BUFFY *tmp;
229
+     mailbox->msgcount = ctx->msgcount;
212
@@ -461,17 +602,20 @@
230
+     mailbox->msg_unread = ctx->unread;
213
       {
231
+     mailbox->msg_flagged = ctx->flagged;
214
       case M_MBOX:
232
+     mailbox->sb_last_checked = time(NULL);
215
       case M_MMDF:
233
+     mx_close_mailbox(ctx, 0);
216
+	buffy_mbox_update (tmp, &sb);
234
+   }
217
 	if (buffy_mbox_hasnew (tmp, &sb) > 0)
235
+ }
218
 	  BuffyCount++;
236
+ 
219
 	break;
237
  int mutt_buffy_check (int force)
220
 
238
  {
221
       case M_MAILDIR:
239
    BUFFY *tmp;
222
+	buffy_maildir_update (tmp);
240
***************
223
 	if (buffy_maildir_hasnew (tmp) > 0)
241
*** 461,477 ****
224
 	  BuffyCount++;
242
        {
225
 	break;
243
        case M_MBOX:
226
 
244
        case M_MMDF:
227
       case M_MH:
245
  	if (buffy_mbox_hasnew (tmp, &sb) > 0)
228
-	mh_buffy(tmp);
246
  	  BuffyCount++;
229
+	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
247
  	break;
230
+        mh_buffy(tmp);
248
  
231
 	if (tmp->new)
249
        case M_MAILDIR:
232
 	  BuffyCount++;
250
  	if (buffy_maildir_hasnew (tmp) > 0)
233
 	break;
251
  	  BuffyCount++;
234
*** mutt-1.5.23-orig/buffy.h	2014-03-12 11:03:44.000000000 -0500
252
  	break;
235
--- mutt-1.5.23/buffy.h	2014-04-11 10:14:01.000000000 -0500
253
  
254
        case M_MH:
255
! 	mh_buffy(tmp);
256
  	if (tmp->new)
257
  	  BuffyCount++;
258
  	break;
259
--- 602,621 ----
260
        {
261
        case M_MBOX:
262
        case M_MMDF:
263
+ 	buffy_mbox_update (tmp, &sb);
264
  	if (buffy_mbox_hasnew (tmp, &sb) > 0)
265
  	  BuffyCount++;
266
  	break;
267
  
268
        case M_MAILDIR:
269
+ 	buffy_maildir_update (tmp);
270
  	if (buffy_maildir_hasnew (tmp) > 0)
271
  	  BuffyCount++;
272
  	break;
273
  
274
        case M_MH:
275
! 	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
276
!         mh_buffy(tmp);
277
  	if (tmp->new)
278
  	  BuffyCount++;
279
  	break;
280
*** mutt-1.5.24-orig/buffy.h	2015-08-30 12:06:38.000000000 -0500
281
--- mutt-1.5.24/buffy.h	2015-09-16 23:18:13.000000000 -0500
236
***************
282
***************
237
*** 23,35 ****
283
*** 23,35 ****
238
--- 23,41 ----
284
--- 23,41 ----
Lines 255-273 Link Here
255
  }
301
  }
256
  BUFFY;
302
  BUFFY;
257
  
303
  
258
*** mutt-1.5.23-orig/color.c.orig	2015-08-30 19:06:38.000000000 +0200
304
*** mutt-1.5.24-orig/color.c	2015-08-30 12:06:38.000000000 -0500
259
--- mutt-1.5.23/color.c	2015-09-10 09:34:06.000000000 +0200
305
--- mutt-1.5.24/color.c	2015-09-16 23:18:13.000000000 -0500
260
@@ -94,6 +94,8 @@
306
***************
261
   { "underline",	MT_COLOR_UNDERLINE },
307
*** 94,99 ****
262
   { "index",		MT_COLOR_INDEX },
308
--- 94,101 ----
263
   { "prompt",		MT_COLOR_PROMPT },
309
    { "underline",	MT_COLOR_UNDERLINE },
264
+  { "sidebar_new",	MT_COLOR_NEW },
310
    { "index",		MT_COLOR_INDEX },
265
+  { "sidebar_flagged",	MT_COLOR_FLAGGED },
311
    { "prompt",		MT_COLOR_PROMPT },
266
   { NULL,		0 }
312
+   { "sidebar_new",	MT_COLOR_NEW },
267
 };
313
+   { "sidebar_flagged",	MT_COLOR_FLAGGED },
268
 
314
    { NULL,		0 }
269
*** mutt-1.5.23-orig/compose.c	2014-03-12 11:03:45.000000000 -0500
315
  };
270
--- mutt-1.5.23/compose.c	2014-04-12 12:15:56.000000000 -0500
316
  
317
*** mutt-1.5.24-orig/compose.c	2015-08-30 12:06:38.000000000 -0500
318
--- mutt-1.5.24/compose.c	2015-09-16 23:18:13.000000000 -0500
271
***************
319
***************
272
*** 72,78 ****
320
*** 72,78 ****
273
  
321
  
Lines 303-318 Link Here
303
    if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
351
    if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
304
    {
352
    {
305
***************
353
***************
306
*** 142,148 ****
354
*** 145,151 ****
307
    }
355
        addstr (_(" (OppEnc mode)"));
308
  
356
  
309
    clrtoeol ();
357
    clrtoeol ();
310
!   move (HDR_CRYPTINFO, 0);
358
!   move (HDR_CRYPTINFO, 0);
311
    clrtoeol ();
359
    clrtoeol ();
312
  
360
  
313
    if ((WithCrypto & APPLICATION_PGP)
361
    if ((WithCrypto & APPLICATION_PGP)
314
--- 142,148 ----
362
--- 145,151 ----
315
    }
363
        addstr (_(" (OppEnc mode)"));
316
  
364
  
317
    clrtoeol ();
365
    clrtoeol ();
318
!   move (HDR_CRYPTINFO, SidebarWidth);
366
!   move (HDR_CRYPTINFO, SidebarWidth);
Lines 320-326 Link Here
320
  
368
  
321
    if ((WithCrypto & APPLICATION_PGP)
369
    if ((WithCrypto & APPLICATION_PGP)
322
***************
370
***************
323
*** 159,165 ****
371
*** 162,168 ****
324
        && (msg->security & ENCRYPT)
372
        && (msg->security & ENCRYPT)
325
        && SmimeCryptAlg
373
        && SmimeCryptAlg
326
        && *SmimeCryptAlg) {
374
        && *SmimeCryptAlg) {
Lines 328-334 Link Here
328
  		NONULL(SmimeCryptAlg));
376
  		NONULL(SmimeCryptAlg));
329
    }
377
    }
330
  }
378
  }
331
--- 159,165 ----
379
--- 162,168 ----
332
        && (msg->security & ENCRYPT)
380
        && (msg->security & ENCRYPT)
333
        && SmimeCryptAlg
381
        && SmimeCryptAlg
334
        && *SmimeCryptAlg) {
382
        && *SmimeCryptAlg) {
Lines 337-343 Link Here
337
    }
385
    }
338
  }
386
  }
339
***************
387
***************
340
*** 172,178 ****
388
*** 175,181 ****
341
    int c;
389
    int c;
342
    char *t;
390
    char *t;
343
  
391
  
Lines 345-351 Link Here
345
  
393
  
346
    if (!chain)
394
    if (!chain)
347
    {
395
    {
348
--- 172,178 ----
396
--- 175,181 ----
349
    int c;
397
    int c;
350
    char *t;
398
    char *t;
351
  
399
  
Lines 354-360 Link Here
354
    if (!chain)
402
    if (!chain)
355
    {
403
    {
356
***************
404
***************
357
*** 187,193 ****
405
*** 190,196 ****
358
      if (t && t[0] == '0' && t[1] == '\0')
406
      if (t && t[0] == '0' && t[1] == '\0')
359
        t = "<random>";
407
        t = "<random>";
360
      
408
      
Lines 362-368 Link Here
362
        break;
410
        break;
363
  
411
  
364
      addstr (NONULL(t));
412
      addstr (NONULL(t));
365
--- 187,193 ----
413
--- 190,196 ----
366
      if (t && t[0] == '0' && t[1] == '\0')
414
      if (t && t[0] == '0' && t[1] == '\0')
367
        t = "<random>";
415
        t = "<random>";
368
      
416
      
Lines 371-377 Link Here
371
  
419
  
372
      addstr (NONULL(t));
420
      addstr (NONULL(t));
373
***************
421
***************
374
*** 239,245 ****
422
*** 242,248 ****
375
  
423
  
376
    buf[0] = 0;
424
    buf[0] = 0;
377
    rfc822_write_address (buf, sizeof (buf), addr, 1);
425
    rfc822_write_address (buf, sizeof (buf), addr, 1);
Lines 379-385 Link Here
379
    mutt_paddstr (W, buf);
427
    mutt_paddstr (W, buf);
380
  }
428
  }
381
  
429
  
382
--- 239,245 ----
430
--- 242,248 ----
383
  
431
  
384
    buf[0] = 0;
432
    buf[0] = 0;
385
    rfc822_write_address (buf, sizeof (buf), addr, 1);
433
    rfc822_write_address (buf, sizeof (buf), addr, 1);
Lines 388-394 Link Here
388
  }
436
  }
389
  
437
  
390
***************
438
***************
391
*** 249,258 ****
439
*** 252,261 ****
392
    draw_envelope_addr (HDR_TO, msg->env->to);
440
    draw_envelope_addr (HDR_TO, msg->env->to);
393
    draw_envelope_addr (HDR_CC, msg->env->cc);
441
    draw_envelope_addr (HDR_CC, msg->env->cc);
394
    draw_envelope_addr (HDR_BCC, msg->env->bcc);
442
    draw_envelope_addr (HDR_BCC, msg->env->bcc);
Lines 399-405 Link Here
399
    mutt_paddstr (W, fcc);
447
    mutt_paddstr (W, fcc);
400
  
448
  
401
    if (WithCrypto)
449
    if (WithCrypto)
402
--- 249,258 ----
450
--- 252,261 ----
403
    draw_envelope_addr (HDR_TO, msg->env->to);
451
    draw_envelope_addr (HDR_TO, msg->env->to);
404
    draw_envelope_addr (HDR_CC, msg->env->cc);
452
    draw_envelope_addr (HDR_CC, msg->env->cc);
405
    draw_envelope_addr (HDR_BCC, msg->env->bcc);
453
    draw_envelope_addr (HDR_BCC, msg->env->bcc);
Lines 411-417 Link Here
411
  
459
  
412
    if (WithCrypto)
460
    if (WithCrypto)
413
***************
461
***************
414
*** 263,269 ****
462
*** 266,272 ****
415
  #endif
463
  #endif
416
  
464
  
417
    SETCOLOR (MT_COLOR_STATUS);
465
    SETCOLOR (MT_COLOR_STATUS);
Lines 419-425 Link Here
419
    clrtoeol ();
467
    clrtoeol ();
420
  
468
  
421
    NORMAL_COLOR;
469
    NORMAL_COLOR;
422
--- 263,269 ----
470
--- 266,272 ----
423
  #endif
471
  #endif
424
  
472
  
425
    SETCOLOR (MT_COLOR_STATUS);
473
    SETCOLOR (MT_COLOR_STATUS);
Lines 428-434 Link Here
428
  
476
  
429
    NORMAL_COLOR;
477
    NORMAL_COLOR;
430
***************
478
***************
431
*** 299,305 ****
479
*** 302,308 ****
432
    /* redraw the expanded list so the user can see the result */
480
    /* redraw the expanded list so the user can see the result */
433
    buf[0] = 0;
481
    buf[0] = 0;
434
    rfc822_write_address (buf, sizeof (buf), *addr, 1);
482
    rfc822_write_address (buf, sizeof (buf), *addr, 1);
Lines 436-442 Link Here
436
    mutt_paddstr (W, buf);
484
    mutt_paddstr (W, buf);
437
    
485
    
438
    return 0;
486
    return 0;
439
--- 299,305 ----
487
--- 302,308 ----
440
    /* redraw the expanded list so the user can see the result */
488
    /* redraw the expanded list so the user can see the result */
441
    buf[0] = 0;
489
    buf[0] = 0;
442
    rfc822_write_address (buf, sizeof (buf), *addr, 1);
490
    rfc822_write_address (buf, sizeof (buf), *addr, 1);
Lines 445-451 Link Here
445
    
493
    
446
    return 0;
494
    return 0;
447
***************
495
***************
448
*** 544,550 ****
496
*** 562,568 ****
449
  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
497
  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
450
  	{
498
  	{
451
  	  mutt_str_replace (&msg->env->subject, buf);
499
  	  mutt_str_replace (&msg->env->subject, buf);
Lines 453-459 Link Here
453
  	  if (msg->env->subject)
501
  	  if (msg->env->subject)
454
  	    mutt_paddstr (W, msg->env->subject);
502
  	    mutt_paddstr (W, msg->env->subject);
455
  	  else
503
  	  else
456
--- 544,550 ----
504
--- 562,568 ----
457
  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
505
  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
458
  	{
506
  	{
459
  	  mutt_str_replace (&msg->env->subject, buf);
507
  	  mutt_str_replace (&msg->env->subject, buf);
Lines 462-468 Link Here
462
  	    mutt_paddstr (W, msg->env->subject);
510
  	    mutt_paddstr (W, msg->env->subject);
463
  	  else
511
  	  else
464
***************
512
***************
465
*** 562,568 ****
513
*** 580,586 ****
466
  	{
514
  	{
467
  	  strfcpy (fcc, buf, fcclen);
515
  	  strfcpy (fcc, buf, fcclen);
468
  	  mutt_pretty_mailbox (fcc, fcclen);
516
  	  mutt_pretty_mailbox (fcc, fcclen);
Lines 470-476 Link Here
470
  	  mutt_paddstr (W, fcc);
518
  	  mutt_paddstr (W, fcc);
471
  	  fccSet = 1;
519
  	  fccSet = 1;
472
  	}
520
  	}
473
--- 562,568 ----
521
--- 580,586 ----
474
  	{
522
  	{
475
  	  strfcpy (fcc, buf, fcclen);
523
  	  strfcpy (fcc, buf, fcclen);
476
  	  mutt_pretty_mailbox (fcc, fcclen);
524
  	  mutt_pretty_mailbox (fcc, fcclen);
Lines 478-488 Link Here
478
  	  mutt_paddstr (W, fcc);
526
  	  mutt_paddstr (W, fcc);
479
  	  fccSet = 1;
527
  	  fccSet = 1;
480
  	}
528
  	}
481
*** mutt-1.5.23-orig/configure.ac	2014-03-12 11:26:40.000000000 -0500
529
*** mutt-1.5.24-orig/configure.ac	2015-08-30 12:24:20.000000000 -0500
482
--- mutt-1.5.23/configure.ac	2014-04-11 10:14:01.000000000 -0500
530
--- mutt-1.5.24/configure.ac	2015-09-16 23:18:13.000000000 -0500
483
***************
531
***************
484
*** 1276,1281 ****
532
*** 1302,1307 ****
485
--- 1276,1283 ----
533
--- 1302,1309 ----
486
    AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
534
    AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
487
  fi
535
  fi
488
  
536
  
Lines 491-498 Link Here
491
  dnl Documentation tools
539
  dnl Documentation tools
492
  have_openjade="no"
540
  have_openjade="no"
493
  AC_PATH_PROG([OSPCAT], [ospcat], [none])
541
  AC_PATH_PROG([OSPCAT], [ospcat], [none])
494
*** mutt-1.5.23-orig/curs_main.c	2014-03-12 11:06:17.000000000 -0500
542
*** mutt-1.5.24-orig/curs_main.c	2015-08-30 12:06:38.000000000 -0500
495
--- mutt-1.5.23/curs_main.c	2014-04-12 21:45:21.000000000 -0500
543
--- mutt-1.5.24/curs_main.c	2015-09-16 23:18:13.000000000 -0500
496
***************
544
***************
497
*** 26,32 ****
545
*** 26,32 ****
498
--- 26,34 ----
546
--- 26,34 ----
Lines 506-512 Link Here
506
  #ifdef USE_POP
554
  #ifdef USE_POP
507
  #include "pop.h"
555
  #include "pop.h"
508
***************
556
***************
509
*** 519,538 ****
557
*** 596,615 ****
510
         menu->redraw |= REDRAW_STATUS;
558
         menu->redraw |= REDRAW_STATUS;
511
       if (do_buffy_notify)
559
       if (do_buffy_notify)
512
       {
560
       {
Lines 527-533 Link Here
527
      }
575
      }
528
  
576
  
529
      if (menu->menu == MENU_MAIN)
577
      if (menu->menu == MENU_MAIN)
530
--- 521,551 ----
578
--- 598,628 ----
531
         menu->redraw |= REDRAW_STATUS;
579
         menu->redraw |= REDRAW_STATUS;
532
       if (do_buffy_notify)
580
       if (do_buffy_notify)
533
       {
581
       {
Lines 560-567 Link Here
560
  
608
  
561
      if (menu->menu == MENU_MAIN)
609
      if (menu->menu == MENU_MAIN)
562
***************
610
***************
563
*** 554,562 ****
611
*** 631,639 ****
564
--- 567,578 ----
612
--- 644,655 ----
565
  
613
  
566
        if (menu->redraw & REDRAW_STATUS)
614
        if (menu->redraw & REDRAW_STATUS)
567
        {
615
        {
Lines 575-581 Link Here
575
  	NORMAL_COLOR;
623
  	NORMAL_COLOR;
576
  	menu->redraw &= ~REDRAW_STATUS;
624
  	menu->redraw &= ~REDRAW_STATUS;
577
***************
625
***************
578
*** 569,575 ****
626
*** 653,659 ****
579
  	menu->oldcurrent = -1;
627
  	menu->oldcurrent = -1;
580
  
628
  
581
        if (option (OPTARROWCURSOR))
629
        if (option (OPTARROWCURSOR))
Lines 583-589 Link Here
583
        else if (option (OPTBRAILLEFRIENDLY))
631
        else if (option (OPTBRAILLEFRIENDLY))
584
  	move (menu->current - menu->top + menu->offset, 0);
632
  	move (menu->current - menu->top + menu->offset, 0);
585
        else
633
        else
586
--- 585,591 ----
634
--- 669,675 ----
587
  	menu->oldcurrent = -1;
635
  	menu->oldcurrent = -1;
588
  
636
  
589
        if (option (OPTARROWCURSOR))
637
        if (option (OPTARROWCURSOR))
Lines 592-599 Link Here
592
  	move (menu->current - menu->top + menu->offset, 0);
640
  	move (menu->current - menu->top + menu->offset, 0);
593
        else
641
        else
594
***************
642
***************
595
*** 1011,1016 ****
643
*** 1095,1100 ****
596
--- 1027,1033 ----
644
--- 1111,1117 ----
597
  	  break;
645
  	  break;
598
  
646
  
599
  	CHECK_MSGCOUNT;
647
  	CHECK_MSGCOUNT;
Lines 602-609 Link Here
602
  	{
650
  	{
603
  	  int oldvcount = Context->vcount;
651
  	  int oldvcount = Context->vcount;
604
***************
652
***************
605
*** 1070,1075 ****
653
*** 1154,1159 ****
606
--- 1087,1093 ----
654
--- 1171,1177 ----
607
  	  menu->redraw = REDRAW_FULL;
655
  	  menu->redraw = REDRAW_FULL;
608
  	break;
656
  	break;
609
  
657
  
Lines 612-618 Link Here
612
        case OP_MAIN_NEXT_UNREAD_MAILBOX:
660
        case OP_MAIN_NEXT_UNREAD_MAILBOX:
613
  
661
  
614
***************
662
***************
615
*** 1101,1107 ****
663
*** 1185,1191 ****
616
  	{
664
  	{
617
  	  mutt_buffy (buf, sizeof (buf));
665
  	  mutt_buffy (buf, sizeof (buf));
618
  
666
  
Lines 620-626 Link Here
620
  	  {
668
  	  {
621
  	    if (menu->menu == MENU_PAGER)
669
  	    if (menu->menu == MENU_PAGER)
622
  	    {
670
  	    {
623
--- 1119,1129 ----
671
--- 1203,1213 ----
624
  	{
672
  	{
625
  	  mutt_buffy (buf, sizeof (buf));
673
  	  mutt_buffy (buf, sizeof (buf));
626
  
674
  
Lines 633-640 Link Here
633
  	    if (menu->menu == MENU_PAGER)
681
  	    if (menu->menu == MENU_PAGER)
634
  	    {
682
  	    {
635
***************
683
***************
636
*** 1119,1124 ****
684
*** 1203,1208 ****
637
--- 1141,1147 ----
685
--- 1225,1231 ----
638
  	}
686
  	}
639
  
687
  
640
  	mutt_expand_path (buf, sizeof (buf));
688
  	mutt_expand_path (buf, sizeof (buf));
Lines 643-650 Link Here
643
  	{
691
  	{
644
  	  mutt_error (_("%s is not a mailbox."), buf);
692
  	  mutt_error (_("%s is not a mailbox."), buf);
645
***************
693
***************
646
*** 2209,2214 ****
694
*** 2293,2298 ****
647
--- 2232,2243 ----
695
--- 2316,2327 ----
648
  	mutt_what_key();
696
  	mutt_what_key();
649
  	break;
697
  	break;
650
  
698
  
Lines 657-664 Link Here
657
        default:
705
        default:
658
  	if (menu->menu == MENU_MAIN)
706
  	if (menu->menu == MENU_MAIN)
659
  	  km_error_key (MENU_MAIN);
707
  	  km_error_key (MENU_MAIN);
660
*** mutt-1.5.23-orig/flags.c	2014-03-12 11:03:45.000000000 -0500
708
*** mutt-1.5.24-orig/flags.c	2015-08-30 12:06:38.000000000 -0500
661
--- mutt-1.5.23/flags.c	2014-04-11 10:14:01.000000000 -0500
709
--- mutt-1.5.24/flags.c	2015-09-16 23:18:13.000000000 -0500
662
***************
710
***************
663
*** 22,29 ****
711
*** 22,29 ****
664
--- 22,31 ----
712
--- 22,31 ----
Lines 682-689 Link Here
682
  }
730
  }
683
  
731
  
684
  void mutt_tag_set_flag (int flag, int bf)
732
  void mutt_tag_set_flag (int flag, int bf)
685
*** mutt-1.5.23-orig/functions.h	2014-03-12 11:03:45.000000000 -0500
733
*** mutt-1.5.24-orig/functions.h	2015-08-30 12:06:38.000000000 -0500
686
--- mutt-1.5.23/functions.h	2014-04-11 10:14:01.000000000 -0500
734
--- mutt-1.5.24/functions.h	2015-09-16 23:18:13.000000000 -0500
687
***************
735
***************
688
*** 169,174 ****
736
*** 169,174 ****
689
--- 169,179 ----
737
--- 169,179 ----
Lines 712-722 Link Here
712
    { NULL,		0,				NULL }
760
    { NULL,		0,				NULL }
713
  };
761
  };
714
  
762
  
715
*** mutt-1.5.23-orig/globals.h	2014-03-12 11:06:17.000000000 -0500
763
*** mutt-1.5.24-orig/globals.h	2015-08-30 12:06:38.000000000 -0500
716
--- mutt-1.5.23/globals.h	2014-04-11 10:14:01.000000000 -0500
764
--- mutt-1.5.24/globals.h	2015-09-16 23:18:13.000000000 -0500
717
***************
765
***************
718
*** 117,122 ****
766
*** 118,123 ****
719
--- 117,125 ----
767
--- 118,126 ----
720
  WHERE char *SendCharset;
768
  WHERE char *SendCharset;
721
  WHERE char *Sendmail;
769
  WHERE char *Sendmail;
722
  WHERE char *Shell;
770
  WHERE char *Shell;
Lines 727-734 Link Here
727
  WHERE char *SimpleSearch;
775
  WHERE char *SimpleSearch;
728
  #if USE_SMTP
776
  #if USE_SMTP
729
***************
777
***************
730
*** 208,213 ****
778
*** 213,218 ****
731
--- 211,219 ----
779
--- 216,224 ----
732
  WHERE short ScoreThresholdRead;
780
  WHERE short ScoreThresholdRead;
733
  WHERE short ScoreThresholdFlag;
781
  WHERE short ScoreThresholdFlag;
734
  
782
  
Lines 738-828 Link Here
738
  #ifdef USE_IMAP
786
  #ifdef USE_IMAP
739
  WHERE short ImapKeepalive;
787
  WHERE short ImapKeepalive;
740
  WHERE short ImapPipelineDepth;
788
  WHERE short ImapPipelineDepth;
741
*** mutt-1.5.23-orig/handler.c.orig	2015-09-10 09:34:53.000000000 +0200
789
*** mutt-1.5.24-orig/handler.c	2015-08-30 12:06:38.000000000 -0500
742
--- mutt-1.5.23/handler.c	2015-09-10 09:58:03.000000000 +0200
790
--- mutt-1.5.24/handler.c	2015-09-16 23:18:13.000000000 -0500
743
@@ -1625,6 +1625,11 @@
791
***************
744
   int decode = 0;
792
*** 1603,1608 ****
745
   int rc = 0;
793
--- 1603,1613 ----
746
 
794
  
747
+#ifdef HAVE_FMEMOPEN
795
    fseeko (s->fpin, b->offset, 0);
748
+  char *temp;
796
  
749
+  size_t tempsize;
797
+ #ifdef HAVE_FMEMOPEN
750
+#endif
798
+   char *temp;
751
+
799
+   size_t tempsize;
752
   fseeko (s->fpin, b->offset, 0);
800
+ #endif
753
 
801
+ 
754
   /* see if we need to decode this part before processing it */
802
    /* see if we need to decode this part before processing it */
755
@@ -1642,6 +1647,14 @@
803
    if (b->encoding == ENCBASE64 || b->encoding == ENCQUOTEDPRINTABLE ||
756
     {
804
        b->encoding == ENCUUENCODED || plaintext ||
757
       /* decode to a tempfile, saving the original destination */
805
***************
758
       fp = s->fpout;
806
*** 1618,1623 ****
759
+#ifdef HAVE_FMEMOPEN
807
--- 1623,1636 ----
760
+	if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
808
      {
761
+	{
809
        /* decode to a tempfile, saving the original destination */
762
+	  mutt_error _("Unable to open memory stream!");
810
        fp = s->fpout;
763
+	  dprint (1, (debugfile, "Can't open memory stream.\n"));
811
+ #ifdef HAVE_FMEMOPEN
764
+	  goto bail;
812
+      if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
765
+	}
813
+      {
766
+#else
814
+        mutt_error _("Unable to open memory stream!");
767
       mutt_mktemp (tempfile, sizeof (tempfile));
815
+        dprint (1, (debugfile, "Can't open memory stream.\n"));
768
       if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
816
+        return -1;
769
       {
817
+      }
770
@@ -1649,6 +1662,7 @@
818
+ #else
771
         dprint (1, (debugfile, "Can't open %s.\n", tempfile));
819
        mutt_mktemp (tempfile, sizeof (tempfile));
772
         return -1;
820
        if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
773
       }
821
        {
774
+#endif
822
***************
775
       /* decoding the attachment changes the size and offset, so save a copy
823
*** 1625,1630 ****
776
         * of the "real" values now, and restore them after processing
824
--- 1638,1644 ----
777
         */
825
          dprint (1, (debugfile, "Can't open %s.\n", tempfile));
778
@@ -1677,8 +1691,19 @@
826
          return -1;
779
       /* restore final destination and substitute the tempfile for input */
827
        }
780
       s->fpout = fp;
828
+ #endif
781
       fp = s->fpin;
829
        /* decoding the attachment changes the size and offset, so save a copy
782
+#ifdef HAVE_FMEMOPEN
830
          * of the "real" values now, and restore them after processing
783
+	if(tempsize)
831
          */
784
+		s->fpin = fmemopen(temp, tempsize, "r");
832
***************
785
+	else /* fmemopen cannot handle zero-length buffers */
833
*** 1653,1661 ****
786
+		s->fpin = safe_fopen ("/dev/null", "r");
834
        /* restore final destination and substitute the tempfile for input */
787
+	if(s->fpin == NULL) {
835
        s->fpout = fp;
788
+		mutt_perror("failed to re-open memstream!");
836
        fp = s->fpin;
789
+		return (-1);
837
        s->fpin = fopen (tempfile, "r");
790
+	}
838
        unlink (tempfile);
791
+#else
839
! 
792
       s->fpin = fopen (tempfile, "r");
840
        /* restore the prefix */
793
       unlink (tempfile);
841
        s->prefix = savePrefix;
794
+#endif
842
      }
795
 
843
--- 1667,1685 ----
796
       /* restore the prefix */
844
        /* restore final destination and substitute the tempfile for input */
797
       s->prefix = savePrefix;
845
        s->fpout = fp;
798
@@ -1704,9 +1729,14 @@
846
        fp = s->fpin;
799
 
847
+ #ifdef HAVE_FMEMOPEN
800
       /* restore the original source stream */
848
+       if(tempsize)
801
       safe_fclose (&s->fpin);
849
+         s->fpin = fmemopen(temp, tempsize, "r");
802
+#ifdef HAVE_FMEMOPEN
850
+       else /* fmemopen cannot handle zero-length buffers */
803
+	if(tempsize)
851
+         s->fpin = safe_fopen ("/dev/null", "r");
804
+	    FREE(&temp);
852
+       if(s->fpin == NULL) {
805
+#endif
853
+        mutt_perror("failed to re-open memstream!");
806
       s->fpin = fp;
854
+        return (-1);
807
     }
855
+       }
808
   }
856
+ #else
809
+  bail:
857
        s->fpin = fopen (tempfile, "r");
810
   s->flags |= M_FIRSTDONE;
858
        unlink (tempfile);
811
 
859
! #endif
812
   return rc;
860
        /* restore the prefix */
813
@@ -1743,6 +1773,7 @@
861
        s->prefix = savePrefix;
814
   handler_t handler = NULL;
862
      }
815
   int rc = 0;
863
***************
816
 
864
*** 1680,1685 ****
817
+
865
--- 1704,1713 ----
818
   int oflags = s->flags;
866
  
819
   
867
        /* restore the original source stream */
820
   /* first determine which handler to use to process this part */
868
        safe_fclose (&s->fpin);
821
*** mutt-1.5.23-orig/init.h	2014-03-12 11:06:17.000000000 -0500
869
+ #ifdef HAVE_FMEMOPEN
822
--- mutt-1.5.23/init.h	2014-04-11 10:14:01.000000000 -0500
870
+       if(tempsize)
871
+           FREE(&temp);
872
+ #endif
873
        s->fpin = fp;
874
      }
875
    }
876
*** mutt-1.5.24-orig/init.h	2015-08-30 12:06:38.000000000 -0500
877
--- mutt-1.5.24/init.h	2015-09-16 23:18:13.000000000 -0500
823
***************
878
***************
824
*** 1966,1971 ****
879
*** 2016,2021 ****
825
--- 1966,2019 ----
880
--- 2016,2069 ----
826
    ** not used.
881
    ** not used.
827
    ** (PGP only)
882
    ** (PGP only)
828
    */
883
    */
Lines 853-859 Link Here
853
+   ** .pp
908
+   ** .pp
854
+   ** The width of the sidebar.
909
+   ** The width of the sidebar.
855
+   */
910
+   */
856
+   { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 1 },
911
+   { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
857
+   /*
912
+   /*
858
+   ** .pp
913
+   ** .pp
859
+   ** Should the sidebar shorten the path showed.
914
+   ** Should the sidebar shorten the path showed.
Lines 877-884 Link Here
877
    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
932
    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
878
    /*
933
    /*
879
    ** .pp
934
    ** .pp
880
*** mutt-1.5.23-orig/mailbox.h	2014-03-12 11:03:45.000000000 -0500
935
*** mutt-1.5.24-orig/mailbox.h	2015-08-30 12:06:38.000000000 -0500
881
--- mutt-1.5.23/mailbox.h	2014-04-11 10:14:01.000000000 -0500
936
--- mutt-1.5.24/mailbox.h	2015-09-16 23:18:13.000000000 -0500
882
***************
937
***************
883
*** 27,32 ****
938
*** 27,32 ****
884
--- 27,33 ----
939
--- 27,33 ----
Lines 888-896 Link Here
888
+ #define M_PEEK		(1<<5) /* revert atime back after taking a look (if applicable) */
943
+ #define M_PEEK		(1<<5) /* revert atime back after taking a look (if applicable) */
889
  
944
  
890
  /* mx_open_new_message() */
945
  /* mx_open_new_message() */
891
  #define M_ADD_FROM	1	/* add a From_ line */
946
  #define M_ADD_FROM	(1<<0)	/* add a From_ line */
892
*** mutt-1.5.23-orig/main.c	2014-03-12 11:06:17.000000000 -0500
947
*** mutt-1.5.24-orig/main.c	2015-08-30 12:06:38.000000000 -0500
893
--- mutt-1.5.23/main.c	2014-04-11 10:14:01.000000000 -0500
948
--- mutt-1.5.24/main.c	2015-09-16 23:18:13.000000000 -0500
894
***************
949
***************
895
*** 50,55 ****
950
*** 50,55 ****
896
--- 50,56 ----
951
--- 50,56 ----
Lines 919-926 Link Here
919
    char *includeFile = NULL;
974
    char *includeFile = NULL;
920
    char *draftFile = NULL;
975
    char *draftFile = NULL;
921
***************
976
***************
922
*** 1025,1030 ****
977
*** 1036,1041 ****
923
--- 1026,1038 ----
978
--- 1037,1049 ----
924
        strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
979
        strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
925
      mutt_expand_path (folder, sizeof (folder));
980
      mutt_expand_path (folder, sizeof (folder));
926
  
981
  
Lines 935-942 Link Here
935
      mutt_str_replace (&LastFolder, folder);
990
      mutt_str_replace (&LastFolder, folder);
936
  
991
  
937
***************
992
***************
938
*** 1047,1052 ****
993
*** 1058,1063 ****
939
--- 1055,1061 ----
994
--- 1066,1072 ----
940
      if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
995
      if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
941
         || !explicit_folder)
996
         || !explicit_folder)
942
      {
997
      {
Lines 944-954 Link Here
944
        mutt_index_menu ();
999
        mutt_index_menu ();
945
        if (Context)
1000
        if (Context)
946
  	FREE (&Context);
1001
  	FREE (&Context);
947
*** mutt-1.5.23-orig/Makefile.am	2014-03-12 11:03:44.000000000 -0500
1002
*** mutt-1.5.24-orig/Makefile.am	2015-08-30 12:06:38.000000000 -0500
948
--- mutt-1.5.23/Makefile.am	2014-04-11 10:14:01.000000000 -0500
1003
--- mutt-1.5.24/Makefile.am	2015-09-16 23:18:13.000000000 -0500
949
***************
1004
***************
950
*** 32,37 ****
1005
*** 33,38 ****
951
--- 32,38 ----
1006
--- 33,39 ----
952
  	rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
1007
  	rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
953
  	score.c send.c sendlib.c signal.c sort.c \
1008
  	score.c send.c sendlib.c signal.c sort.c \
954
  	status.c system.c thread.c charset.c history.c lib.c \
1009
  	status.c system.c thread.c charset.c history.c lib.c \
Lines 956-1018 Link Here
956
  	muttlib.c editmsg.c mbyte.c \
1011
  	muttlib.c editmsg.c mbyte.c \
957
  	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
1012
  	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
958
  
1013
  
959
*** mutt-1.5.23-orig/Makefile.in	2014-03-12 11:26:44.000000000 -0500
1014
*** mutt-1.5.24-orig/Makefile.in	2015-08-30 12:24:26.000000000 -0500
960
--- mutt-1.5.23/Makefile.in	2014-04-12 12:12:38.000000000 -0500
1015
--- mutt-1.5.24/Makefile.in	2015-09-16 23:18:13.000000000 -0500
961
***************
1016
***************
962
*** 129,135 ****
1017
*** 83,92 ****
1018
  	$(srcdir)/Makefile.am $(top_srcdir)/configure \
1019
  	$(am__configure_deps) $(srcdir)/config.h.in \
1020
  	$(top_srcdir)/intl/Makefile.in $(srcdir)/hcachever.sh.in \
1021
! 	$(srcdir)/muttbug.sh.in strtok_r.c strcasecmp.c regex.c \
1022
! 	snprintf.c wcscasecmp.c strcasestr.c setenv.c mkdtemp.c \
1023
! 	strsep.c strdup.c depcomp ABOUT-NLS ChangeLog INSTALL NEWS \
1024
! 	README TODO compile config.guess config.sub install-sh missing
1025
  EXTRA_PROGRAMS = mutt_dotlock$(EXEEXT) pgpring$(EXEEXT) \
1026
  	pgpewrap$(EXEEXT) mutt_md5$(EXEEXT)
1027
  bin_PROGRAMS = mutt$(EXEEXT) $(DOTLOCK_TARGET) $(PGPAUX_TARGET)
1028
--- 83,92 ----
1029
  	$(srcdir)/Makefile.am $(top_srcdir)/configure \
1030
  	$(am__configure_deps) $(srcdir)/config.h.in \
1031
  	$(top_srcdir)/intl/Makefile.in $(srcdir)/hcachever.sh.in \
1032
! 	$(srcdir)/muttbug.sh.in snprintf.c strtok_r.c regex.c strdup.c \
1033
! 	strcasecmp.c setenv.c strcasestr.c wcscasecmp.c mkdtemp.c \
1034
! 	strsep.c depcomp ABOUT-NLS ChangeLog INSTALL NEWS README TODO \
1035
! 	compile config.guess config.sub install-sh missing
1036
  EXTRA_PROGRAMS = mutt_dotlock$(EXEEXT) pgpring$(EXEEXT) \
1037
  	pgpewrap$(EXEEXT) mutt_md5$(EXEEXT)
1038
  bin_PROGRAMS = mutt$(EXEEXT) $(DOTLOCK_TARGET) $(PGPAUX_TARGET)
1039
***************
1040
*** 128,136 ****
1041
  	score.$(OBJEXT) send.$(OBJEXT) sendlib.$(OBJEXT) \
1042
  	signal.$(OBJEXT) sort.$(OBJEXT) status.$(OBJEXT) \
963
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
1043
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
964
  	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
1044
! 	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
965
  	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
1045
! 	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
966
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
1046
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
967
  am__objects_1 =
1047
  am__objects_1 =
968
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
1048
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
969
  	$(am__objects_1)
1049
  	$(am__objects_1)
970
--- 129,136 ----
1050
--- 128,137 ----
1051
  	score.$(OBJEXT) send.$(OBJEXT) sendlib.$(OBJEXT) \
1052
  	signal.$(OBJEXT) sort.$(OBJEXT) status.$(OBJEXT) \
971
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
1053
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
972
  	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
1054
! 	history.$(OBJEXT) lib.$(OBJEXT) sidebar.$(OBJEXT) \
973
  	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
1055
! 	muttlib.$(OBJEXT) editmsg.$(OBJEXT) mbyte.$(OBJEXT) \
974
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) \
1056
! 	url.$(OBJEXT) ascii.$(OBJEXT) crypt-mod.$(OBJEXT) \
975
! 	sidebar.$(OBJEXT)
1057
! 	safe_asprintf.$(OBJEXT)
976
  am__objects_1 =
1058
  am__objects_1 =
977
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
1059
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
978
  	$(am__objects_1)
1060
  	$(am__objects_1)
979
***************
1061
***************
980
*** 468,474 ****
1062
*** 474,479 ****
981
  	score.c send.c sendlib.c signal.c sort.c \
1063
--- 475,481 ----
982
  	status.c system.c thread.c charset.c history.c lib.c \
1064
  	rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
983
  	muttlib.c editmsg.c mbyte.c \
984
! 	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
985
  
986
  nodist_mutt_SOURCES = $(BUILT_SOURCES)
987
  mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
988
--- 469,476 ----
989
  	score.c send.c sendlib.c signal.c sort.c \
1065
  	score.c send.c sendlib.c signal.c sort.c \
990
  	status.c system.c thread.c charset.c history.c lib.c \
1066
  	status.c system.c thread.c charset.c history.c lib.c \
1067
+ 	sidebar.c \
991
  	muttlib.c editmsg.c mbyte.c \
1068
  	muttlib.c editmsg.c mbyte.c \
992
! 	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c \
1069
  	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
993
! 	sidebar.c
994
  
1070
  
995
  nodist_mutt_SOURCES = $(BUILT_SOURCES)
996
  mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
997
***************
1071
***************
998
*** 500,506 ****
1072
*** 804,809 ****
999
  	README.SSL smime.h group.h \
1073
--- 806,812 ----
1000
  	muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
1074
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send.Po@am__quote@
1001
  	ChangeLog mkchangelog.sh mutt_idna.h \
1075
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendlib.Po@am__quote@
1002
! 	snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \
1076
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@
1003
  	txt2c.c txt2c.sh version.sh check_sec.sh
1077
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sidebar.Po@am__quote@
1004
  
1078
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Po@am__quote@
1005
  EXTRA_SCRIPTS = smime_keys
1079
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smime.Po@am__quote@
1006
--- 502,508 ----
1080
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp.Po@am__quote@
1007
  	README.SSL smime.h group.h \
1081
*** mutt-1.5.24-orig/mbox.c	2015-08-30 12:06:38.000000000 -0500
1008
  	muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
1082
--- mutt-1.5.24/mbox.c	2015-09-16 23:18:13.000000000 -0500
1009
  	ChangeLog mkchangelog.sh mutt_idna.h \
1010
! 	snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in \
1011
  	txt2c.c txt2c.sh version.sh check_sec.sh
1012
  
1013
  EXTRA_SCRIPTS = smime_keys
1014
*** mutt-1.5.23-orig/mbox.c	2014-03-12 11:03:45.000000000 -0500
1015
--- mutt-1.5.23/mbox.c	2014-04-11 10:14:01.000000000 -0500
1016
***************
1083
***************
1017
*** 100,105 ****
1084
*** 100,105 ****
1018
--- 100,106 ----
1085
--- 100,106 ----
Lines 1033-1040 Link Here
1033
  
1100
  
1034
  #ifdef NFS_ATTRIBUTE_HACK
1101
  #ifdef NFS_ATTRIBUTE_HACK
1035
    if (sb.st_mtime > sb.st_atime)
1102
    if (sb.st_mtime > sb.st_atime)
1036
*** mutt-1.5.23-orig/menu.c	2014-03-12 11:03:45.000000000 -0500
1103
*** mutt-1.5.24-orig/menu.c	2015-08-30 12:06:38.000000000 -0500
1037
--- mutt-1.5.23/menu.c	2014-04-12 21:31:16.000000000 -0500
1104
--- mutt-1.5.24/menu.c	2015-09-16 23:18:13.000000000 -0500
1038
***************
1105
***************
1039
*** 24,29 ****
1106
*** 24,29 ****
1040
--- 24,30 ----
1107
--- 24,30 ----
Lines 1203-1210 Link Here
1203
      else if (option (OPTBRAILLEFRIENDLY))
1270
      else if (option (OPTBRAILLEFRIENDLY))
1204
        move (menu->current - menu->top + menu->offset, 0);
1271
        move (menu->current - menu->top + menu->offset, 0);
1205
      else
1272
      else
1206
*** mutt-1.5.23-orig/mh.c	2014-03-12 11:03:45.000000000 -0500
1273
*** mutt-1.5.24-orig/mh.c	2015-08-30 12:06:38.000000000 -0500
1207
--- mutt-1.5.23/mh.c	2014-04-11 11:04:59.000000000 -0500
1274
--- mutt-1.5.24/mh.c	2015-09-16 23:18:13.000000000 -0500
1208
***************
1275
***************
1209
*** 295,300 ****
1276
*** 295,300 ****
1210
--- 295,326 ----
1277
--- 295,326 ----
Lines 1240-1266 Link Here
1240
  static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
1307
  static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
1241
  {
1308
  {
1242
    int fd;
1309
    int fd;
1243
*** mutt-1.5.23-orig/mutt_curses.h.orig	2015-08-30 19:06:38.000000000 +0200
1310
*** mutt-1.5.24-orig/mutt_curses.h	2015-08-30 12:06:38.000000000 -0500
1244
--- mutt-1.5.23/mutt_curses.h	2015-09-10 09:42:34.000000000 +0200
1311
--- mutt-1.5.24/mutt_curses.h	2015-09-16 23:18:13.000000000 -0500
1245
@@ -64,6 +64,7 @@
1312
***************
1246
 #undef lines
1313
*** 64,69 ****
1247
 #endif /* lines */
1314
--- 64,70 ----
1248
 
1315
  #undef lines
1249
+#define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
1316
  #endif /* lines */
1250
 #define CLEARLINE(x) move(x,0), clrtoeol()
1317
  
1251
 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1318
+ #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
1252
 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1319
  #define CLEARLINE(x) move(x,0), clrtoeol()
1253
@@ -121,6 +122,8 @@
1320
  #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1254
   MT_COLOR_UNDERLINE,
1321
  #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1255
   MT_COLOR_INDEX,
1322
***************
1256
   MT_COLOR_PROMPT,
1323
*** 121,126 ****
1257
+  MT_COLOR_NEW,
1324
--- 122,129 ----
1258
+  MT_COLOR_FLAGGED,
1325
    MT_COLOR_UNDERLINE,
1259
   MT_COLOR_MAX
1326
    MT_COLOR_INDEX,
1260
 };
1327
    MT_COLOR_PROMPT,
1261
 
1328
+   MT_COLOR_NEW,
1262
*** mutt-1.5.23-orig/mutt_menu.h	2014-03-12 11:06:17.000000000 -0500
1329
+   MT_COLOR_FLAGGED,
1263
--- mutt-1.5.23/mutt_menu.h	2014-04-11 10:14:01.000000000 -0500
1330
    MT_COLOR_MAX
1331
  };
1332
  
1333
*** mutt-1.5.24-orig/mutt_menu.h	2015-08-30 12:06:38.000000000 -0500
1334
--- mutt-1.5.24/mutt_menu.h	2015-09-16 23:18:13.000000000 -0500
1264
***************
1335
***************
1265
*** 34,39 ****
1336
*** 34,39 ****
1266
--- 34,40 ----
1337
--- 34,40 ----
Lines 1271-1281 Link Here
1271
  
1342
  
1272
  #define M_MODEFMT "-- Mutt: %s"
1343
  #define M_MODEFMT "-- Mutt: %s"
1273
  
1344
  
1274
*** mutt-1.5.23-orig/mutt.h	2014-03-12 11:06:17.000000000 -0500
1345
*** mutt-1.5.24-orig/mutt.h	2015-08-30 12:06:38.000000000 -0500
1275
--- mutt-1.5.23/mutt.h	2014-04-11 10:14:01.000000000 -0500
1346
--- mutt-1.5.24/mutt.h	2015-09-16 23:18:13.000000000 -0500
1276
***************
1347
***************
1277
*** 421,426 ****
1348
*** 423,428 ****
1278
--- 421,430 ----
1349
--- 423,432 ----
1279
    OPTSAVEEMPTY,
1350
    OPTSAVEEMPTY,
1280
    OPTSAVENAME,
1351
    OPTSAVENAME,
1281
    OPTSCORE,
1352
    OPTSCORE,
Lines 1287-1294 Link Here
1287
    OPTSIGONTOP,
1358
    OPTSIGONTOP,
1288
    OPTSORTRE,
1359
    OPTSORTRE,
1289
***************
1360
***************
1290
*** 861,866 ****
1361
*** 866,871 ****
1291
--- 865,871 ----
1362
--- 870,876 ----
1292
  {
1363
  {
1293
    char *path;
1364
    char *path;
1294
    FILE *fp;
1365
    FILE *fp;
Lines 1297-1304 Link Here
1297
    off_t size;
1368
    off_t size;
1298
    off_t vsize;
1369
    off_t vsize;
1299
***************
1370
***************
1300
*** 895,900 ****
1371
*** 900,905 ****
1301
--- 900,906 ----
1372
--- 905,911 ----
1302
    unsigned int quiet : 1;	/* inhibit status messages? */
1373
    unsigned int quiet : 1;	/* inhibit status messages? */
1303
    unsigned int collapsed : 1;   /* are all threads collapsed? */
1374
    unsigned int collapsed : 1;   /* are all threads collapsed? */
1304
    unsigned int closing : 1;	/* mailbox is being closed */
1375
    unsigned int closing : 1;	/* mailbox is being closed */
Lines 1306-1316 Link Here
1306
  
1377
  
1307
    /* driver hooks */
1378
    /* driver hooks */
1308
    void *data;			/* driver specific data */
1379
    void *data;			/* driver specific data */
1309
*** mutt-1.5.23-orig/muttlib.c	2014-03-12 11:03:45.000000000 -0500
1380
*** mutt-1.5.24-orig/muttlib.c	2015-08-30 12:06:38.000000000 -0500
1310
--- mutt-1.5.23/muttlib.c	2014-04-11 10:14:01.000000000 -0500
1381
--- mutt-1.5.24/muttlib.c	2015-09-16 23:18:13.000000000 -0500
1311
***************
1382
***************
1312
*** 1281,1286 ****
1383
*** 1276,1281 ****
1313
--- 1281,1288 ----
1384
--- 1276,1283 ----
1314
  	  pl = pw = 1;
1385
  	  pl = pw = 1;
1315
  
1386
  
1316
  	/* see if there's room to add content, else ignore */
1387
  	/* see if there's room to add content, else ignore */
Lines 1320-1327 Link Here
1320
  	{
1391
  	{
1321
  	  int pad;
1392
  	  int pad;
1322
***************
1393
***************
1323
*** 1324,1329 ****
1394
*** 1319,1324 ****
1324
--- 1326,1377 ----
1395
--- 1321,1372 ----
1325
  	  col += wid;
1396
  	  col += wid;
1326
  	  src += pl;
1397
  	  src += pl;
1327
  	}
1398
  	}
Lines 1374-1381 Link Here
1374
  	break; /* skip rest of input */
1445
  	break; /* skip rest of input */
1375
        }
1446
        }
1376
        else if (ch == '|')
1447
        else if (ch == '|')
1377
*** mutt-1.5.23-orig/mx.c	2014-03-12 11:03:45.000000000 -0500
1448
*** mutt-1.5.24-orig/mx.c	2015-08-30 12:06:38.000000000 -0500
1378
--- mutt-1.5.23/mx.c	2014-04-11 10:14:01.000000000 -0500
1449
--- mutt-1.5.24/mx.c	2015-09-16 23:18:13.000000000 -0500
1379
***************
1450
***************
1380
*** 580,585 ****
1451
*** 580,585 ****
1381
--- 580,586 ----
1452
--- 580,586 ----
Lines 1463-1470 Link Here
1463
    }
1534
    }
1464
  
1535
  
1465
    if (read_msgs && quadoption (OPT_MOVE) != M_NO)
1536
    if (read_msgs && quadoption (OPT_MOVE) != M_NO)
1466
*** mutt-1.5.23-orig/mx.h	2014-03-12 11:03:45.000000000 -0500
1537
*** mutt-1.5.24-orig/mx.h	2015-08-30 12:06:38.000000000 -0500
1467
--- mutt-1.5.23/mx.h	2014-04-11 11:11:47.000000000 -0500
1538
--- mutt-1.5.24/mx.h	2015-09-16 23:18:13.000000000 -0500
1468
***************
1539
***************
1469
*** 57,62 ****
1540
*** 57,62 ****
1470
--- 57,63 ----
1541
--- 57,63 ----
Lines 1475-1482 Link Here
1475
  int mh_check_empty (const char *);
1546
  int mh_check_empty (const char *);
1476
  
1547
  
1477
  int maildir_read_dir (CONTEXT *);
1548
  int maildir_read_dir (CONTEXT *);
1478
*** mutt-1.5.23-orig/OPS	2014-03-12 11:03:44.000000000 -0500
1549
*** mutt-1.5.24-orig/OPS	2015-08-30 12:06:38.000000000 -0500
1479
--- mutt-1.5.23/OPS	2014-04-11 10:14:01.000000000 -0500
1550
--- mutt-1.5.24/OPS	2015-09-16 23:18:13.000000000 -0500
1480
***************
1551
***************
1481
*** 179,181 ****
1552
*** 179,181 ****
1482
--- 179,186 ----
1553
--- 179,186 ----
Lines 1488-1495 Link Here
1488
+ OP_SIDEBAR_NEXT "go down to next mailbox"
1559
+ OP_SIDEBAR_NEXT "go down to next mailbox"
1489
+ OP_SIDEBAR_PREV "go to previous mailbox"
1560
+ OP_SIDEBAR_PREV "go to previous mailbox"
1490
+ OP_SIDEBAR_OPEN "open hilighted mailbox"
1561
+ OP_SIDEBAR_OPEN "open hilighted mailbox"
1491
*** mutt-1.5.23-orig/pager.c	2014-03-12 11:06:17.000000000 -0500
1562
*** mutt-1.5.24-orig/pager.c	2015-08-30 12:06:38.000000000 -0500
1492
--- mutt-1.5.23/pager.c	2014-04-12 21:53:15.000000000 -0500
1563
--- mutt-1.5.24/pager.c	2015-09-16 23:18:13.000000000 -0500
1493
***************
1564
***************
1494
*** 29,34 ****
1565
*** 29,34 ****
1495
--- 29,35 ----
1566
--- 29,35 ----
Lines 1586-1593 Link Here
1586
! 	mutt_paddstr (COLS, bn);
1657
! 	mutt_paddstr (COLS, bn);
1587
        }
1658
        }
1588
        NORMAL_COLOR;
1659
        NORMAL_COLOR;
1589
      }
1660
        if (option(OPTTSENABLED) && TSSupported)
1590
  
1661
        {
1591
--- 1793,1831 ----
1662
--- 1793,1831 ----
1592
        hfi.ctx = Context;
1663
        hfi.ctx = Context;
1593
        hfi.pager_progress = pager_progress_str;
1664
        hfi.pager_progress = pager_progress_str;
Lines 1626-1635 Link Here
1626
+       if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
1697
+       if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
1627
+           DrawFullLine = 0; /* reset */
1698
+           DrawFullLine = 0; /* reset */
1628
        NORMAL_COLOR;
1699
        NORMAL_COLOR;
1629
      }
1700
        if (option(OPTTSENABLED) && TSSupported)
1630
  
1701
        {
1631
***************
1702
***************
1632
*** 1819,1834 ****
1703
*** 1826,1841 ****
1633
        /* redraw the pager_index indicator, because the
1704
        /* redraw the pager_index indicator, because the
1634
         * flags for this message might have changed. */
1705
         * flags for this message might have changed. */
1635
        menu_redraw_current (index);
1706
        menu_redraw_current (index);
Lines 1646-1652 Link Here
1646
      redraw = 0;
1717
      redraw = 0;
1647
  
1718
  
1648
      if (option(OPTBRAILLEFRIENDLY)) {
1719
      if (option(OPTBRAILLEFRIENDLY)) {
1649
--- 1834,1855 ----
1720
--- 1841,1862 ----
1650
        /* redraw the pager_index indicator, because the
1721
        /* redraw the pager_index indicator, because the
1651
         * flags for this message might have changed. */
1722
         * flags for this message might have changed. */
1652
        menu_redraw_current (index);
1723
        menu_redraw_current (index);
Lines 1670-1677 Link Here
1670
  
1741
  
1671
      if (option(OPTBRAILLEFRIENDLY)) {
1742
      if (option(OPTBRAILLEFRIENDLY)) {
1672
***************
1743
***************
1673
*** 2763,2768 ****
1744
*** 2770,2775 ****
1674
--- 2784,2796 ----
1745
--- 2791,2803 ----
1675
  	mutt_what_key ();
1746
  	mutt_what_key ();
1676
  	break;
1747
  	break;
1677
  
1748
  
Lines 1685-1692 Link Here
1685
        default:
1756
        default:
1686
  	ch = -1;
1757
  	ch = -1;
1687
  	break;
1758
  	break;
1688
*** mutt-1.5.23-orig/pattern.c	2014-03-12 11:03:45.000000000 -0500
1759
*** mutt-1.5.24-orig/pattern.c	2015-08-30 12:06:38.000000000 -0500
1689
--- mutt-1.5.23/pattern.c	2014-04-11 10:14:01.000000000 -0500
1760
--- mutt-1.5.24/pattern.c	2015-09-16 23:18:13.000000000 -0500
1690
***************
1761
***************
1691
*** 154,159 ****
1762
*** 154,159 ****
1692
--- 154,163 ----
1763
--- 154,163 ----
Lines 1783-1796 Link Here
1783
      }
1854
      }
1784
    }
1855
    }
1785
  
1856
  
1786
*** mutt-1.5.23-orig/PATCHES	2014-03-12 11:03:44.000000000 -0500
1857
*** mutt-1.5.24-orig/PATCHES	2015-08-30 12:06:38.000000000 -0500
1787
--- mutt-1.5.23/PATCHES	2014-04-12 12:36:35.000000000 -0500
1858
--- mutt-1.5.24/PATCHES	2015-11-11 09:39:02.000000000 -0600
1788
***************
1859
***************
1789
*** 0 ****
1860
*** 0 ****
1790
--- 1 ----
1861
--- 1 ----
1791
+ patch-1.5.23.sidebar.20140412.txt
1862
+ patch-1.5.24.sidebar.20151111.txt
1792
*** mutt-1.5.23-orig/protos.h	2014-03-12 11:06:17.000000000 -0500
1863
*** mutt-1.5.24-orig/protos.h	2015-08-30 12:06:38.000000000 -0500
1793
--- mutt-1.5.23/protos.h	2014-04-11 10:14:01.000000000 -0500
1864
--- mutt-1.5.24/protos.h	2015-09-16 23:18:13.000000000 -0500
1794
***************
1865
***************
1795
*** 36,41 ****
1866
*** 36,41 ****
1796
--- 36,48 ----
1867
--- 36,48 ----
Lines 1807-2224 Link Here
1807
  void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
1878
  void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
1808
  
1879
  
1809
  int mutt_extract_token (BUFFER *, BUFFER *, int);
1880
  int mutt_extract_token (BUFFER *, BUFFER *, int);
1810
*** mutt-1.5.23-orig/sidebar.c	1969-12-31 18:00:00.000000000 -0600
1881
*** mutt-1.5.24-orig/sidebar.c	1969-12-31 18:00:00.000000000 -0600
1811
--- mutt-1.5.23/sidebar.c	2014-04-11 10:14:01.000000000 -0500
1882
--- /dev/null	2015-12-15 19:07:50.000000000 +0100
1812
***************
1883
+++ tmp/sidebar.c	2015-12-15 19:06:57.000000000 +0100
1813
*** 0 ****
1884
@@ -0,0 +1,419 @@
1814
--- 1,405 ----
1885
+/*
1815
+ /*
1886
+ * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1816
+  * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1887
+ * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1817
+  * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1888
+ * 
1818
+  * 
1889
+ *     This program is free software; you can redistribute it and/or modify
1819
+  *     This program is free software; you can redistribute it and/or modify
1890
+ *     it under the terms of the GNU General Public License as published by
1820
+  *     it under the terms of the GNU General Public License as published by
1891
+ *     the Free Software Foundation; either version 2 of the License, or
1821
+  *     the Free Software Foundation; either version 2 of the License, or
1892
+ *     (at your option) any later version.
1822
+  *     (at your option) any later version.
1893
+ * 
1823
+  * 
1894
+ *     This program is distributed in the hope that it will be useful,
1824
+  *     This program is distributed in the hope that it will be useful,
1895
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1825
+  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1896
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1826
+  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1897
+ *     GNU General Public License for more details.
1827
+  *     GNU General Public License for more details.
1898
+ * 
1828
+  * 
1899
+ *     You should have received a copy of the GNU General Public License
1829
+  *     You should have received a copy of the GNU General Public License
1900
+ *     along with this program; if not, write to the Free Software
1830
+  *     along with this program; if not, write to the Free Software
1901
+ *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1831
+  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1902
+ */ 
1832
+  */ 
1903
+
1833
+ 
1904
+
1834
+ 
1905
+#if HAVE_CONFIG_H
1835
+ #if HAVE_CONFIG_H
1906
+# include "config.h"
1836
+ # include "config.h"
1907
+#endif
1837
+ #endif
1908
+
1838
+ 
1909
+#include "mutt.h"
1839
+ #include "mutt.h"
1910
+#include "mutt_menu.h"
1840
+ #include "mutt_menu.h"
1911
+#include "mutt_curses.h"
1841
+ #include "mutt_curses.h"
1912
+#include "sidebar.h"
1842
+ #include "sidebar.h"
1913
+#include "buffy.h"
1843
+ #include "buffy.h"
1914
+#include <libgen.h>
1844
+ #include <libgen.h>
1915
+#include "keymap.h"
1845
+ #include "keymap.h"
1916
+#include <stdbool.h>
1846
+ #include <stdbool.h>
1917
+
1847
+ 
1918
+/*BUFFY *CurBuffy = 0;*/
1848
+ /*BUFFY *CurBuffy = 0;*/
1919
+static BUFFY *TopBuffy = 0;
1849
+ static BUFFY *TopBuffy = 0;
1920
+static BUFFY *BottomBuffy = 0;
1850
+ static BUFFY *BottomBuffy = 0;
1921
+static int known_lines = 0;
1851
+ static int known_lines = 0;
1922
+
1852
+ 
1923
+void calc_boundaries() {
1853
+ void calc_boundaries() {
1924
+
1854
+ 
1925
+    BUFFY *tmp = Incoming;
1855
+     BUFFY *tmp = Incoming;
1926
+
1856
+ 
1927
+	int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
1857
+ 	int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
1928
+
1858
+ 
1929
+	if ( known_lines != LINES ) {
1859
+ 	if ( known_lines != LINES ) {
1930
+		TopBuffy = BottomBuffy = 0;
1860
+ 		TopBuffy = BottomBuffy = 0;
1931
+		known_lines = LINES;
1861
+ 		known_lines = LINES;
1932
+	}
1862
+ 	}
1933
+	for ( ; tmp->next != 0; tmp = tmp->next )
1863
+ 	for ( ; tmp->next != 0; tmp = tmp->next )
1934
+		tmp->next->prev = tmp;
1864
+ 		tmp->next->prev = tmp;
1935
+
1865
+ 
1936
+	if ( TopBuffy == 0 && BottomBuffy == 0 )
1866
+ 	if ( TopBuffy == 0 && BottomBuffy == 0 )
1937
+		TopBuffy = Incoming;
1867
+ 		TopBuffy = Incoming;
1938
+	if ( BottomBuffy == 0 ) {
1868
+ 	if ( BottomBuffy == 0 ) {
1939
+		BottomBuffy = TopBuffy;
1869
+ 		BottomBuffy = TopBuffy;
1940
+		while ( --count && BottomBuffy->next )
1870
+ 		while ( --count && BottomBuffy->next )
1941
+			BottomBuffy = BottomBuffy->next;
1871
+ 			BottomBuffy = BottomBuffy->next;
1942
+	}
1872
+ 	}
1943
+	else if ( TopBuffy == CurBuffy->next ) {
1873
+ 	else if ( TopBuffy == CurBuffy->next ) {
1944
+		BottomBuffy = CurBuffy;
1874
+ 		BottomBuffy = CurBuffy;
1945
+		tmp = BottomBuffy;
1875
+ 		tmp = BottomBuffy;
1946
+		while ( --count && tmp->prev)
1876
+ 		while ( --count && tmp->prev)
1947
+			tmp = tmp->prev;
1877
+ 			tmp = tmp->prev;
1948
+		TopBuffy = tmp;
1878
+ 		TopBuffy = tmp;
1949
+	}
1879
+ 	}
1950
+	else if ( BottomBuffy == CurBuffy->prev ) {
1880
+ 	else if ( BottomBuffy == CurBuffy->prev ) {
1951
+		TopBuffy = CurBuffy;
1881
+ 		TopBuffy = CurBuffy;
1952
+		tmp = TopBuffy;
1882
+ 		tmp = TopBuffy;
1953
+		while ( --count && tmp->next )
1883
+ 		while ( --count && tmp->next )
1954
+			tmp = tmp->next;
1884
+ 			tmp = tmp->next;
1955
+		BottomBuffy = tmp;
1885
+ 		BottomBuffy = tmp;
1956
+	}
1886
+ 	}
1957
+}
1887
+ }
1958
+
1888
+ 
1959
+static const char *
1889
+ static const char *
1960
+sidebar_format_str (char *dest,
1890
+ sidebar_format_str (char *dest,
1961
+			size_t destlen,
1891
+ 			size_t destlen,
1962
+			size_t col,
1892
+ 			size_t col,
1963
+			char op,
1893
+ 			char op,
1964
+			const char *src,
1894
+ 			const char *src,
1965
+			const char *prefix,
1895
+ 			const char *prefix,
1966
+			const char *ifstring,
1896
+ 			const char *ifstring,
1967
+			const char *elsestring,
1897
+ 			const char *elsestring,
1968
+			unsigned long data,
1898
+ 			unsigned long data,
1969
+			format_flag flags)
1899
+ 			format_flag flags)
1970
+{
1900
+ {
1971
+/* casting from unsigned long - srsly?! */
1901
+ /* casting from unsigned long - srsly?! */
1972
+struct sidebar_entry *sbe = (struct sidebar_entry *) data;
1902
+ struct sidebar_entry *sbe = (struct sidebar_entry *) data;
1973
+unsigned int optional;
1903
+ unsigned int optional;
1974
+char fmt[SHORT_STRING], buf[SHORT_STRING];
1904
+ char fmt[SHORT_STRING], buf[SHORT_STRING];
1975
+
1905
+ 
1976
+optional = flags & M_FORMAT_OPTIONAL;
1906
+ optional = flags & M_FORMAT_OPTIONAL;
1977
+
1907
+ 
1978
+switch(op) {
1908
+ switch(op) {
1979
+	case 'F':
1909
+ 	case 'F':
1980
+		if(!optional) {
1910
+ 		if(!optional) {
1981
+			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1911
+ 			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1982
+			snprintf (dest, destlen, fmt, sbe->flagged);
1912
+ 			snprintf (dest, destlen, fmt, sbe->flagged);
1983
+		} else if(sbe->flagged == 0) {
1913
+ 		} else if(sbe->flagged == 0) {
1984
+			optional = 0;
1914
+ 			optional = 0;
1985
+		}
1915
+ 		}
1986
+		break;
1916
+ 		break;
1987
+
1917
+ 
1988
+	case '!':
1918
+ 	case '!':
1989
+		if(sbe->flagged == 0)
1919
+ 		if(sbe->flagged == 0)
1990
+			mutt_format_s(dest, destlen, prefix, "");
1920
+ 			mutt_format_s(dest, destlen, prefix, "");
1991
+		if(sbe->flagged == 1)
1921
+ 		if(sbe->flagged == 1)
1992
+			mutt_format_s(dest, destlen, prefix, "!");
1922
+ 			mutt_format_s(dest, destlen, prefix, "!");
1993
+		if(sbe->flagged == 2)
1923
+ 		if(sbe->flagged == 2)
1994
+			mutt_format_s(dest, destlen, prefix, "!!");
1924
+ 			mutt_format_s(dest, destlen, prefix, "!!");
1995
+		if(sbe->flagged > 2) {
1925
+ 		if(sbe->flagged > 2) {
1996
+			snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
1926
+ 			snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
1997
+			mutt_format_s(dest, destlen, prefix, buf);
1927
+ 			mutt_format_s(dest, destlen, prefix, buf);
1998
+		}
1928
+ 		}
1999
+		break;
1929
+ 		break;
2000
+
1930
+ 
2001
+	case 'S':
1931
+ 	case 'S':
2002
+                if(!optional) {
1932
+ 		snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
2003
+		    snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1933
+ 		snprintf (dest, destlen, fmt, sbe->size);
2004
+		    snprintf (dest, destlen, fmt, sbe->size);
1934
+ 		break;
2005
+                } else if (sbe->size == 0) {
1935
+ 
2006
+                    optional = 0;
1936
+ 	case 'N':
2007
+                }
1937
+ 		if(!optional) {
2008
+		break;
1938
+ 			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
2009
+
1939
+ 			snprintf (dest, destlen, fmt, sbe->new);
2010
+	case 'N':
1940
+ 		} else if(sbe->new == 0) {
2011
+		if(!optional) {
1941
+ 			optional = 0;
2012
+			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1942
+ 		}
2013
+			snprintf (dest, destlen, fmt, sbe->new);
1943
+ 		break;
2014
+		} else if(sbe->new == 0) {
1944
+ 
2015
+			optional = 0;
1945
+ 	case 'B':
2016
+		}
1946
+ 		mutt_format_s(dest, destlen, prefix, sbe->box);
2017
+		break;
1947
+ 		break;
2018
+
1948
+ 	}
2019
+	case 'B':
1949
+ 
2020
+		mutt_format_s(dest, destlen, prefix, sbe->box);
1950
+ 	if(optional)
2021
+		break;
1951
+ 		mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
2022
+	}
1952
+ 	else if (flags & M_FORMAT_OPTIONAL)
2023
+
1953
+ 		mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
2024
+	if(optional)
1954
+ 
2025
+		mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
1955
+ 	return (src);
2026
+	else if (flags & M_FORMAT_OPTIONAL)
1956
+ }
2027
+		mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
1957
+ 
2028
+
1958
+ char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
2029
+	return (src);
1959
+     static char *entry = 0;
2030
+}
1960
+     struct sidebar_entry sbe;
2031
+
1961
+     int SBvisual;
2032
+char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
1962
+ 
2033
+    static char *entry = 0;
1963
+     SBvisual = SidebarWidth - strlen(SidebarDelim);
2034
+    struct sidebar_entry sbe;
1964
+     if (SBvisual < 1)
2035
+    int SBvisual;
1965
+         return NULL;
2036
+
1966
+ 
2037
+    SBvisual = SidebarWidth - strlen(SidebarDelim);
1967
+     sbe.new = new;
2038
+    if (SBvisual < 1)
1968
+     sbe.flagged = flagged;
2039
+        return NULL;
1969
+     sbe.size = size;
2040
+
1970
+     strncpy(sbe.box, box, 31);
2041
+    sbe.new = new;
1971
+ 
2042
+    sbe.flagged = flagged;
1972
+     safe_realloc(&entry, SBvisual + 2);
2043
+    sbe.size = size;
1973
+     entry[SBvisual + 1] = '\0';
2044
+    strncpy(sbe.box, box, SHORT_STRING-1);
1974
+ 
2045
+
1975
+     mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
2046
+    safe_realloc(&entry, SBvisual + 2);
1976
+ 
2047
+    entry[SBvisual + 1] = '\0';
1977
+     return entry;
2048
+
1978
+ }
2049
+    mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
1979
+ 
2050
+
1980
+ void set_curbuffy(char buf[LONG_STRING])
2051
+    return entry;
1981
+ {
2052
+}
1982
+   BUFFY* tmp = CurBuffy = Incoming;
2053
+
1983
+ 
2054
+void set_curbuffy(char buf[LONG_STRING])
1984
+   if (!Incoming)
2055
+{
1985
+     return;
2056
+  BUFFY* tmp = CurBuffy = Incoming;
1986
+ 
2057
+
1987
+   while(1) {
2058
+  if (!Incoming)
1988
+     if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
2059
+    return;
1989
+       CurBuffy = tmp;
2060
+
1990
+       break;
2061
+  while(1) {
1991
+     }
2062
+    if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
1992
+ 
2063
+      CurBuffy = tmp;
1993
+     if(tmp->next)
2064
+      break;
1994
+       tmp = tmp->next;
2065
+    }
1995
+     else
2066
+
1996
+       break;
2067
+    if(tmp->next)
1997
+   }
2068
+      tmp = tmp->next;
1998
+ }
2069
+    else
1999
+ 
2070
+      break;
2000
+ int draw_sidebar(int menu) {
2071
+  }
2001
+ 
2072
+}
2002
+ 	BUFFY *tmp;
2073
+
2003
+ #ifndef USE_SLANG_CURSES
2074
+int draw_sidebar(int menu) {
2004
+         attr_t attrs;
2075
+
2005
+ #endif
2076
+	BUFFY *tmp;
2006
+         short delim_len = strlen(SidebarDelim);
2077
+#ifndef USE_SLANG_CURSES
2007
+         short color_pair;
2078
+        attr_t attrs;
2008
+ 
2079
+#endif
2009
+         static bool initialized = false;
2080
+        short delim_len = strlen(SidebarDelim);
2010
+         static int prev_show_value;
2081
+        short color_pair;
2011
+         static short saveSidebarWidth;
2082
+
2012
+         int lines = 0;
2083
+        static bool initialized = false;
2013
+         int SidebarHeight;
2084
+        static int prev_show_value;
2014
+         
2085
+        static short saveSidebarWidth;
2015
+         if(option(OPTSTATUSONTOP) || option(OPTHELP))
2086
+        int lines = 0;
2016
+                 lines++; /* either one will occupy the first line */
2087
+        int SidebarHeight;
2017
+ 
2088
+        
2018
+         /* initialize first time */
2089
+        if(option(OPTSTATUSONTOP) || option(OPTHELP))
2019
+         if(!initialized) {
2090
+                lines++; /* either one will occupy the first line */
2020
+                 prev_show_value = option(OPTSIDEBAR);
2091
+
2021
+                 saveSidebarWidth = SidebarWidth;
2092
+        /* initialize first time */
2022
+                 if(!option(OPTSIDEBAR)) SidebarWidth = 0;
2093
+        if(!initialized) {
2023
+                 initialized = true;
2094
+                prev_show_value = option(OPTSIDEBAR);
2024
+         }
2095
+                saveSidebarWidth = SidebarWidth;
2025
+ 
2096
+                if(!option(OPTSIDEBAR)) SidebarWidth = 0;
2026
+         /* save or restore the value SidebarWidth */
2097
+                initialized = true;
2027
+         if(prev_show_value != option(OPTSIDEBAR)) {
2028
+                 if(prev_show_value && !option(OPTSIDEBAR)) {
2029
+                         saveSidebarWidth = SidebarWidth;
2030
+                         SidebarWidth = 0;
2031
+                 } else if(!prev_show_value && option(OPTSIDEBAR)) {
2032
+                         mutt_buffy_check(1); /* we probably have bad or no numbers */
2033
+                         SidebarWidth = saveSidebarWidth;
2034
+                 }
2035
+                 prev_show_value = option(OPTSIDEBAR);
2036
+         }
2037
+ 
2038
+ 
2039
+ /*	if ( SidebarWidth == 0 ) return 0; */
2040
+        if (SidebarWidth > 0 && option (OPTSIDEBAR)
2041
+            && delim_len >= SidebarWidth) {
2042
+          unset_option (OPTSIDEBAR);
2043
+          /* saveSidebarWidth = SidebarWidth; */
2044
+          if (saveSidebarWidth > delim_len) {
2045
+            SidebarWidth = saveSidebarWidth;
2046
+            mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
2047
+            sleep (2);
2048
+          } else {
2049
+            SidebarWidth = 0;
2050
+            mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
2051
+            sleep (4); /* the advise to set a sane value should be seen long enough */
2052
+          }
2053
+          saveSidebarWidth = 0;
2054
+          return (0);
2055
+        }
2098
+        }
2056
+ 
2099
+
2057
+     if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
2100
+        /* save or restore the value SidebarWidth */
2058
+       if (SidebarWidth > 0) {
2101
+        if(prev_show_value != option(OPTSIDEBAR)) {
2059
+         saveSidebarWidth = SidebarWidth;
2102
+                if(prev_show_value && !option(OPTSIDEBAR)) {
2060
+         SidebarWidth = 0;
2103
+                        saveSidebarWidth = SidebarWidth;
2104
+                        SidebarWidth = 0;
2105
+                } else if(!prev_show_value && option(OPTSIDEBAR)) {
2106
+                        mutt_buffy_check(1); /* we probably have bad or no numbers */
2107
+                        SidebarWidth = saveSidebarWidth;
2108
+                }
2109
+                prev_show_value = option(OPTSIDEBAR);
2110
+        }
2111
+
2112
+
2113
+/*	if ( SidebarWidth == 0 ) return 0; */
2114
+       if (SidebarWidth > 0 && option (OPTSIDEBAR)
2115
+           && delim_len >= SidebarWidth) {
2116
+         unset_option (OPTSIDEBAR);
2117
+         /* saveSidebarWidth = SidebarWidth; */
2118
+         if (saveSidebarWidth > delim_len) {
2119
+           SidebarWidth = saveSidebarWidth;
2120
+           mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
2121
+           sleep (2);
2122
+         } else {
2123
+           SidebarWidth = 0;
2124
+           mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
2125
+           sleep (4); /* the advise to set a sane value should be seen long enough */
2126
+         }
2127
+         saveSidebarWidth = 0;
2128
+         return (0);
2061
+       }
2129
+       }
2062
+       unset_option(OPTSIDEBAR);
2130
+
2063
+       return 0;
2131
+    if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
2064
+     }
2132
+      if (SidebarWidth > 0) {
2065
+ 
2133
+        saveSidebarWidth = SidebarWidth;
2066
+         /* get attributes for divider */
2134
+        SidebarWidth = 0;
2067
+ 	SETCOLOR(MT_COLOR_STATUS);
2135
+      }
2068
+ #ifndef USE_SLANG_CURSES
2136
+      unset_option(OPTSIDEBAR);
2069
+         attr_get(&attrs, &color_pair, 0);
2137
+      return 0;
2070
+ #else
2138
+    }
2071
+         color_pair = attr_get();
2139
+
2072
+ #endif
2140
+        /* get attributes for divider */
2073
+ 	SETCOLOR(MT_COLOR_NORMAL);
2141
+	SETCOLOR(MT_COLOR_STATUS);
2074
+ 
2142
+#ifndef USE_SLANG_CURSES
2075
+ 	/* draw the divider */
2143
+        attr_get(&attrs, &color_pair, 0);
2076
+ 
2144
+#else
2077
+ 	SidebarHeight =  LINES - 1;
2145
+        color_pair = attr_get();
2078
+ 	if(option(OPTHELP) || !option(OPTSTATUSONTOP))
2146
+#endif
2079
+ 		SidebarHeight--;
2147
+	SETCOLOR(MT_COLOR_NORMAL);
2080
+ 
2148
+
2081
+ 	for ( ; lines < SidebarHeight; lines++ ) {
2149
+	/* draw the divider */
2082
+ 		move(lines, SidebarWidth - delim_len);
2150
+
2083
+ 		addstr(NONULL(SidebarDelim));
2151
+	SidebarHeight =  LINES - 1;
2084
+ #ifndef USE_SLANG_CURSES
2152
+	if(option(OPTHELP) || !option(OPTSTATUSONTOP))
2085
+                 mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
2153
+		SidebarHeight--;
2086
+ #endif
2154
+
2087
+ 	}
2155
+	for ( ; lines < SidebarHeight; lines++ ) {
2088
+ 
2156
+		move(lines, SidebarWidth - delim_len);
2089
+ 	if ( Incoming == 0 ) return 0;
2157
+		addstr(NONULL(SidebarDelim));
2090
+         lines = 0;
2158
+#ifndef USE_SLANG_CURSES
2091
+         if(option(OPTSTATUSONTOP) || option(OPTHELP))
2159
+                mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
2092
+                 lines++; /* either one will occupy the first line */
2160
+#endif
2093
+ 
2161
+	}
2094
+ 	if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
2162
+
2095
+ 		calc_boundaries(menu);
2163
+	if ( Incoming == 0 ) return 0;
2096
+ 	if ( CurBuffy == 0 ) CurBuffy = Incoming;
2164
+        lines = 0;
2097
+ 
2165
+        if(option(OPTSTATUSONTOP) || option(OPTHELP))
2098
+ 	tmp = TopBuffy;
2166
+                lines++; /* either one will occupy the first line */
2099
+ 
2167
+
2100
+ 	SETCOLOR(MT_COLOR_NORMAL);
2168
+	if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
2101
+ 
2169
+		calc_boundaries(menu);
2102
+ 	for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) {
2170
+	if ( CurBuffy == 0 ) CurBuffy = Incoming;
2103
+ 		if ( tmp == CurBuffy )
2171
+
2104
+ 			SETCOLOR(MT_COLOR_INDICATOR);
2172
+	tmp = TopBuffy;
2105
+ 		else if ( tmp->msg_unread > 0 )
2173
+
2106
+ 			SETCOLOR(MT_COLOR_NEW);
2174
+	SETCOLOR(MT_COLOR_NORMAL);
2107
+ 		else if ( tmp->msg_flagged > 0 )
2175
+
2108
+ 		        SETCOLOR(MT_COLOR_FLAGGED);
2176
+	for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) {
2109
+ 		else
2177
+		if ( tmp == CurBuffy )
2110
+ 			SETCOLOR(MT_COLOR_NORMAL);
2178
+			SETCOLOR(MT_COLOR_INDICATOR);
2111
+ 
2179
+		else if ( tmp->msg_unread > 0 )
2112
+ 		move( lines, 0 );
2180
+			SETCOLOR(MT_COLOR_NEW);
2113
+ 		if ( Context && (!strcmp(tmp->path, Context->path)||
2181
+		else if ( tmp->msg_flagged > 0 )
2114
+ 				 !strcmp(tmp->realpath, Context->path)) ) {
2182
+		        SETCOLOR(MT_COLOR_FLAGGED);
2115
+ 			tmp->msg_unread = Context->unread;
2183
+		else
2116
+ 			tmp->msgcount = Context->msgcount;
2184
+			SETCOLOR(MT_COLOR_NORMAL);
2117
+ 			tmp->msg_flagged = Context->flagged;
2185
+
2118
+ 		}
2186
+		move( lines, 0 );
2119
+ 		/* check whether Maildir is a prefix of the current folder's path */
2187
+		if ( Context && Context->path &&
2120
+ 		short maildir_is_prefix = 0;
2188
+                        (!strcmp(tmp->path, Context->path)||
2121
+ 		if ( (strlen(tmp->path) > strlen(Maildir)) &&
2189
+			 !strcmp(tmp->realpath, Context->path)) ) {
2122
+ 			(strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
2190
+			tmp->msg_unread = Context->unread;
2123
+         		maildir_is_prefix = 1;
2191
+			tmp->msgcount = Context->msgcount;
2124
+ 		/* calculate depth of current folder and generate its display name with indented spaces */
2192
+			tmp->msg_flagged = Context->flagged;
2125
+ 		int sidebar_folder_depth = 0;
2193
+		}
2126
+ 		char *sidebar_folder_name;
2194
+		/* check whether Maildir is a prefix of the current folder's path */
2127
+ 		sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + 1);
2195
+		short maildir_is_prefix = 0;
2128
+ 		if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
2196
+		if ( (strlen(tmp->path) > strlen(Maildir)) &&
2129
+ 			char *tmp_folder_name;
2197
+			(strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
2130
+ 			int i;
2198
+        		maildir_is_prefix = 1;
2131
+ 			tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2199
+		/* calculate depth of current folder and generate its display name with indented spaces */
2132
+ 			for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
2200
+		int sidebar_folder_depth = 0;
2133
+  				if (tmp_folder_name[i] == '/'  || tmp_folder_name[i] == '.') sidebar_folder_depth++;
2201
+		char *sidebar_folder_name;
2134
+ 			}   
2202
+		sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ?  mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ?  0 : 1));
2135
+ 			if (sidebar_folder_depth > 0) {
2203
+		/* sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + 1); */
2136
+  				if (option(OPTSIDEBARSHORTPATH)) {
2204
+		if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
2137
+  					tmp_folder_name = strrchr(tmp->path, '.');
2205
+			char *tmp_folder_name;
2138
+  					if (tmp_folder_name == NULL)
2206
+			char *tmp_folder_name_dot;
2207
+			char *tmp_folder_name_slash;
2208
+			int i;
2209
+			tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2210
+			for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
2211
+ 				if (tmp_folder_name[i] == '/'  || tmp_folder_name[i] == '.') sidebar_folder_depth++;
2212
+			}   
2213
+			if (sidebar_folder_depth > 0) {
2214
+ 				if (option(OPTSIDEBARSHORTPATH)) {
2215
+ 					tmp_folder_name_dot = strrchr(tmp->path, '.');
2216
+ 					tmp_folder_name_slash = strrchr(tmp->path, '/');
2217
+					if (tmp_folder_name_dot == NULL && tmp_folder_name_slash == NULL)
2139
+  						tmp_folder_name = mutt_basename(tmp->path);
2218
+  						tmp_folder_name = mutt_basename(tmp->path);
2140
+  					else
2219
+ 					tmp_folder_name = strrchr(tmp->path, '.');
2141
+ 						tmp_folder_name++;
2220
+ 					if (tmp_folder_name == NULL)
2142
+  				}
2221
+ 						tmp_folder_name = mutt_basename(tmp->path);
2143
+  				else
2222
+                                        else if (tmp_folder_name_dot > tmp_folder_name_slash)
2144
+  					tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2223
+                                                tmp_folder_name = tmp_folder_name_dot + 1;
2145
+  				sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
2224
+                                        else
2146
+ 				sidebar_folder_name[0]=0;
2225
+                                                tmp_folder_name = tmp_folder_name_slash + 1;
2147
+ 				for (i=0; i < sidebar_folder_depth; i++)
2226
+ 				}
2148
+ 					strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr)));
2227
+ 				else
2149
+ 				strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name));
2228
+ 					tmp_folder_name = tmp->path + strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ?  0 : 1);
2150
+ 			}
2229
+ 				sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
2151
+ 		}
2230
+				sidebar_folder_name[0]=0;
2152
+ 		printw( "%.*s", SidebarWidth - delim_len + 1,
2231
+				for (i=0; i < sidebar_folder_depth; i++)
2153
+ 			make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
2232
+					strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr)));
2154
+ 			tmp->msg_unread, tmp->msg_flagged));
2233
+				strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name));
2155
+ 		if (sidebar_folder_depth > 0)
2234
+			}
2156
+ 		        free(sidebar_folder_name);
2235
+		}
2157
+ 		lines++;
2236
+		printw( "%.*s", SidebarWidth - delim_len + 1,
2158
+ 	}
2237
+			make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
2159
+ 	SETCOLOR(MT_COLOR_NORMAL);
2238
+			tmp->msg_unread, tmp->msg_flagged));
2160
+ 	for ( ; lines < SidebarHeight; lines++ ) {
2239
+		if (sidebar_folder_depth > 0)
2161
+ 		int i = 0;
2240
+		        free(sidebar_folder_name);
2162
+ 		move( lines, 0 );
2241
+		lines++;
2163
+ 		for ( ; i < SidebarWidth - delim_len; i++ )
2242
+	}
2164
+ 			addch(' ');
2243
+	SETCOLOR(MT_COLOR_NORMAL);
2165
+ 	}
2244
+	for ( ; lines < SidebarHeight; lines++ ) {
2166
+ 	return 0;
2245
+		int i = 0;
2167
+ }
2246
+		move( lines, 0 );
2168
+ 
2247
+		for ( ; i < SidebarWidth - delim_len; i++ )
2169
+ 
2248
+			addch(' ');
2170
+ void set_buffystats(CONTEXT* Context)
2249
+	}
2171
+ {
2250
+	return 0;
2172
+         BUFFY *tmp = Incoming;
2251
+}
2173
+         while(tmp) {
2252
+
2174
+                 if(Context && (!strcmp(tmp->path, Context->path) ||
2253
+
2175
+                                !strcmp(tmp->realpath, Context->path))) {
2254
+void set_buffystats(CONTEXT* Context)
2176
+ 			tmp->msg_unread = Context->unread;
2255
+{
2177
+ 			tmp->msgcount = Context->msgcount;
2256
+        BUFFY *tmp = Incoming;
2178
+ 			tmp->msg_flagged = Context->flagged;
2257
+        while(tmp) {
2179
+                         break;
2258
+                if(Context && (!strcmp(tmp->path, Context->path) ||
2180
+                 }
2259
+                               !strcmp(tmp->realpath, Context->path))) {
2181
+                 tmp = tmp->next;
2260
+			tmp->msg_unread = Context->unread;
2182
+         }
2261
+			tmp->msgcount = Context->msgcount;
2183
+ }
2262
+			tmp->msg_flagged = Context->flagged;
2184
+ 
2263
+                        break;
2185
+ void scroll_sidebar(int op, int menu)
2264
+                }
2186
+ {
2265
+                tmp = tmp->next;
2187
+         if(!SidebarWidth) return;
2266
+        }
2188
+         if(!CurBuffy) return;
2267
+}
2189
+ 
2268
+
2190
+ 	switch (op) {
2269
+void scroll_sidebar(int op, int menu)
2191
+ 		case OP_SIDEBAR_NEXT:
2270
+{
2192
+ 			if ( CurBuffy->next == NULL ) return;
2271
+        if(!SidebarWidth) return;
2193
+ 			CurBuffy = CurBuffy->next;
2272
+        if(!CurBuffy) return;
2194
+ 			break;
2273
+
2195
+ 		case OP_SIDEBAR_PREV:
2274
+	switch (op) {
2196
+ 			if ( CurBuffy->prev == NULL ) return;
2275
+		case OP_SIDEBAR_NEXT:
2197
+ 			CurBuffy = CurBuffy->prev;
2276
+			if ( CurBuffy->next == NULL ) return;
2198
+ 			break;
2277
+			CurBuffy = CurBuffy->next;
2199
+ 		case OP_SIDEBAR_SCROLL_UP:
2278
+			break;
2200
+ 			CurBuffy = TopBuffy;
2279
+		case OP_SIDEBAR_PREV:
2201
+ 			if ( CurBuffy != Incoming ) {
2280
+			if ( CurBuffy->prev == NULL ) return;
2202
+ 				calc_boundaries(menu);
2281
+			CurBuffy = CurBuffy->prev;
2203
+ 				CurBuffy = CurBuffy->prev;
2282
+			break;
2204
+ 			}
2283
+		case OP_SIDEBAR_SCROLL_UP:
2205
+ 			break;
2284
+			CurBuffy = TopBuffy;
2206
+ 		case OP_SIDEBAR_SCROLL_DOWN:
2285
+			if ( CurBuffy != Incoming ) {
2207
+ 			CurBuffy = BottomBuffy;
2286
+				calc_boundaries(menu);
2208
+ 			if ( CurBuffy->next ) {
2287
+				CurBuffy = CurBuffy->prev;
2209
+ 				calc_boundaries(menu);
2288
+			}
2210
+ 				CurBuffy = CurBuffy->next;
2289
+			break;
2211
+ 			}
2290
+		case OP_SIDEBAR_SCROLL_DOWN:
2212
+ 			break;
2291
+			CurBuffy = BottomBuffy;
2213
+ 		default:
2292
+			if ( CurBuffy->next ) {
2214
+ 			return;
2293
+				calc_boundaries(menu);
2215
+ 	}
2294
+				CurBuffy = CurBuffy->next;
2216
+ 	calc_boundaries(menu);
2295
+			}
2217
+ 	draw_sidebar(menu);
2296
+			break;
2218
+ }
2297
+		default:
2219
+ 
2298
+			return;
2220
*** mutt-1.5.23-orig/sidebar.h	1969-12-31 18:00:00.000000000 -0600
2299
+	}
2221
--- mutt-1.5.23/sidebar.h	2014-04-11 10:14:01.000000000 -0500
2300
+	calc_boundaries(menu);
2301
+	draw_sidebar(menu);
2302
+}
2303
+
2304
*** mutt-1.5.24-orig/sidebar.h	1969-12-31 18:00:00.000000000 -0600
2305
--- mutt-1.5.24/sidebar.h	2015-09-16 23:18:13.000000000 -0500
2222
***************
2306
***************
2223
*** 0 ****
2307
*** 0 ****
2224
--- 1,36 ----
2308
--- 1,36 ----
Lines 2258-2265 Link Here
2258
+ void set_buffystats(CONTEXT*);
2342
+ void set_buffystats(CONTEXT*);
2259
+ 
2343
+ 
2260
+ #endif /* SIDEBAR_H */
2344
+ #endif /* SIDEBAR_H */
2261
*** mutt-1.5.23-orig/doc/Muttrc	2014-03-12 11:27:11.000000000 -0500
2345
*** mutt-1.5.24-orig/doc/Muttrc	2015-08-30 12:24:53.000000000 -0500
2262
--- mutt-1.5.23/doc/Muttrc	2014-04-11 10:14:01.000000000 -0500
2346
--- mutt-1.5.24/doc/Muttrc	2015-09-16 23:18:13.000000000 -0500
2263
***************
2347
***************
2264
*** 657,662 ****
2348
*** 657,662 ****
2265
--- 657,682 ----
2349
--- 657,682 ----
Lines 2289-2298 Link Here
2289
  # set crypt_autosign=no
2373
  # set crypt_autosign=no
2290
  #
2374
  #
2291
  # Name: crypt_autosign
2375
  # Name: crypt_autosign
2292
*** mutt-1.5.23-orig/imap/imap.c	2014-03-12 11:03:45.000000000 -0500
2376
*** mutt-1.5.24-orig/imap/imap.c	2015-08-30 12:06:38.000000000 -0500
2293
--- mutt-1.5.23/imap/imap.c	2014-04-11 10:14:01.000000000 -0500
2377
--- mutt-1.5.24/imap/imap.c	2015-09-16 23:18:13.000000000 -0500
2294
***************
2378
***************
2295
*** 1514,1520 ****
2379
*** 1523,1529 ****
2296
  
2380
  
2297
      imap_munge_mbox_name (munged, sizeof (munged), name);
2381
      imap_munge_mbox_name (munged, sizeof (munged), name);
2298
      snprintf (command, sizeof (command),
2382
      snprintf (command, sizeof (command),
Lines 2300-2306 Link Here
2300
  
2384
  
2301
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2385
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2302
      {
2386
      {
2303
--- 1514,1520 ----
2387
--- 1523,1529 ----
2304
  
2388
  
2305
      imap_munge_mbox_name (munged, sizeof (munged), name);
2389
      imap_munge_mbox_name (munged, sizeof (munged), name);
2306
      snprintf (command, sizeof (command),
2390
      snprintf (command, sizeof (command),
Lines 2308-2315 Link Here
2308
  
2392
  
2309
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2393
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2310
      {
2394
      {
2311
*** mutt-1.5.23-orig/imap/command.c	2014-03-12 11:03:45.000000000 -0500
2395
*** mutt-1.5.24-orig/imap/command.c	2015-08-30 12:06:38.000000000 -0500
2312
--- mutt-1.5.23/imap/command.c	2014-04-11 10:14:01.000000000 -0500
2396
--- mutt-1.5.24/imap/command.c	2015-09-16 23:18:13.000000000 -0500
2313
***************
2397
***************
2314
*** 1012,1017 ****
2398
*** 1012,1017 ****
2315
--- 1012,1024 ----
2399
--- 1012,1024 ----
(-)./files/extra-patch-sidebar-nntp (-846 / +930 lines)
Lines 1-123 Link Here
1
Taken from http://lunar-linux.org/~tchan/mutt/patch-1.5.23.sidebar.20140412.txt
1
Based on http://lunar-linux.org/~tchan/mutt/patch-1.5.24.sidebar.20151111.txt
2
 - Fixed some flaws with regard to handling of "/" instead of "." for IMAP folders.
2
3
3
diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c
4
*** mutt-1.5.24-orig/buffy.c	2015-08-30 12:06:38.000000000 -0500
4
*** mutt-1.5.23-orig/buffy.c.orig	2015-08-30 19:06:38.000000000 +0200
5
--- mutt-1.5.24/buffy.c	2015-09-16 23:18:13.000000000 -0500
5
--- mutt-1.5.23/buffy.c	2015-09-10 09:31:22.000000000 +0200
6
***************
6
@@ -161,6 +161,49 @@
7
*** 161,166 ****
7
   }
8
--- 161,209 ----
8
 }
9
    }
9
 
10
  }
10
+static int buffy_compare_name(const void *a, const void *b) {
11
  
11
+  const BUFFY *b1 = * (BUFFY * const *) a;
12
+ static int buffy_compare_name(const void *a, const void *b) {
12
+  const BUFFY *b2 = * (BUFFY * const *) b;
13
+   const BUFFY *b1 = * (BUFFY * const *) a;
13
+
14
+   const BUFFY *b2 = * (BUFFY * const *) b;
14
+  return mutt_strcoll(b1->path, b2->path);
15
+ 
15
+}
16
+   return mutt_strcoll(b1->path, b2->path);
16
+
17
+ }
17
+static BUFFY *buffy_sort(BUFFY *b)
18
+ 
18
+{
19
+ static BUFFY *buffy_sort(BUFFY *b)
19
+  BUFFY *tmp = b;
20
+ {
20
+  int buffycount = 0;
21
+   BUFFY *tmp = b;
21
+  BUFFY **ary;
22
+   int buffycount = 0;
22
+  int i;
23
+   BUFFY **ary;
23
+
24
+   int i;
24
+  if (!option(OPTSIDEBARSORT))
25
+ 
25
+    return b;
26
+   if (!option(OPTSIDEBARSORT))
26
+
27
+     return b;
27
+  for (; tmp != NULL; tmp = tmp->next)
28
+ 
28
+    buffycount++;
29
+   for (; tmp != NULL; tmp = tmp->next)
29
+
30
+     buffycount++;
30
+  ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
31
+ 
31
+
32
+   ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
32
+  tmp = b;
33
+ 
33
+  for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
34
+   tmp = b;
34
+    ary[i] = tmp;
35
+   for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
35
+  }
36
+     ary[i] = tmp;
36
+
37
+   }
37
+  qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
38
+ 
38
+
39
+   qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
39
+  for (i = 0; i < buffycount - 1; i++) {
40
+ 
40
+    ary[i]->next = ary[i+1];
41
+   for (i = 0; i < buffycount - 1; i++) {
41
+  }
42
+     ary[i]->next = ary[i+1];
42
+  ary[buffycount - 1]->next = NULL;
43
+   }
43
+  for (i = 1; i < buffycount; i++) {
44
+   ary[buffycount - 1]->next = NULL;
44
+    ary[i]->prev = ary[i-1];
45
+   for (i = 1; i < buffycount; i++) {
45
+  }
46
+     ary[i]->prev = ary[i-1];
46
+  ary[0]->prev = NULL;
47
+   }
47
+
48
+   ary[0]->prev = NULL;
48
+  tmp = ary[0];
49
+ 
49
+  free(ary);
50
+   tmp = ary[0];
50
+  return tmp;
51
+   free(ary);
51
+}
52
+   return tmp;
52
+
53
+ }
53
 BUFFY *mutt_find_mailbox (const char *path)
54
+ 
54
 {
55
  BUFFY *mutt_find_mailbox (const char *path)
55
   BUFFY *tmp = NULL;
56
  {
56
@@ -196,9 +239,13 @@
57
    BUFFY *tmp = NULL;
57
 static BUFFY *buffy_new (const char *path)
58
***************
58
 {
59
*** 196,204 ****
59
   BUFFY* buffy;
60
--- 239,251 ----
60
+  char rp[PATH_MAX];
61
  static BUFFY *buffy_new (const char *path)
61
+  char *r;
62
  {
62
 
63
    BUFFY* buffy;
63
   buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
64
+   char rp[PATH_MAX];
64
   strfcpy (buffy->path, path, sizeof (buffy->path));
65
+   char *r;
65
+  r = realpath(path, rp);
66
  
66
+  strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
67
    buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
67
   buffy->next = NULL;
68
    strfcpy (buffy->path, path, sizeof (buffy->path));
68
   buffy->magic = 0;
69
+   r = realpath(path, rp);
69
 
70
+   strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
70
@@ -243,8 +290,8 @@
71
    buffy->next = NULL;
71
     p = realpath (buf, f1);
72
    buffy->magic = 0;
72
     for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
73
  
73
     {
74
***************
74
-      q = realpath ((*tmp)->path, f2);
75
*** 243,250 ****
75
-      if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
76
      p = realpath (buf, f1);
76
+      q = (*tmp)->realpath;
77
      for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
77
+      if (mutt_strcmp (p ? p : buf, q) == 0)
78
      {
78
       {
79
!       q = realpath ((*tmp)->path, f2);
79
 	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
80
!       if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
80
 	break;
81
        {
81
@@ -282,6 +329,7 @@
82
  	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
82
     else
83
  	break;
83
       (*tmp)->size = 0;
84
--- 290,297 ----
84
   }
85
      p = realpath (buf, f1);
85
+  Incoming = buffy_sort(Incoming);
86
      for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
86
   return 0;
87
      {
87
 }
88
!       q = (*tmp)->realpath;
88
 
89
!       if (mutt_strcmp (p ? p : buf, q) == 0)
89
@@ -306,6 +354,11 @@
90
        {
90
       return 0;
91
  	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
91
   }
92
  	break;
92
 
93
***************
93
+  if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
94
*** 282,287 ****
94
+      mailbox->new = 1;
95
--- 329,335 ----
95
+      return 1;
96
      else
96
+  }
97
        (*tmp)->size = 0;
97
+
98
    }
98
   if ((dirp = opendir (path)) == NULL)
99
+   Incoming = buffy_sort(Incoming);
99
   {
100
    return 0;
100
     mailbox->magic = 0;
101
  }
101
@@ -357,6 +410,73 @@
102
  
102
 
103
***************
103
   return 0;
104
*** 306,311 ****
104
 }
105
--- 354,364 ----
105
+  
106
        return 0;
106
+/* update message counts for the sidebar */
107
    }
107
+void buffy_maildir_update (BUFFY* mailbox)
108
  
108
+{
109
+   if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
110
+       mailbox->new = 1;
111
+       return 1;
112
+   }
113
+ 
114
    if ((dirp = opendir (path)) == NULL)
115
    {
116
      mailbox->magic = 0;
117
***************
118
*** 357,362 ****
119
--- 410,482 ----
120
  
121
    return 0;
122
  }
123
+   
124
+  /* update message counts for the sidebar */
125
+ void buffy_maildir_update (BUFFY* mailbox)
126
+ {
109
+  char path[_POSIX_PATH_MAX];
127
+  char path[_POSIX_PATH_MAX];
110
+  DIR *dirp;
128
+  DIR *dirp;
111
+  struct dirent *de;
129
+  struct dirent *de;
112
+  char *p;
130
+  char *p;
113
+
131
+ 
114
+  if(!option(OPTSIDEBAR))
132
+  if(!option(OPTSIDEBAR))
115
+      return;
133
+      return;
116
+
134
+ 
117
+  mailbox->msgcount = 0;
135
+  mailbox->msgcount = 0;
118
+  mailbox->msg_unread = 0;
136
+  mailbox->msg_unread = 0;
119
+  mailbox->msg_flagged = 0;
137
+  mailbox->msg_flagged = 0;
120
+
138
+ 
121
+  snprintf (path, sizeof (path), "%s/new", mailbox->path);
139
+  snprintf (path, sizeof (path), "%s/new", mailbox->path);
122
+        
140
+        
123
+  if ((dirp = opendir (path)) == NULL)
141
+  if ((dirp = opendir (path)) == NULL)
Lines 125-157 Link Here
125
+    mailbox->magic = 0;
143
+    mailbox->magic = 0;
126
+    return;
144
+    return;
127
+  } 
145
+  } 
128
+      
146
+        
129
+  while ((de = readdir (dirp)) != NULL)
147
+  while ((de = readdir (dirp)) != NULL)
130
+  {
148
+  {
131
+    if (*de->d_name == '.')
149
+    if (*de->d_name == '.')
132
+      continue;
150
+      continue;
133
+
151
+ 
134
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
152
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
135
+      mailbox->new = 1;
153
+      mailbox->new = 1;
136
+      mailbox->msgcount++;
154
+      mailbox->msgcount++;
137
+      mailbox->msg_unread++;
155
+      mailbox->msg_unread++;
138
+    }
156
+    }
139
+  }
157
+  }
140
+
158
+ 
141
+  closedir (dirp);
159
+  closedir (dirp);
142
+  snprintf (path, sizeof (path), "%s/cur", mailbox->path);
160
+  snprintf (path, sizeof (path), "%s/cur", mailbox->path);
143
+        
161
+        
144
+  if ((dirp = opendir (path)) == NULL)
162
+  if ((dirp = opendir (path)) == NULL)
145
+  {   
163
+  {   
146
+    mailbox->magic = 0;
164
+   mailbox->magic = 0;
147
+    return;
165
+    return;
148
+  } 
166
+  } 
149
+      
167
+        
150
+  while ((de = readdir (dirp)) != NULL)
168
+  while ((de = readdir (dirp)) != NULL)
151
+  {
169
+  {
152
+    if (*de->d_name == '.')
170
+    if (*de->d_name == '.')
153
+      continue;
171
+      continue;
154
+
172
+ 
155
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
173
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
156
+      mailbox->msgcount++;
174
+      mailbox->msgcount++;
157
+      if ((p = strstr (de->d_name, ":2,"))) {
175
+      if ((p = strstr (de->d_name, ":2,"))) {
Lines 164-238 Link Here
164
+      }
182
+      }
165
+    }
183
+    }
166
+  }
184
+  }
167
+
185
+ 
168
+  mailbox->sb_last_checked = time(NULL);
186
+  mailbox->sb_last_checked = time(NULL);
169
+  closedir (dirp);
187
+  closedir (dirp);
170
+}
188
+ }
171
+
189
+ 
172
 /* returns 1 if mailbox has new mail */ 
190
  /* returns 1 if mailbox has new mail */ 
173
 static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
191
  static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
174
 {
192
  {
175
@@ -368,7 +488,7 @@
193
***************
176
   else
194
*** 368,374 ****
177
     statcheck = sb->st_mtime > sb->st_atime
195
    else
178
       || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
196
      statcheck = sb->st_mtime > sb->st_atime
179
-  if (statcheck)
197
        || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
180
+  if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
198
!   if (statcheck)
181
   {
199
    {
182
     if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
200
      if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
183
     {
201
      {
184
@@ -388,6 +508,27 @@
202
--- 488,494 ----
185
   return rc;
203
    else
186
 }
204
      statcheck = sb->st_mtime > sb->st_atime
187
 
205
        || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
188
+/* update message counts for the sidebar */
206
!   if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
189
+void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
207
    {
190
+{
208
      if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
191
+  CONTEXT *ctx = NULL;
209
      {
192
+
210
***************
193
+  if(!option(OPTSIDEBAR))
211
*** 388,393 ****
194
+      return;
212
--- 508,534 ----
195
+  if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
213
    return rc;
196
+      return; /* no check necessary */
214
  }
197
+
215
  
198
+  ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
216
+ /* update message counts for the sidebar */
199
+  if(ctx)
217
+ void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
200
+  {
218
+ {
201
+    mailbox->msgcount = ctx->msgcount;
219
+   CONTEXT *ctx = NULL;
202
+    mailbox->msg_unread = ctx->unread;
220
+ 
203
+    mailbox->msg_flagged = ctx->flagged;
221
+   if(!option(OPTSIDEBAR))
204
+    mailbox->sb_last_checked = time(NULL);
222
+       return;
205
+    mx_close_mailbox(ctx, 0);
223
+   if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
206
+  }
224
+       return; /* no check necessary */
207
+}
225
+ 
208
+
226
+   ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
209
 int mutt_buffy_check (int force)
227
+   if(ctx)
210
 {
228
+   {
211
   BUFFY *tmp;
229
+     mailbox->msgcount = ctx->msgcount;
212
@@ -461,17 +602,20 @@
230
+     mailbox->msg_unread = ctx->unread;
213
       {
231
+     mailbox->msg_flagged = ctx->flagged;
214
       case M_MBOX:
232
+     mailbox->sb_last_checked = time(NULL);
215
       case M_MMDF:
233
+     mx_close_mailbox(ctx, 0);
216
+	buffy_mbox_update (tmp, &sb);
234
+   }
217
 	if (buffy_mbox_hasnew (tmp, &sb) > 0)
235
+ }
218
 	  BuffyCount++;
236
+ 
219
 	break;
237
  int mutt_buffy_check (int force)
220
 
238
  {
221
       case M_MAILDIR:
239
    BUFFY *tmp;
222
+	buffy_maildir_update (tmp);
240
***************
223
 	if (buffy_maildir_hasnew (tmp) > 0)
241
*** 461,477 ****
224
 	  BuffyCount++;
242
        {
225
 	break;
243
        case M_MBOX:
226
 
244
        case M_MMDF:
227
       case M_MH:
245
  	if (buffy_mbox_hasnew (tmp, &sb) > 0)
228
-	mh_buffy(tmp);
246
  	  BuffyCount++;
229
+	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
247
  	break;
230
+        mh_buffy(tmp);
248
  
231
 	if (tmp->new)
249
        case M_MAILDIR:
232
 	  BuffyCount++;
250
  	if (buffy_maildir_hasnew (tmp) > 0)
233
 	break;
251
  	  BuffyCount++;
234
*** mutt-1.5.23-orig/buffy.h	2014-03-12 11:03:44.000000000 -0500
252
  	break;
235
--- mutt-1.5.23/buffy.h	2014-04-11 10:14:01.000000000 -0500
253
  
254
        case M_MH:
255
! 	mh_buffy(tmp);
256
  	if (tmp->new)
257
  	  BuffyCount++;
258
  	break;
259
--- 602,621 ----
260
        {
261
        case M_MBOX:
262
        case M_MMDF:
263
+ 	buffy_mbox_update (tmp, &sb);
264
  	if (buffy_mbox_hasnew (tmp, &sb) > 0)
265
  	  BuffyCount++;
266
  	break;
267
  
268
        case M_MAILDIR:
269
+ 	buffy_maildir_update (tmp);
270
  	if (buffy_maildir_hasnew (tmp) > 0)
271
  	  BuffyCount++;
272
  	break;
273
  
274
        case M_MH:
275
! 	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
276
!         mh_buffy(tmp);
277
  	if (tmp->new)
278
  	  BuffyCount++;
279
  	break;
280
*** mutt-1.5.24-orig/buffy.h	2015-08-30 12:06:38.000000000 -0500
281
--- mutt-1.5.24/buffy.h	2015-09-16 23:18:13.000000000 -0500
236
***************
282
***************
237
*** 23,35 ****
283
*** 23,35 ****
238
--- 23,41 ----
284
--- 23,41 ----
Lines 255-273 Link Here
255
  }
301
  }
256
  BUFFY;
302
  BUFFY;
257
  
303
  
258
*** mutt-1.5.23-orig/color.c.orig	2015-08-30 19:06:38.000000000 +0200
304
*** mutt-1.5.24-orig/color.c	2015-08-30 12:06:38.000000000 -0500
259
--- mutt-1.5.23/color.c	2015-09-10 09:34:06.000000000 +0200
305
--- mutt-1.5.24/color.c	2015-09-16 23:18:13.000000000 -0500
260
@@ -94,6 +94,8 @@
306
***************
261
   { "underline",	MT_COLOR_UNDERLINE },
307
*** 94,99 ****
262
   { "index",		MT_COLOR_INDEX },
308
--- 94,101 ----
263
   { "prompt",		MT_COLOR_PROMPT },
309
    { "underline",	MT_COLOR_UNDERLINE },
264
+  { "sidebar_new",	MT_COLOR_NEW },
310
    { "index",		MT_COLOR_INDEX },
265
+  { "sidebar_flagged",	MT_COLOR_FLAGGED },
311
    { "prompt",		MT_COLOR_PROMPT },
266
   { NULL,		0 }
312
+   { "sidebar_new",	MT_COLOR_NEW },
267
 };
313
+   { "sidebar_flagged",	MT_COLOR_FLAGGED },
268
 
314
    { NULL,		0 }
269
*** mutt-1.5.23-orig/compose.c.orig	2015-09-10 19:24:26.000000000 +0200
315
  };
270
--- mutt-1.5.23/compose.c	2015-09-10 20:49:12.000000000 +0200
316
  
317
*** mutt-1.5.24-orig/compose.c	2015-12-19 15:06:15.327937000 +0100
318
--- mutt-1.5.24/compose.c	2015-12-19 15:22:19.475843000 +0100
271
@@ -83,7 +83,7 @@
319
@@ -83,7 +83,7 @@
272
 
320
 
273
 #define HDR_XOFFSET 14
321
 #define HDR_XOFFSET 14
Lines 394-404 Link Here
394
 	  mutt_paddstr (W, fcc);
442
 	  mutt_paddstr (W, fcc);
395
 	  fccSet = 1;
443
 	  fccSet = 1;
396
 	}
444
 	}
397
*** mutt-1.5.23-orig/configure.ac	2014-03-12 11:26:40.000000000 -0500
445
*** mutt-1.5.24-orig/configure.ac	2015-08-30 12:24:20.000000000 -0500
398
--- mutt-1.5.23/configure.ac	2014-04-11 10:14:01.000000000 -0500
446
--- mutt-1.5.24/configure.ac	2015-09-16 23:18:13.000000000 -0500
399
***************
447
***************
400
*** 1276,1281 ****
448
*** 1302,1307 ****
401
--- 1276,1283 ----
449
--- 1302,1309 ----
402
    AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
450
    AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
403
  fi
451
  fi
404
  
452
  
Lines 407-414 Link Here
407
  dnl Documentation tools
455
  dnl Documentation tools
408
  have_openjade="no"
456
  have_openjade="no"
409
  AC_PATH_PROG([OSPCAT], [ospcat], [none])
457
  AC_PATH_PROG([OSPCAT], [ospcat], [none])
410
*** mutt-1.5.23-orig/curs_main.c	2014-03-12 11:06:17.000000000 -0500
458
*** mutt-1.5.24-orig/curs_main.c	2015-08-30 12:06:38.000000000 -0500
411
--- mutt-1.5.23/curs_main.c	2014-04-12 21:45:21.000000000 -0500
459
--- mutt-1.5.24/curs_main.c	2015-09-16 23:18:13.000000000 -0500
412
***************
460
***************
413
*** 26,32 ****
461
*** 26,32 ****
414
--- 26,34 ----
462
--- 26,34 ----
Lines 422-428 Link Here
422
  #ifdef USE_POP
470
  #ifdef USE_POP
423
  #include "pop.h"
471
  #include "pop.h"
424
***************
472
***************
425
*** 519,538 ****
473
*** 596,615 ****
426
         menu->redraw |= REDRAW_STATUS;
474
         menu->redraw |= REDRAW_STATUS;
427
       if (do_buffy_notify)
475
       if (do_buffy_notify)
428
       {
476
       {
Lines 443-449 Link Here
443
      }
491
      }
444
  
492
  
445
      if (menu->menu == MENU_MAIN)
493
      if (menu->menu == MENU_MAIN)
446
--- 521,551 ----
494
--- 598,628 ----
447
         menu->redraw |= REDRAW_STATUS;
495
         menu->redraw |= REDRAW_STATUS;
448
       if (do_buffy_notify)
496
       if (do_buffy_notify)
449
       {
497
       {
Lines 476-483 Link Here
476
  
524
  
477
      if (menu->menu == MENU_MAIN)
525
      if (menu->menu == MENU_MAIN)
478
***************
526
***************
479
*** 554,562 ****
527
*** 631,639 ****
480
--- 567,578 ----
528
--- 644,655 ----
481
  
529
  
482
        if (menu->redraw & REDRAW_STATUS)
530
        if (menu->redraw & REDRAW_STATUS)
483
        {
531
        {
Lines 491-497 Link Here
491
  	NORMAL_COLOR;
539
  	NORMAL_COLOR;
492
  	menu->redraw &= ~REDRAW_STATUS;
540
  	menu->redraw &= ~REDRAW_STATUS;
493
***************
541
***************
494
*** 569,575 ****
542
*** 653,659 ****
495
  	menu->oldcurrent = -1;
543
  	menu->oldcurrent = -1;
496
  
544
  
497
        if (option (OPTARROWCURSOR))
545
        if (option (OPTARROWCURSOR))
Lines 499-505 Link Here
499
        else if (option (OPTBRAILLEFRIENDLY))
547
        else if (option (OPTBRAILLEFRIENDLY))
500
  	move (menu->current - menu->top + menu->offset, 0);
548
  	move (menu->current - menu->top + menu->offset, 0);
501
        else
549
        else
502
--- 585,591 ----
550
--- 669,675 ----
503
  	menu->oldcurrent = -1;
551
  	menu->oldcurrent = -1;
504
  
552
  
505
        if (option (OPTARROWCURSOR))
553
        if (option (OPTARROWCURSOR))
Lines 508-515 Link Here
508
  	move (menu->current - menu->top + menu->offset, 0);
556
  	move (menu->current - menu->top + menu->offset, 0);
509
        else
557
        else
510
***************
558
***************
511
*** 1011,1016 ****
559
*** 1095,1100 ****
512
--- 1027,1033 ----
560
--- 1111,1117 ----
513
  	  break;
561
  	  break;
514
  
562
  
515
  	CHECK_MSGCOUNT;
563
  	CHECK_MSGCOUNT;
Lines 518-525 Link Here
518
  	{
566
  	{
519
  	  int oldvcount = Context->vcount;
567
  	  int oldvcount = Context->vcount;
520
***************
568
***************
521
*** 1070,1075 ****
569
*** 1154,1159 ****
522
--- 1087,1093 ----
570
--- 1171,1177 ----
523
  	  menu->redraw = REDRAW_FULL;
571
  	  menu->redraw = REDRAW_FULL;
524
  	break;
572
  	break;
525
  
573
  
Lines 528-534 Link Here
528
        case OP_MAIN_NEXT_UNREAD_MAILBOX:
576
        case OP_MAIN_NEXT_UNREAD_MAILBOX:
529
  
577
  
530
***************
578
***************
531
*** 1101,1107 ****
579
*** 1185,1191 ****
532
  	{
580
  	{
533
  	  mutt_buffy (buf, sizeof (buf));
581
  	  mutt_buffy (buf, sizeof (buf));
534
  
582
  
Lines 536-542 Link Here
536
  	  {
584
  	  {
537
  	    if (menu->menu == MENU_PAGER)
585
  	    if (menu->menu == MENU_PAGER)
538
  	    {
586
  	    {
539
--- 1119,1129 ----
587
--- 1203,1213 ----
540
  	{
588
  	{
541
  	  mutt_buffy (buf, sizeof (buf));
589
  	  mutt_buffy (buf, sizeof (buf));
542
  
590
  
Lines 549-556 Link Here
549
  	    if (menu->menu == MENU_PAGER)
597
  	    if (menu->menu == MENU_PAGER)
550
  	    {
598
  	    {
551
***************
599
***************
552
*** 1119,1124 ****
600
*** 1203,1208 ****
553
--- 1141,1147 ----
601
--- 1225,1231 ----
554
  	}
602
  	}
555
  
603
  
556
  	mutt_expand_path (buf, sizeof (buf));
604
  	mutt_expand_path (buf, sizeof (buf));
Lines 559-566 Link Here
559
  	{
607
  	{
560
  	  mutt_error (_("%s is not a mailbox."), buf);
608
  	  mutt_error (_("%s is not a mailbox."), buf);
561
***************
609
***************
562
*** 2209,2214 ****
610
*** 2293,2298 ****
563
--- 2232,2243 ----
611
--- 2316,2327 ----
564
  	mutt_what_key();
612
  	mutt_what_key();
565
  	break;
613
  	break;
566
  
614
  
Lines 573-580 Link Here
573
        default:
621
        default:
574
  	if (menu->menu == MENU_MAIN)
622
  	if (menu->menu == MENU_MAIN)
575
  	  km_error_key (MENU_MAIN);
623
  	  km_error_key (MENU_MAIN);
576
*** mutt-1.5.23-orig/flags.c	2014-03-12 11:03:45.000000000 -0500
624
*** mutt-1.5.24-orig/flags.c	2015-08-30 12:06:38.000000000 -0500
577
--- mutt-1.5.23/flags.c	2014-04-11 10:14:01.000000000 -0500
625
--- mutt-1.5.24/flags.c	2015-09-16 23:18:13.000000000 -0500
578
***************
626
***************
579
*** 22,29 ****
627
*** 22,29 ****
580
--- 22,31 ----
628
--- 22,31 ----
Lines 598-605 Link Here
598
  }
646
  }
599
  
647
  
600
  void mutt_tag_set_flag (int flag, int bf)
648
  void mutt_tag_set_flag (int flag, int bf)
601
*** mutt-1.5.23-orig/functions.h	2014-03-12 11:03:45.000000000 -0500
649
*** mutt-1.5.24-orig/functions.h	2015-08-30 12:06:38.000000000 -0500
602
--- mutt-1.5.23/functions.h	2014-04-11 10:14:01.000000000 -0500
650
--- mutt-1.5.24/functions.h	2015-09-16 23:18:13.000000000 -0500
603
***************
651
***************
604
*** 169,174 ****
652
*** 169,174 ****
605
--- 169,179 ----
653
--- 169,179 ----
Lines 628-638 Link Here
628
    { NULL,		0,				NULL }
676
    { NULL,		0,				NULL }
629
  };
677
  };
630
  
678
  
631
*** mutt-1.5.23-orig/globals.h	2014-03-12 11:06:17.000000000 -0500
679
*** mutt-1.5.24-orig/globals.h	2015-08-30 12:06:38.000000000 -0500
632
--- mutt-1.5.23/globals.h	2014-04-11 10:14:01.000000000 -0500
680
--- mutt-1.5.24/globals.h	2015-09-16 23:18:13.000000000 -0500
633
***************
681
***************
634
*** 117,122 ****
682
*** 118,123 ****
635
--- 117,125 ----
683
--- 118,126 ----
636
  WHERE char *SendCharset;
684
  WHERE char *SendCharset;
637
  WHERE char *Sendmail;
685
  WHERE char *Sendmail;
638
  WHERE char *Shell;
686
  WHERE char *Shell;
Lines 643-650 Link Here
643
  WHERE char *SimpleSearch;
691
  WHERE char *SimpleSearch;
644
  #if USE_SMTP
692
  #if USE_SMTP
645
***************
693
***************
646
*** 208,213 ****
694
*** 213,218 ****
647
--- 211,219 ----
695
--- 216,224 ----
648
  WHERE short ScoreThresholdRead;
696
  WHERE short ScoreThresholdRead;
649
  WHERE short ScoreThresholdFlag;
697
  WHERE short ScoreThresholdFlag;
650
  
698
  
Lines 654-744 Link Here
654
  #ifdef USE_IMAP
702
  #ifdef USE_IMAP
655
  WHERE short ImapKeepalive;
703
  WHERE short ImapKeepalive;
656
  WHERE short ImapPipelineDepth;
704
  WHERE short ImapPipelineDepth;
657
*** mutt-1.5.23-orig/handler.c.orig	2015-09-10 09:34:53.000000000 +0200
705
*** mutt-1.5.24-orig/handler.c	2015-08-30 12:06:38.000000000 -0500
658
--- mutt-1.5.23/handler.c	2015-09-10 09:58:03.000000000 +0200
706
--- mutt-1.5.24/handler.c	2015-09-16 23:18:13.000000000 -0500
659
@@ -1625,6 +1625,11 @@
707
***************
660
   int decode = 0;
708
*** 1603,1608 ****
661
   int rc = 0;
709
--- 1603,1613 ----
662
 
710
  
663
+#ifdef HAVE_FMEMOPEN
711
    fseeko (s->fpin, b->offset, 0);
664
+  char *temp;
712
  
665
+  size_t tempsize;
713
+ #ifdef HAVE_FMEMOPEN
666
+#endif
714
+   char *temp;
667
+
715
+   size_t tempsize;
668
   fseeko (s->fpin, b->offset, 0);
716
+ #endif
669
 
717
+ 
670
   /* see if we need to decode this part before processing it */
718
    /* see if we need to decode this part before processing it */
671
@@ -1642,6 +1647,14 @@
719
    if (b->encoding == ENCBASE64 || b->encoding == ENCQUOTEDPRINTABLE ||
672
     {
720
        b->encoding == ENCUUENCODED || plaintext ||
673
       /* decode to a tempfile, saving the original destination */
674
       fp = s->fpout;
675
+#ifdef HAVE_FMEMOPEN
676
+	if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
677
+	{
678
+	  mutt_error _("Unable to open memory stream!");
679
+	  dprint (1, (debugfile, "Can't open memory stream.\n"));
680
+	  goto bail;
681
+	}
682
+#else
683
       mutt_mktemp (tempfile, sizeof (tempfile));
684
       if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
685
       {
686
@@ -1649,6 +1662,7 @@
687
         dprint (1, (debugfile, "Can't open %s.\n", tempfile));
688
         return -1;
689
       }
690
+#endif
691
       /* decoding the attachment changes the size and offset, so save a copy
692
         * of the "real" values now, and restore them after processing
693
         */
694
@@ -1677,8 +1691,19 @@
695
       /* restore final destination and substitute the tempfile for input */
696
       s->fpout = fp;
697
       fp = s->fpin;
698
+#ifdef HAVE_FMEMOPEN
699
+	if(tempsize)
700
+		s->fpin = fmemopen(temp, tempsize, "r");
701
+	else /* fmemopen cannot handle zero-length buffers */
702
+		s->fpin = safe_fopen ("/dev/null", "r");
703
+	if(s->fpin == NULL) {
704
+		mutt_perror("failed to re-open memstream!");
705
+		return (-1);
706
+	}
707
+#else
708
       s->fpin = fopen (tempfile, "r");
709
       unlink (tempfile);
710
+#endif
711
 
712
       /* restore the prefix */
713
       s->prefix = savePrefix;
714
@@ -1704,9 +1729,14 @@
715
 
716
       /* restore the original source stream */
717
       safe_fclose (&s->fpin);
718
+#ifdef HAVE_FMEMOPEN
719
+	if(tempsize)
720
+	    FREE(&temp);
721
+#endif
722
       s->fpin = fp;
723
     }
724
   }
725
+  bail:
726
   s->flags |= M_FIRSTDONE;
727
 
728
   return rc;
729
@@ -1743,6 +1773,7 @@
730
   handler_t handler = NULL;
731
   int rc = 0;
732
 
733
+
734
   int oflags = s->flags;
735
   
736
   /* first determine which handler to use to process this part */
737
*** mutt-1.5.23-orig/init.h	2014-03-12 11:06:17.000000000 -0500
738
--- mutt-1.5.23/init.h	2014-04-11 10:14:01.000000000 -0500
739
***************
721
***************
740
*** 1966,1971 ****
722
*** 1618,1623 ****
741
--- 1966,2019 ----
723
--- 1623,1636 ----
724
      {
725
        /* decode to a tempfile, saving the original destination */
726
        fp = s->fpout;
727
+ #ifdef HAVE_FMEMOPEN
728
+      if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
729
+      {
730
+        mutt_error _("Unable to open memory stream!");
731
+        dprint (1, (debugfile, "Can't open memory stream.\n"));
732
+        return -1;
733
+      }
734
+ #else
735
        mutt_mktemp (tempfile, sizeof (tempfile));
736
        if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
737
        {
738
***************
739
*** 1625,1630 ****
740
--- 1638,1644 ----
741
          dprint (1, (debugfile, "Can't open %s.\n", tempfile));
742
          return -1;
743
        }
744
+ #endif
745
        /* decoding the attachment changes the size and offset, so save a copy
746
          * of the "real" values now, and restore them after processing
747
          */
748
***************
749
*** 1653,1661 ****
750
        /* restore final destination and substitute the tempfile for input */
751
        s->fpout = fp;
752
        fp = s->fpin;
753
        s->fpin = fopen (tempfile, "r");
754
        unlink (tempfile);
755
! 
756
        /* restore the prefix */
757
        s->prefix = savePrefix;
758
      }
759
--- 1667,1685 ----
760
        /* restore final destination and substitute the tempfile for input */
761
        s->fpout = fp;
762
        fp = s->fpin;
763
+ #ifdef HAVE_FMEMOPEN
764
+       if(tempsize)
765
+         s->fpin = fmemopen(temp, tempsize, "r");
766
+       else /* fmemopen cannot handle zero-length buffers */
767
+         s->fpin = safe_fopen ("/dev/null", "r");
768
+       if(s->fpin == NULL) {
769
+        mutt_perror("failed to re-open memstream!");
770
+        return (-1);
771
+       }
772
+ #else
773
        s->fpin = fopen (tempfile, "r");
774
        unlink (tempfile);
775
! #endif
776
        /* restore the prefix */
777
        s->prefix = savePrefix;
778
      }
779
***************
780
*** 1680,1685 ****
781
--- 1704,1713 ----
782
  
783
        /* restore the original source stream */
784
        safe_fclose (&s->fpin);
785
+ #ifdef HAVE_FMEMOPEN
786
+       if(tempsize)
787
+           FREE(&temp);
788
+ #endif
789
        s->fpin = fp;
790
      }
791
    }
792
*** mutt-1.5.24-orig/init.h	2015-08-30 12:06:38.000000000 -0500
793
--- mutt-1.5.24/init.h	2015-09-16 23:18:13.000000000 -0500
794
***************
795
*** 2016,2021 ****
796
--- 2016,2069 ----
742
    ** not used.
797
    ** not used.
743
    ** (PGP only)
798
    ** (PGP only)
744
    */
799
    */
Lines 769-775 Link Here
769
+   ** .pp
824
+   ** .pp
770
+   ** The width of the sidebar.
825
+   ** The width of the sidebar.
771
+   */
826
+   */
772
+   { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 1 },
827
+   { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
773
+   /*
828
+   /*
774
+   ** .pp
829
+   ** .pp
775
+   ** Should the sidebar shorten the path showed.
830
+   ** Should the sidebar shorten the path showed.
Lines 793-800 Link Here
793
    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
848
    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
794
    /*
849
    /*
795
    ** .pp
850
    ** .pp
796
*** mutt-1.5.23-orig/mailbox.h	2014-03-12 11:03:45.000000000 -0500
851
*** mutt-1.5.24-orig/mailbox.h	2015-08-30 12:06:38.000000000 -0500
797
--- mutt-1.5.23/mailbox.h	2014-04-11 10:14:01.000000000 -0500
852
--- mutt-1.5.24/mailbox.h	2015-09-16 23:18:13.000000000 -0500
798
***************
853
***************
799
*** 27,32 ****
854
*** 27,32 ****
800
--- 27,33 ----
855
--- 27,33 ----
Lines 804-812 Link Here
804
+ #define M_PEEK		(1<<5) /* revert atime back after taking a look (if applicable) */
859
+ #define M_PEEK		(1<<5) /* revert atime back after taking a look (if applicable) */
805
  
860
  
806
  /* mx_open_new_message() */
861
  /* mx_open_new_message() */
807
  #define M_ADD_FROM	1	/* add a From_ line */
862
  #define M_ADD_FROM	(1<<0)	/* add a From_ line */
808
*** mutt-1.5.23-orig/main.c	2014-03-12 11:06:17.000000000 -0500
863
*** mutt-1.5.24-orig/main.c	2015-08-30 12:06:38.000000000 -0500
809
--- mutt-1.5.23/main.c	2014-04-11 10:14:01.000000000 -0500
864
--- mutt-1.5.24/main.c	2015-09-16 23:18:13.000000000 -0500
810
***************
865
***************
811
*** 50,55 ****
866
*** 50,55 ****
812
--- 50,56 ----
867
--- 50,56 ----
Lines 835-842 Link Here
835
    char *includeFile = NULL;
890
    char *includeFile = NULL;
836
    char *draftFile = NULL;
891
    char *draftFile = NULL;
837
***************
892
***************
838
*** 1025,1030 ****
893
*** 1036,1041 ****
839
--- 1026,1038 ----
894
--- 1037,1049 ----
840
        strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
895
        strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
841
      mutt_expand_path (folder, sizeof (folder));
896
      mutt_expand_path (folder, sizeof (folder));
842
  
897
  
Lines 851-858 Link Here
851
      mutt_str_replace (&LastFolder, folder);
906
      mutt_str_replace (&LastFolder, folder);
852
  
907
  
853
***************
908
***************
854
*** 1047,1052 ****
909
*** 1058,1063 ****
855
--- 1055,1061 ----
910
--- 1066,1072 ----
856
      if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
911
      if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
857
         || !explicit_folder)
912
         || !explicit_folder)
858
      {
913
      {
Lines 860-870 Link Here
860
        mutt_index_menu ();
915
        mutt_index_menu ();
861
        if (Context)
916
        if (Context)
862
  	FREE (&Context);
917
  	FREE (&Context);
863
*** mutt-1.5.23-orig/Makefile.am	2014-03-12 11:03:44.000000000 -0500
918
*** mutt-1.5.24-orig/Makefile.am	2015-08-30 12:06:38.000000000 -0500
864
--- mutt-1.5.23/Makefile.am	2014-04-11 10:14:01.000000000 -0500
919
--- mutt-1.5.24/Makefile.am	2015-09-16 23:18:13.000000000 -0500
865
***************
920
***************
866
*** 32,37 ****
921
*** 33,38 ****
867
--- 32,38 ----
922
--- 33,39 ----
868
  	rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
923
  	rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
869
  	score.c send.c sendlib.c signal.c sort.c \
924
  	score.c send.c sendlib.c signal.c sort.c \
870
  	status.c system.c thread.c charset.c history.c lib.c \
925
  	status.c system.c thread.c charset.c history.c lib.c \
Lines 872-934 Link Here
872
  	muttlib.c editmsg.c mbyte.c \
927
  	muttlib.c editmsg.c mbyte.c \
873
  	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
928
  	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
874
  
929
  
875
*** mutt-1.5.23-orig/Makefile.in	2014-03-12 11:26:44.000000000 -0500
930
*** mutt-1.5.24-orig/Makefile.in	2015-08-30 12:24:26.000000000 -0500
876
--- mutt-1.5.23/Makefile.in	2014-04-12 12:12:38.000000000 -0500
931
--- mutt-1.5.24/Makefile.in	2015-09-16 23:18:13.000000000 -0500
877
***************
932
***************
878
*** 129,135 ****
933
*** 83,92 ****
934
  	$(srcdir)/Makefile.am $(top_srcdir)/configure \
935
  	$(am__configure_deps) $(srcdir)/config.h.in \
936
  	$(top_srcdir)/intl/Makefile.in $(srcdir)/hcachever.sh.in \
937
! 	$(srcdir)/muttbug.sh.in strtok_r.c strcasecmp.c regex.c \
938
! 	snprintf.c wcscasecmp.c strcasestr.c setenv.c mkdtemp.c \
939
! 	strsep.c strdup.c depcomp ABOUT-NLS ChangeLog INSTALL NEWS \
940
! 	README TODO compile config.guess config.sub install-sh missing
941
  EXTRA_PROGRAMS = mutt_dotlock$(EXEEXT) pgpring$(EXEEXT) \
942
  	pgpewrap$(EXEEXT) mutt_md5$(EXEEXT)
943
  bin_PROGRAMS = mutt$(EXEEXT) $(DOTLOCK_TARGET) $(PGPAUX_TARGET)
944
--- 83,92 ----
945
  	$(srcdir)/Makefile.am $(top_srcdir)/configure \
946
  	$(am__configure_deps) $(srcdir)/config.h.in \
947
  	$(top_srcdir)/intl/Makefile.in $(srcdir)/hcachever.sh.in \
948
! 	$(srcdir)/muttbug.sh.in snprintf.c strtok_r.c regex.c strdup.c \
949
! 	strcasecmp.c setenv.c strcasestr.c wcscasecmp.c mkdtemp.c \
950
! 	strsep.c depcomp ABOUT-NLS ChangeLog INSTALL NEWS README TODO \
951
! 	compile config.guess config.sub install-sh missing
952
  EXTRA_PROGRAMS = mutt_dotlock$(EXEEXT) pgpring$(EXEEXT) \
953
  	pgpewrap$(EXEEXT) mutt_md5$(EXEEXT)
954
  bin_PROGRAMS = mutt$(EXEEXT) $(DOTLOCK_TARGET) $(PGPAUX_TARGET)
955
***************
956
*** 128,136 ****
957
  	score.$(OBJEXT) send.$(OBJEXT) sendlib.$(OBJEXT) \
958
  	signal.$(OBJEXT) sort.$(OBJEXT) status.$(OBJEXT) \
879
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
959
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
880
  	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
960
! 	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
881
  	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
961
! 	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
882
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
962
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
883
  am__objects_1 =
963
  am__objects_1 =
884
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
964
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
885
  	$(am__objects_1)
965
  	$(am__objects_1)
886
--- 129,136 ----
966
--- 128,137 ----
967
  	score.$(OBJEXT) send.$(OBJEXT) sendlib.$(OBJEXT) \
968
  	signal.$(OBJEXT) sort.$(OBJEXT) status.$(OBJEXT) \
887
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
969
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
888
  	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
970
! 	history.$(OBJEXT) lib.$(OBJEXT) sidebar.$(OBJEXT) \
889
  	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
971
! 	muttlib.$(OBJEXT) editmsg.$(OBJEXT) mbyte.$(OBJEXT) \
890
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) \
972
! 	url.$(OBJEXT) ascii.$(OBJEXT) crypt-mod.$(OBJEXT) \
891
! 	sidebar.$(OBJEXT)
973
! 	safe_asprintf.$(OBJEXT)
892
  am__objects_1 =
974
  am__objects_1 =
893
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
975
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
894
  	$(am__objects_1)
976
  	$(am__objects_1)
895
***************
977
***************
896
*** 468,474 ****
978
*** 474,479 ****
897
  	score.c send.c sendlib.c signal.c sort.c \
979
--- 475,481 ----
898
  	status.c system.c thread.c charset.c history.c lib.c \
980
  	rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
899
  	muttlib.c editmsg.c mbyte.c \
900
! 	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
901
  
902
  nodist_mutt_SOURCES = $(BUILT_SOURCES)
903
  mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
904
--- 469,476 ----
905
  	score.c send.c sendlib.c signal.c sort.c \
981
  	score.c send.c sendlib.c signal.c sort.c \
906
  	status.c system.c thread.c charset.c history.c lib.c \
982
  	status.c system.c thread.c charset.c history.c lib.c \
983
+ 	sidebar.c \
907
  	muttlib.c editmsg.c mbyte.c \
984
  	muttlib.c editmsg.c mbyte.c \
908
! 	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c \
985
  	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
909
! 	sidebar.c
910
  
986
  
911
  nodist_mutt_SOURCES = $(BUILT_SOURCES)
912
  mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
913
***************
987
***************
914
*** 500,506 ****
988
*** 804,809 ****
915
  	README.SSL smime.h group.h \
989
--- 806,812 ----
916
  	muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
990
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send.Po@am__quote@
917
  	ChangeLog mkchangelog.sh mutt_idna.h \
991
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendlib.Po@am__quote@
918
! 	snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \
992
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@
919
  	txt2c.c txt2c.sh version.sh check_sec.sh
993
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sidebar.Po@am__quote@
920
  
994
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Po@am__quote@
921
  EXTRA_SCRIPTS = smime_keys
995
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smime.Po@am__quote@
922
--- 502,508 ----
996
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp.Po@am__quote@
923
  	README.SSL smime.h group.h \
997
*** mutt-1.5.24-orig/mbox.c	2015-08-30 12:06:38.000000000 -0500
924
  	muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
998
--- mutt-1.5.24/mbox.c	2015-09-16 23:18:13.000000000 -0500
925
  	ChangeLog mkchangelog.sh mutt_idna.h \
926
! 	snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in \
927
  	txt2c.c txt2c.sh version.sh check_sec.sh
928
  
929
  EXTRA_SCRIPTS = smime_keys
930
*** mutt-1.5.23-orig/mbox.c	2014-03-12 11:03:45.000000000 -0500
931
--- mutt-1.5.23/mbox.c	2014-04-11 10:14:01.000000000 -0500
932
***************
999
***************
933
*** 100,105 ****
1000
*** 100,105 ****
934
--- 100,106 ----
1001
--- 100,106 ----
Lines 949-956 Link Here
949
  
1016
  
950
  #ifdef NFS_ATTRIBUTE_HACK
1017
  #ifdef NFS_ATTRIBUTE_HACK
951
    if (sb.st_mtime > sb.st_atime)
1018
    if (sb.st_mtime > sb.st_atime)
952
*** mutt-1.5.23-orig/menu.c	2014-03-12 11:03:45.000000000 -0500
1019
*** mutt-1.5.24-orig/menu.c	2015-08-30 12:06:38.000000000 -0500
953
--- mutt-1.5.23/menu.c	2014-04-12 21:31:16.000000000 -0500
1020
--- mutt-1.5.24/menu.c	2015-09-16 23:18:13.000000000 -0500
954
***************
1021
***************
955
*** 24,29 ****
1022
*** 24,29 ****
956
--- 24,30 ----
1023
--- 24,30 ----
Lines 1119-1126 Link Here
1119
      else if (option (OPTBRAILLEFRIENDLY))
1186
      else if (option (OPTBRAILLEFRIENDLY))
1120
        move (menu->current - menu->top + menu->offset, 0);
1187
        move (menu->current - menu->top + menu->offset, 0);
1121
      else
1188
      else
1122
*** mutt-1.5.23-orig/mh.c	2014-03-12 11:03:45.000000000 -0500
1189
*** mutt-1.5.24-orig/mh.c	2015-08-30 12:06:38.000000000 -0500
1123
--- mutt-1.5.23/mh.c	2014-04-11 11:04:59.000000000 -0500
1190
--- mutt-1.5.24/mh.c	2015-09-16 23:18:13.000000000 -0500
1124
***************
1191
***************
1125
*** 295,300 ****
1192
*** 295,300 ****
1126
--- 295,326 ----
1193
--- 295,326 ----
Lines 1156-1182 Link Here
1156
  static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
1223
  static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
1157
  {
1224
  {
1158
    int fd;
1225
    int fd;
1159
*** mutt-1.5.23-orig/mutt_curses.h.orig	2015-08-30 19:06:38.000000000 +0200
1226
*** mutt-1.5.24-orig/mutt_curses.h	2015-08-30 12:06:38.000000000 -0500
1160
--- mutt-1.5.23/mutt_curses.h	2015-09-10 09:42:34.000000000 +0200
1227
--- mutt-1.5.24/mutt_curses.h	2015-09-16 23:18:13.000000000 -0500
1161
@@ -64,6 +64,7 @@
1228
***************
1162
 #undef lines
1229
*** 64,69 ****
1163
 #endif /* lines */
1230
--- 64,70 ----
1164
 
1231
  #undef lines
1165
+#define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
1232
  #endif /* lines */
1166
 #define CLEARLINE(x) move(x,0), clrtoeol()
1233
  
1167
 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1234
+ #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
1168
 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1235
  #define CLEARLINE(x) move(x,0), clrtoeol()
1169
@@ -121,6 +122,8 @@
1236
  #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1170
   MT_COLOR_UNDERLINE,
1237
  #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1171
   MT_COLOR_INDEX,
1238
***************
1172
   MT_COLOR_PROMPT,
1239
*** 121,126 ****
1173
+  MT_COLOR_NEW,
1240
--- 122,129 ----
1174
+  MT_COLOR_FLAGGED,
1241
    MT_COLOR_UNDERLINE,
1175
   MT_COLOR_MAX
1242
    MT_COLOR_INDEX,
1176
 };
1243
    MT_COLOR_PROMPT,
1177
 
1244
+   MT_COLOR_NEW,
1178
*** mutt-1.5.23-orig/mutt_menu.h	2014-03-12 11:06:17.000000000 -0500
1245
+   MT_COLOR_FLAGGED,
1179
--- mutt-1.5.23/mutt_menu.h	2014-04-11 10:14:01.000000000 -0500
1246
    MT_COLOR_MAX
1247
  };
1248
  
1249
*** mutt-1.5.24-orig/mutt_menu.h	2015-08-30 12:06:38.000000000 -0500
1250
--- mutt-1.5.24/mutt_menu.h	2015-09-16 23:18:13.000000000 -0500
1180
***************
1251
***************
1181
*** 34,39 ****
1252
*** 34,39 ****
1182
--- 34,40 ----
1253
--- 34,40 ----
Lines 1187-1197 Link Here
1187
  
1258
  
1188
  #define M_MODEFMT "-- Mutt: %s"
1259
  #define M_MODEFMT "-- Mutt: %s"
1189
  
1260
  
1190
*** mutt-1.5.23-orig/mutt.h	2014-03-12 11:06:17.000000000 -0500
1261
*** mutt-1.5.24-orig/mutt.h	2015-08-30 12:06:38.000000000 -0500
1191
--- mutt-1.5.23/mutt.h	2014-04-11 10:14:01.000000000 -0500
1262
--- mutt-1.5.24/mutt.h	2015-09-16 23:18:13.000000000 -0500
1192
***************
1263
***************
1193
*** 421,426 ****
1264
*** 423,428 ****
1194
--- 421,430 ----
1265
--- 423,432 ----
1195
    OPTSAVEEMPTY,
1266
    OPTSAVEEMPTY,
1196
    OPTSAVENAME,
1267
    OPTSAVENAME,
1197
    OPTSCORE,
1268
    OPTSCORE,
Lines 1203-1210 Link Here
1203
    OPTSIGONTOP,
1274
    OPTSIGONTOP,
1204
    OPTSORTRE,
1275
    OPTSORTRE,
1205
***************
1276
***************
1206
*** 861,866 ****
1277
*** 866,871 ****
1207
--- 865,871 ----
1278
--- 870,876 ----
1208
  {
1279
  {
1209
    char *path;
1280
    char *path;
1210
    FILE *fp;
1281
    FILE *fp;
Lines 1213-1220 Link Here
1213
    off_t size;
1284
    off_t size;
1214
    off_t vsize;
1285
    off_t vsize;
1215
***************
1286
***************
1216
*** 895,900 ****
1287
*** 900,905 ****
1217
--- 900,906 ----
1288
--- 905,911 ----
1218
    unsigned int quiet : 1;	/* inhibit status messages? */
1289
    unsigned int quiet : 1;	/* inhibit status messages? */
1219
    unsigned int collapsed : 1;   /* are all threads collapsed? */
1290
    unsigned int collapsed : 1;   /* are all threads collapsed? */
1220
    unsigned int closing : 1;	/* mailbox is being closed */
1291
    unsigned int closing : 1;	/* mailbox is being closed */
Lines 1222-1232 Link Here
1222
  
1293
  
1223
    /* driver hooks */
1294
    /* driver hooks */
1224
    void *data;			/* driver specific data */
1295
    void *data;			/* driver specific data */
1225
*** mutt-1.5.23-orig/muttlib.c	2014-03-12 11:03:45.000000000 -0500
1296
*** mutt-1.5.24-orig/muttlib.c	2015-08-30 12:06:38.000000000 -0500
1226
--- mutt-1.5.23/muttlib.c	2014-04-11 10:14:01.000000000 -0500
1297
--- mutt-1.5.24/muttlib.c	2015-09-16 23:18:13.000000000 -0500
1227
***************
1298
***************
1228
*** 1281,1286 ****
1299
*** 1276,1281 ****
1229
--- 1281,1288 ----
1300
--- 1276,1283 ----
1230
  	  pl = pw = 1;
1301
  	  pl = pw = 1;
1231
  
1302
  
1232
  	/* see if there's room to add content, else ignore */
1303
  	/* see if there's room to add content, else ignore */
Lines 1236-1243 Link Here
1236
  	{
1307
  	{
1237
  	  int pad;
1308
  	  int pad;
1238
***************
1309
***************
1239
*** 1324,1329 ****
1310
*** 1319,1324 ****
1240
--- 1326,1377 ----
1311
--- 1321,1372 ----
1241
  	  col += wid;
1312
  	  col += wid;
1242
  	  src += pl;
1313
  	  src += pl;
1243
  	}
1314
  	}
Lines 1290-1297 Link Here
1290
  	break; /* skip rest of input */
1361
  	break; /* skip rest of input */
1291
        }
1362
        }
1292
        else if (ch == '|')
1363
        else if (ch == '|')
1293
*** mutt-1.5.23-orig/mx.c	2014-03-12 11:03:45.000000000 -0500
1364
*** mutt-1.5.24-orig/mx.c	2015-08-30 12:06:38.000000000 -0500
1294
--- mutt-1.5.23/mx.c	2014-04-11 10:14:01.000000000 -0500
1365
--- mutt-1.5.24/mx.c	2015-09-16 23:18:13.000000000 -0500
1295
***************
1366
***************
1296
*** 580,585 ****
1367
*** 580,585 ****
1297
--- 580,586 ----
1368
--- 580,586 ----
Lines 1379-1386 Link Here
1379
    }
1450
    }
1380
  
1451
  
1381
    if (read_msgs && quadoption (OPT_MOVE) != M_NO)
1452
    if (read_msgs && quadoption (OPT_MOVE) != M_NO)
1382
*** mutt-1.5.23-orig/mx.h	2014-03-12 11:03:45.000000000 -0500
1453
*** mutt-1.5.24-orig/mx.h	2015-08-30 12:06:38.000000000 -0500
1383
--- mutt-1.5.23/mx.h	2014-04-11 11:11:47.000000000 -0500
1454
--- mutt-1.5.24/mx.h	2015-09-16 23:18:13.000000000 -0500
1384
***************
1455
***************
1385
*** 57,62 ****
1456
*** 57,62 ****
1386
--- 57,63 ----
1457
--- 57,63 ----
Lines 1391-1398 Link Here
1391
  int mh_check_empty (const char *);
1462
  int mh_check_empty (const char *);
1392
  
1463
  
1393
  int maildir_read_dir (CONTEXT *);
1464
  int maildir_read_dir (CONTEXT *);
1394
*** mutt-1.5.23-orig/OPS	2014-03-12 11:03:44.000000000 -0500
1465
*** mutt-1.5.24-orig/OPS	2015-08-30 12:06:38.000000000 -0500
1395
--- mutt-1.5.23/OPS	2014-04-11 10:14:01.000000000 -0500
1466
--- mutt-1.5.24/OPS	2015-09-16 23:18:13.000000000 -0500
1396
***************
1467
***************
1397
*** 179,181 ****
1468
*** 179,181 ****
1398
--- 179,186 ----
1469
--- 179,186 ----
Lines 1404-1411 Link Here
1404
+ OP_SIDEBAR_NEXT "go down to next mailbox"
1475
+ OP_SIDEBAR_NEXT "go down to next mailbox"
1405
+ OP_SIDEBAR_PREV "go to previous mailbox"
1476
+ OP_SIDEBAR_PREV "go to previous mailbox"
1406
+ OP_SIDEBAR_OPEN "open hilighted mailbox"
1477
+ OP_SIDEBAR_OPEN "open hilighted mailbox"
1407
*** mutt-1.5.23-orig/pager.c	2014-03-12 11:06:17.000000000 -0500
1478
*** mutt-1.5.24-orig/pager.c	2015-08-30 12:06:38.000000000 -0500
1408
--- mutt-1.5.23/pager.c	2014-04-12 21:53:15.000000000 -0500
1479
--- mutt-1.5.24/pager.c	2015-09-16 23:18:13.000000000 -0500
1409
***************
1480
***************
1410
*** 29,34 ****
1481
*** 29,34 ****
1411
--- 29,35 ----
1482
--- 29,35 ----
Lines 1502-1509 Link Here
1502
! 	mutt_paddstr (COLS, bn);
1573
! 	mutt_paddstr (COLS, bn);
1503
        }
1574
        }
1504
        NORMAL_COLOR;
1575
        NORMAL_COLOR;
1505
      }
1576
        if (option(OPTTSENABLED) && TSSupported)
1506
  
1577
        {
1507
--- 1793,1831 ----
1578
--- 1793,1831 ----
1508
        hfi.ctx = Context;
1579
        hfi.ctx = Context;
1509
        hfi.pager_progress = pager_progress_str;
1580
        hfi.pager_progress = pager_progress_str;
Lines 1542-1551 Link Here
1542
+       if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
1613
+       if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
1543
+           DrawFullLine = 0; /* reset */
1614
+           DrawFullLine = 0; /* reset */
1544
        NORMAL_COLOR;
1615
        NORMAL_COLOR;
1545
      }
1616
        if (option(OPTTSENABLED) && TSSupported)
1546
  
1617
        {
1547
***************
1618
***************
1548
*** 1819,1834 ****
1619
*** 1826,1841 ****
1549
        /* redraw the pager_index indicator, because the
1620
        /* redraw the pager_index indicator, because the
1550
         * flags for this message might have changed. */
1621
         * flags for this message might have changed. */
1551
        menu_redraw_current (index);
1622
        menu_redraw_current (index);
Lines 1562-1568 Link Here
1562
      redraw = 0;
1633
      redraw = 0;
1563
  
1634
  
1564
      if (option(OPTBRAILLEFRIENDLY)) {
1635
      if (option(OPTBRAILLEFRIENDLY)) {
1565
--- 1834,1855 ----
1636
--- 1841,1862 ----
1566
        /* redraw the pager_index indicator, because the
1637
        /* redraw the pager_index indicator, because the
1567
         * flags for this message might have changed. */
1638
         * flags for this message might have changed. */
1568
        menu_redraw_current (index);
1639
        menu_redraw_current (index);
Lines 1586-1593 Link Here
1586
  
1657
  
1587
      if (option(OPTBRAILLEFRIENDLY)) {
1658
      if (option(OPTBRAILLEFRIENDLY)) {
1588
***************
1659
***************
1589
*** 2763,2768 ****
1660
*** 2770,2775 ****
1590
--- 2784,2796 ----
1661
--- 2791,2803 ----
1591
  	mutt_what_key ();
1662
  	mutt_what_key ();
1592
  	break;
1663
  	break;
1593
  
1664
  
Lines 1601-1608 Link Here
1601
        default:
1672
        default:
1602
  	ch = -1;
1673
  	ch = -1;
1603
  	break;
1674
  	break;
1604
*** mutt-1.5.23-orig/pattern.c	2014-03-12 11:03:45.000000000 -0500
1675
*** mutt-1.5.24-orig/pattern.c	2015-08-30 12:06:38.000000000 -0500
1605
--- mutt-1.5.23/pattern.c	2014-04-11 10:14:01.000000000 -0500
1676
--- mutt-1.5.24/pattern.c	2015-09-16 23:18:13.000000000 -0500
1606
***************
1677
***************
1607
*** 154,159 ****
1678
*** 154,159 ****
1608
--- 154,163 ----
1679
--- 154,163 ----
Lines 1699-1712 Link Here
1699
      }
1770
      }
1700
    }
1771
    }
1701
  
1772
  
1702
*** mutt-1.5.23-orig/PATCHES	2014-03-12 11:03:44.000000000 -0500
1773
*** mutt-1.5.24-orig/PATCHES	2015-08-30 12:06:38.000000000 -0500
1703
--- mutt-1.5.23/PATCHES	2014-04-12 12:36:35.000000000 -0500
1774
--- mutt-1.5.24/PATCHES	2015-11-11 09:39:02.000000000 -0600
1704
***************
1775
***************
1705
*** 0 ****
1776
*** 0 ****
1706
--- 1 ----
1777
--- 1 ----
1707
+ patch-1.5.23.sidebar.20140412.txt
1778
+ patch-1.5.24.sidebar.20151111.txt
1708
*** mutt-1.5.23-orig/protos.h	2014-03-12 11:06:17.000000000 -0500
1779
*** mutt-1.5.24-orig/protos.h	2015-08-30 12:06:38.000000000 -0500
1709
--- mutt-1.5.23/protos.h	2014-04-11 10:14:01.000000000 -0500
1780
--- mutt-1.5.24/protos.h	2015-09-16 23:18:13.000000000 -0500
1710
***************
1781
***************
1711
*** 36,41 ****
1782
*** 36,41 ****
1712
--- 36,48 ----
1783
--- 36,48 ----
Lines 1723-2140 Link Here
1723
  void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
1794
  void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
1724
  
1795
  
1725
  int mutt_extract_token (BUFFER *, BUFFER *, int);
1796
  int mutt_extract_token (BUFFER *, BUFFER *, int);
1726
*** mutt-1.5.23-orig/sidebar.c	1969-12-31 18:00:00.000000000 -0600
1797
*** mutt-1.5.24-orig/sidebar.c	1969-12-31 18:00:00.000000000 -0600
1727
--- mutt-1.5.23/sidebar.c	2014-04-11 10:14:01.000000000 -0500
1798
--- /dev/null	2015-12-15 19:07:50.000000000 +0100
1728
***************
1799
+++ tmp/sidebar.c	2015-12-15 19:06:57.000000000 +0100
1729
*** 0 ****
1800
@@ -0,0 +1,419 @@
1730
--- 1,405 ----
1801
+/*
1731
+ /*
1802
+ * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1732
+  * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1803
+ * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1733
+  * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1804
+ * 
1734
+  * 
1805
+ *     This program is free software; you can redistribute it and/or modify
1735
+  *     This program is free software; you can redistribute it and/or modify
1806
+ *     it under the terms of the GNU General Public License as published by
1736
+  *     it under the terms of the GNU General Public License as published by
1807
+ *     the Free Software Foundation; either version 2 of the License, or
1737
+  *     the Free Software Foundation; either version 2 of the License, or
1808
+ *     (at your option) any later version.
1738
+  *     (at your option) any later version.
1809
+ * 
1739
+  * 
1810
+ *     This program is distributed in the hope that it will be useful,
1740
+  *     This program is distributed in the hope that it will be useful,
1811
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1741
+  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1812
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1742
+  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1813
+ *     GNU General Public License for more details.
1743
+  *     GNU General Public License for more details.
1814
+ * 
1744
+  * 
1815
+ *     You should have received a copy of the GNU General Public License
1745
+  *     You should have received a copy of the GNU General Public License
1816
+ *     along with this program; if not, write to the Free Software
1746
+  *     along with this program; if not, write to the Free Software
1817
+ *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1747
+  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1818
+ */ 
1748
+  */ 
1819
+
1749
+ 
1820
+
1750
+ 
1821
+#if HAVE_CONFIG_H
1751
+ #if HAVE_CONFIG_H
1822
+# include "config.h"
1752
+ # include "config.h"
1823
+#endif
1753
+ #endif
1824
+
1754
+ 
1825
+#include "mutt.h"
1755
+ #include "mutt.h"
1826
+#include "mutt_menu.h"
1756
+ #include "mutt_menu.h"
1827
+#include "mutt_curses.h"
1757
+ #include "mutt_curses.h"
1828
+#include "sidebar.h"
1758
+ #include "sidebar.h"
1829
+#include "buffy.h"
1759
+ #include "buffy.h"
1830
+#include <libgen.h>
1760
+ #include <libgen.h>
1831
+#include "keymap.h"
1761
+ #include "keymap.h"
1832
+#include <stdbool.h>
1762
+ #include <stdbool.h>
1833
+
1763
+ 
1834
+/*BUFFY *CurBuffy = 0;*/
1764
+ /*BUFFY *CurBuffy = 0;*/
1835
+static BUFFY *TopBuffy = 0;
1765
+ static BUFFY *TopBuffy = 0;
1836
+static BUFFY *BottomBuffy = 0;
1766
+ static BUFFY *BottomBuffy = 0;
1837
+static int known_lines = 0;
1767
+ static int known_lines = 0;
1838
+
1768
+ 
1839
+void calc_boundaries() {
1769
+ void calc_boundaries() {
1840
+
1770
+ 
1841
+    BUFFY *tmp = Incoming;
1771
+     BUFFY *tmp = Incoming;
1842
+
1772
+ 
1843
+	int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
1773
+ 	int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
1844
+
1774
+ 
1845
+	if ( known_lines != LINES ) {
1775
+ 	if ( known_lines != LINES ) {
1846
+		TopBuffy = BottomBuffy = 0;
1776
+ 		TopBuffy = BottomBuffy = 0;
1847
+		known_lines = LINES;
1777
+ 		known_lines = LINES;
1848
+	}
1778
+ 	}
1849
+	for ( ; tmp->next != 0; tmp = tmp->next )
1779
+ 	for ( ; tmp->next != 0; tmp = tmp->next )
1850
+		tmp->next->prev = tmp;
1780
+ 		tmp->next->prev = tmp;
1851
+
1781
+ 
1852
+	if ( TopBuffy == 0 && BottomBuffy == 0 )
1782
+ 	if ( TopBuffy == 0 && BottomBuffy == 0 )
1853
+		TopBuffy = Incoming;
1783
+ 		TopBuffy = Incoming;
1854
+	if ( BottomBuffy == 0 ) {
1784
+ 	if ( BottomBuffy == 0 ) {
1855
+		BottomBuffy = TopBuffy;
1785
+ 		BottomBuffy = TopBuffy;
1856
+		while ( --count && BottomBuffy->next )
1786
+ 		while ( --count && BottomBuffy->next )
1857
+			BottomBuffy = BottomBuffy->next;
1787
+ 			BottomBuffy = BottomBuffy->next;
1858
+	}
1788
+ 	}
1859
+	else if ( TopBuffy == CurBuffy->next ) {
1789
+ 	else if ( TopBuffy == CurBuffy->next ) {
1860
+		BottomBuffy = CurBuffy;
1790
+ 		BottomBuffy = CurBuffy;
1861
+		tmp = BottomBuffy;
1791
+ 		tmp = BottomBuffy;
1862
+		while ( --count && tmp->prev)
1792
+ 		while ( --count && tmp->prev)
1863
+			tmp = tmp->prev;
1793
+ 			tmp = tmp->prev;
1864
+		TopBuffy = tmp;
1794
+ 		TopBuffy = tmp;
1865
+	}
1795
+ 	}
1866
+	else if ( BottomBuffy == CurBuffy->prev ) {
1796
+ 	else if ( BottomBuffy == CurBuffy->prev ) {
1867
+		TopBuffy = CurBuffy;
1797
+ 		TopBuffy = CurBuffy;
1868
+		tmp = TopBuffy;
1798
+ 		tmp = TopBuffy;
1869
+		while ( --count && tmp->next )
1799
+ 		while ( --count && tmp->next )
1870
+			tmp = tmp->next;
1800
+ 			tmp = tmp->next;
1871
+		BottomBuffy = tmp;
1801
+ 		BottomBuffy = tmp;
1872
+	}
1802
+ 	}
1873
+}
1803
+ }
1874
+
1804
+ 
1875
+static const char *
1805
+ static const char *
1876
+sidebar_format_str (char *dest,
1806
+ sidebar_format_str (char *dest,
1877
+			size_t destlen,
1807
+ 			size_t destlen,
1878
+			size_t col,
1808
+ 			size_t col,
1879
+			char op,
1809
+ 			char op,
1880
+			const char *src,
1810
+ 			const char *src,
1881
+			const char *prefix,
1811
+ 			const char *prefix,
1882
+			const char *ifstring,
1812
+ 			const char *ifstring,
1883
+			const char *elsestring,
1813
+ 			const char *elsestring,
1884
+			unsigned long data,
1814
+ 			unsigned long data,
1885
+			format_flag flags)
1815
+ 			format_flag flags)
1886
+{
1816
+ {
1887
+/* casting from unsigned long - srsly?! */
1817
+ /* casting from unsigned long - srsly?! */
1888
+struct sidebar_entry *sbe = (struct sidebar_entry *) data;
1818
+ struct sidebar_entry *sbe = (struct sidebar_entry *) data;
1889
+unsigned int optional;
1819
+ unsigned int optional;
1890
+char fmt[SHORT_STRING], buf[SHORT_STRING];
1820
+ char fmt[SHORT_STRING], buf[SHORT_STRING];
1891
+
1821
+ 
1892
+optional = flags & M_FORMAT_OPTIONAL;
1822
+ optional = flags & M_FORMAT_OPTIONAL;
1893
+
1823
+ 
1894
+switch(op) {
1824
+ switch(op) {
1895
+	case 'F':
1825
+ 	case 'F':
1896
+		if(!optional) {
1826
+ 		if(!optional) {
1897
+			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1827
+ 			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1898
+			snprintf (dest, destlen, fmt, sbe->flagged);
1828
+ 			snprintf (dest, destlen, fmt, sbe->flagged);
1899
+		} else if(sbe->flagged == 0) {
1829
+ 		} else if(sbe->flagged == 0) {
1900
+			optional = 0;
1830
+ 			optional = 0;
1901
+		}
1831
+ 		}
1902
+		break;
1832
+ 		break;
1903
+
1833
+ 
1904
+	case '!':
1834
+ 	case '!':
1905
+		if(sbe->flagged == 0)
1835
+ 		if(sbe->flagged == 0)
1906
+			mutt_format_s(dest, destlen, prefix, "");
1836
+ 			mutt_format_s(dest, destlen, prefix, "");
1907
+		if(sbe->flagged == 1)
1837
+ 		if(sbe->flagged == 1)
1908
+			mutt_format_s(dest, destlen, prefix, "!");
1838
+ 			mutt_format_s(dest, destlen, prefix, "!");
1909
+		if(sbe->flagged == 2)
1839
+ 		if(sbe->flagged == 2)
1910
+			mutt_format_s(dest, destlen, prefix, "!!");
1840
+ 			mutt_format_s(dest, destlen, prefix, "!!");
1911
+		if(sbe->flagged > 2) {
1841
+ 		if(sbe->flagged > 2) {
1912
+			snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
1842
+ 			snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
1913
+			mutt_format_s(dest, destlen, prefix, buf);
1843
+ 			mutt_format_s(dest, destlen, prefix, buf);
1914
+		}
1844
+ 		}
1915
+		break;
1845
+ 		break;
1916
+
1846
+ 
1917
+	case 'S':
1847
+ 	case 'S':
1918
+                if(!optional) {
1848
+ 		snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1919
+		    snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1849
+ 		snprintf (dest, destlen, fmt, sbe->size);
1920
+		    snprintf (dest, destlen, fmt, sbe->size);
1850
+ 		break;
1921
+                } else if (sbe->size == 0) {
1851
+ 
1922
+                    optional = 0;
1852
+ 	case 'N':
1923
+                }
1853
+ 		if(!optional) {
1924
+		break;
1854
+ 			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1925
+
1855
+ 			snprintf (dest, destlen, fmt, sbe->new);
1926
+	case 'N':
1856
+ 		} else if(sbe->new == 0) {
1927
+		if(!optional) {
1857
+ 			optional = 0;
1928
+			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1858
+ 		}
1929
+			snprintf (dest, destlen, fmt, sbe->new);
1859
+ 		break;
1930
+		} else if(sbe->new == 0) {
1860
+ 
1931
+			optional = 0;
1861
+ 	case 'B':
1932
+		}
1862
+ 		mutt_format_s(dest, destlen, prefix, sbe->box);
1933
+		break;
1863
+ 		break;
1934
+
1864
+ 	}
1935
+	case 'B':
1865
+ 
1936
+		mutt_format_s(dest, destlen, prefix, sbe->box);
1866
+ 	if(optional)
1937
+		break;
1867
+ 		mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
1938
+	}
1868
+ 	else if (flags & M_FORMAT_OPTIONAL)
1939
+
1869
+ 		mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
1940
+	if(optional)
1870
+ 
1941
+		mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
1871
+ 	return (src);
1942
+	else if (flags & M_FORMAT_OPTIONAL)
1872
+ }
1943
+		mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
1873
+ 
1944
+
1874
+ char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
1945
+	return (src);
1875
+     static char *entry = 0;
1946
+}
1876
+     struct sidebar_entry sbe;
1947
+
1877
+     int SBvisual;
1948
+char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
1878
+ 
1949
+    static char *entry = 0;
1879
+     SBvisual = SidebarWidth - strlen(SidebarDelim);
1950
+    struct sidebar_entry sbe;
1880
+     if (SBvisual < 1)
1951
+    int SBvisual;
1881
+         return NULL;
1952
+
1882
+ 
1953
+    SBvisual = SidebarWidth - strlen(SidebarDelim);
1883
+     sbe.new = new;
1954
+    if (SBvisual < 1)
1884
+     sbe.flagged = flagged;
1955
+        return NULL;
1885
+     sbe.size = size;
1956
+
1886
+     strncpy(sbe.box, box, 31);
1957
+    sbe.new = new;
1887
+ 
1958
+    sbe.flagged = flagged;
1888
+     safe_realloc(&entry, SBvisual + 2);
1959
+    sbe.size = size;
1889
+     entry[SBvisual + 1] = '\0';
1960
+    strncpy(sbe.box, box, SHORT_STRING-1);
1890
+ 
1961
+
1891
+     mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
1962
+    safe_realloc(&entry, SBvisual + 2);
1892
+ 
1963
+    entry[SBvisual + 1] = '\0';
1893
+     return entry;
1964
+
1894
+ }
1965
+    mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
1895
+ 
1966
+
1896
+ void set_curbuffy(char buf[LONG_STRING])
1967
+    return entry;
1897
+ {
1968
+}
1898
+   BUFFY* tmp = CurBuffy = Incoming;
1969
+
1899
+ 
1970
+void set_curbuffy(char buf[LONG_STRING])
1900
+   if (!Incoming)
1971
+{
1901
+     return;
1972
+  BUFFY* tmp = CurBuffy = Incoming;
1902
+ 
1973
+
1903
+   while(1) {
1974
+  if (!Incoming)
1904
+     if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
1975
+    return;
1905
+       CurBuffy = tmp;
1976
+
1906
+       break;
1977
+  while(1) {
1907
+     }
1978
+    if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
1908
+ 
1979
+      CurBuffy = tmp;
1909
+     if(tmp->next)
1980
+      break;
1910
+       tmp = tmp->next;
1981
+    }
1911
+     else
1982
+
1912
+       break;
1983
+    if(tmp->next)
1913
+   }
1984
+      tmp = tmp->next;
1914
+ }
1985
+    else
1915
+ 
1986
+      break;
1916
+ int draw_sidebar(int menu) {
1987
+  }
1917
+ 
1988
+}
1918
+ 	BUFFY *tmp;
1989
+
1919
+ #ifndef USE_SLANG_CURSES
1990
+int draw_sidebar(int menu) {
1920
+         attr_t attrs;
1991
+
1921
+ #endif
1992
+	BUFFY *tmp;
1922
+         short delim_len = strlen(SidebarDelim);
1993
+#ifndef USE_SLANG_CURSES
1923
+         short color_pair;
1994
+        attr_t attrs;
1924
+ 
1995
+#endif
1925
+         static bool initialized = false;
1996
+        short delim_len = strlen(SidebarDelim);
1926
+         static int prev_show_value;
1997
+        short color_pair;
1927
+         static short saveSidebarWidth;
1998
+
1928
+         int lines = 0;
1999
+        static bool initialized = false;
1929
+         int SidebarHeight;
2000
+        static int prev_show_value;
1930
+         
2001
+        static short saveSidebarWidth;
1931
+         if(option(OPTSTATUSONTOP) || option(OPTHELP))
2002
+        int lines = 0;
1932
+                 lines++; /* either one will occupy the first line */
2003
+        int SidebarHeight;
1933
+ 
2004
+        
1934
+         /* initialize first time */
2005
+        if(option(OPTSTATUSONTOP) || option(OPTHELP))
1935
+         if(!initialized) {
2006
+                lines++; /* either one will occupy the first line */
1936
+                 prev_show_value = option(OPTSIDEBAR);
2007
+
1937
+                 saveSidebarWidth = SidebarWidth;
2008
+        /* initialize first time */
1938
+                 if(!option(OPTSIDEBAR)) SidebarWidth = 0;
2009
+        if(!initialized) {
1939
+                 initialized = true;
2010
+                prev_show_value = option(OPTSIDEBAR);
1940
+         }
2011
+                saveSidebarWidth = SidebarWidth;
1941
+ 
2012
+                if(!option(OPTSIDEBAR)) SidebarWidth = 0;
1942
+         /* save or restore the value SidebarWidth */
2013
+                initialized = true;
1943
+         if(prev_show_value != option(OPTSIDEBAR)) {
1944
+                 if(prev_show_value && !option(OPTSIDEBAR)) {
1945
+                         saveSidebarWidth = SidebarWidth;
1946
+                         SidebarWidth = 0;
1947
+                 } else if(!prev_show_value && option(OPTSIDEBAR)) {
1948
+                         mutt_buffy_check(1); /* we probably have bad or no numbers */
1949
+                         SidebarWidth = saveSidebarWidth;
1950
+                 }
1951
+                 prev_show_value = option(OPTSIDEBAR);
1952
+         }
1953
+ 
1954
+ 
1955
+ /*	if ( SidebarWidth == 0 ) return 0; */
1956
+        if (SidebarWidth > 0 && option (OPTSIDEBAR)
1957
+            && delim_len >= SidebarWidth) {
1958
+          unset_option (OPTSIDEBAR);
1959
+          /* saveSidebarWidth = SidebarWidth; */
1960
+          if (saveSidebarWidth > delim_len) {
1961
+            SidebarWidth = saveSidebarWidth;
1962
+            mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
1963
+            sleep (2);
1964
+          } else {
1965
+            SidebarWidth = 0;
1966
+            mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
1967
+            sleep (4); /* the advise to set a sane value should be seen long enough */
1968
+          }
1969
+          saveSidebarWidth = 0;
1970
+          return (0);
1971
+        }
2014
+        }
1972
+ 
2015
+
1973
+     if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
2016
+        /* save or restore the value SidebarWidth */
1974
+       if (SidebarWidth > 0) {
2017
+        if(prev_show_value != option(OPTSIDEBAR)) {
1975
+         saveSidebarWidth = SidebarWidth;
2018
+                if(prev_show_value && !option(OPTSIDEBAR)) {
1976
+         SidebarWidth = 0;
2019
+                        saveSidebarWidth = SidebarWidth;
2020
+                        SidebarWidth = 0;
2021
+                } else if(!prev_show_value && option(OPTSIDEBAR)) {
2022
+                        mutt_buffy_check(1); /* we probably have bad or no numbers */
2023
+                        SidebarWidth = saveSidebarWidth;
2024
+                }
2025
+                prev_show_value = option(OPTSIDEBAR);
2026
+        }
2027
+
2028
+
2029
+/*	if ( SidebarWidth == 0 ) return 0; */
2030
+       if (SidebarWidth > 0 && option (OPTSIDEBAR)
2031
+           && delim_len >= SidebarWidth) {
2032
+         unset_option (OPTSIDEBAR);
2033
+         /* saveSidebarWidth = SidebarWidth; */
2034
+         if (saveSidebarWidth > delim_len) {
2035
+           SidebarWidth = saveSidebarWidth;
2036
+           mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
2037
+           sleep (2);
2038
+         } else {
2039
+           SidebarWidth = 0;
2040
+           mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
2041
+           sleep (4); /* the advise to set a sane value should be seen long enough */
2042
+         }
2043
+         saveSidebarWidth = 0;
2044
+         return (0);
1977
+       }
2045
+       }
1978
+       unset_option(OPTSIDEBAR);
2046
+
1979
+       return 0;
2047
+    if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
1980
+     }
2048
+      if (SidebarWidth > 0) {
1981
+ 
2049
+        saveSidebarWidth = SidebarWidth;
1982
+         /* get attributes for divider */
2050
+        SidebarWidth = 0;
1983
+ 	SETCOLOR(MT_COLOR_STATUS);
2051
+      }
1984
+ #ifndef USE_SLANG_CURSES
2052
+      unset_option(OPTSIDEBAR);
1985
+         attr_get(&attrs, &color_pair, 0);
2053
+      return 0;
1986
+ #else
2054
+    }
1987
+         color_pair = attr_get();
2055
+
1988
+ #endif
2056
+        /* get attributes for divider */
1989
+ 	SETCOLOR(MT_COLOR_NORMAL);
2057
+	SETCOLOR(MT_COLOR_STATUS);
1990
+ 
2058
+#ifndef USE_SLANG_CURSES
1991
+ 	/* draw the divider */
2059
+        attr_get(&attrs, &color_pair, 0);
1992
+ 
2060
+#else
1993
+ 	SidebarHeight =  LINES - 1;
2061
+        color_pair = attr_get();
1994
+ 	if(option(OPTHELP) || !option(OPTSTATUSONTOP))
2062
+#endif
1995
+ 		SidebarHeight--;
2063
+	SETCOLOR(MT_COLOR_NORMAL);
1996
+ 
2064
+
1997
+ 	for ( ; lines < SidebarHeight; lines++ ) {
2065
+	/* draw the divider */
1998
+ 		move(lines, SidebarWidth - delim_len);
2066
+
1999
+ 		addstr(NONULL(SidebarDelim));
2067
+	SidebarHeight =  LINES - 1;
2000
+ #ifndef USE_SLANG_CURSES
2068
+	if(option(OPTHELP) || !option(OPTSTATUSONTOP))
2001
+                 mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
2069
+		SidebarHeight--;
2002
+ #endif
2070
+
2003
+ 	}
2071
+	for ( ; lines < SidebarHeight; lines++ ) {
2004
+ 
2072
+		move(lines, SidebarWidth - delim_len);
2005
+ 	if ( Incoming == 0 ) return 0;
2073
+		addstr(NONULL(SidebarDelim));
2006
+         lines = 0;
2074
+#ifndef USE_SLANG_CURSES
2007
+         if(option(OPTSTATUSONTOP) || option(OPTHELP))
2075
+                mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
2008
+                 lines++; /* either one will occupy the first line */
2076
+#endif
2009
+ 
2077
+	}
2010
+ 	if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
2078
+
2011
+ 		calc_boundaries(menu);
2079
+	if ( Incoming == 0 ) return 0;
2012
+ 	if ( CurBuffy == 0 ) CurBuffy = Incoming;
2080
+        lines = 0;
2013
+ 
2081
+        if(option(OPTSTATUSONTOP) || option(OPTHELP))
2014
+ 	tmp = TopBuffy;
2082
+                lines++; /* either one will occupy the first line */
2015
+ 
2083
+
2016
+ 	SETCOLOR(MT_COLOR_NORMAL);
2084
+	if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
2017
+ 
2085
+		calc_boundaries(menu);
2018
+ 	for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) {
2086
+	if ( CurBuffy == 0 ) CurBuffy = Incoming;
2019
+ 		if ( tmp == CurBuffy )
2087
+
2020
+ 			SETCOLOR(MT_COLOR_INDICATOR);
2088
+	tmp = TopBuffy;
2021
+ 		else if ( tmp->msg_unread > 0 )
2089
+
2022
+ 			SETCOLOR(MT_COLOR_NEW);
2090
+	SETCOLOR(MT_COLOR_NORMAL);
2023
+ 		else if ( tmp->msg_flagged > 0 )
2091
+
2024
+ 		        SETCOLOR(MT_COLOR_FLAGGED);
2092
+	for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) {
2025
+ 		else
2093
+		if ( tmp == CurBuffy )
2026
+ 			SETCOLOR(MT_COLOR_NORMAL);
2094
+			SETCOLOR(MT_COLOR_INDICATOR);
2027
+ 
2095
+		else if ( tmp->msg_unread > 0 )
2028
+ 		move( lines, 0 );
2096
+			SETCOLOR(MT_COLOR_NEW);
2029
+ 		if ( Context && (!strcmp(tmp->path, Context->path)||
2097
+		else if ( tmp->msg_flagged > 0 )
2030
+ 				 !strcmp(tmp->realpath, Context->path)) ) {
2098
+		        SETCOLOR(MT_COLOR_FLAGGED);
2031
+ 			tmp->msg_unread = Context->unread;
2099
+		else
2032
+ 			tmp->msgcount = Context->msgcount;
2100
+			SETCOLOR(MT_COLOR_NORMAL);
2033
+ 			tmp->msg_flagged = Context->flagged;
2101
+
2034
+ 		}
2102
+		move( lines, 0 );
2035
+ 		/* check whether Maildir is a prefix of the current folder's path */
2103
+		if ( Context && Context->path &&
2036
+ 		short maildir_is_prefix = 0;
2104
+                        (!strcmp(tmp->path, Context->path)||
2037
+ 		if ( (strlen(tmp->path) > strlen(Maildir)) &&
2105
+			 !strcmp(tmp->realpath, Context->path)) ) {
2038
+ 			(strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
2106
+			tmp->msg_unread = Context->unread;
2039
+         		maildir_is_prefix = 1;
2107
+			tmp->msgcount = Context->msgcount;
2040
+ 		/* calculate depth of current folder and generate its display name with indented spaces */
2108
+			tmp->msg_flagged = Context->flagged;
2041
+ 		int sidebar_folder_depth = 0;
2109
+		}
2042
+ 		char *sidebar_folder_name;
2110
+		/* check whether Maildir is a prefix of the current folder's path */
2043
+ 		sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + 1);
2111
+		short maildir_is_prefix = 0;
2044
+ 		if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
2112
+		if ( (strlen(tmp->path) > strlen(Maildir)) &&
2045
+ 			char *tmp_folder_name;
2113
+			(strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
2046
+ 			int i;
2114
+        		maildir_is_prefix = 1;
2047
+ 			tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2115
+		/* calculate depth of current folder and generate its display name with indented spaces */
2048
+ 			for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
2116
+		int sidebar_folder_depth = 0;
2049
+  				if (tmp_folder_name[i] == '/'  || tmp_folder_name[i] == '.') sidebar_folder_depth++;
2117
+		char *sidebar_folder_name;
2050
+ 			}   
2118
+		sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ?  mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ?  0 : 1));
2051
+ 			if (sidebar_folder_depth > 0) {
2119
+		/* sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + 1); */
2052
+  				if (option(OPTSIDEBARSHORTPATH)) {
2120
+		if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
2053
+  					tmp_folder_name = strrchr(tmp->path, '.');
2121
+			char *tmp_folder_name;
2054
+  					if (tmp_folder_name == NULL)
2122
+			char *tmp_folder_name_dot;
2123
+			char *tmp_folder_name_slash;
2124
+			int i;
2125
+			tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2126
+			for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
2127
+ 				if (tmp_folder_name[i] == '/'  || tmp_folder_name[i] == '.') sidebar_folder_depth++;
2128
+			}   
2129
+			if (sidebar_folder_depth > 0) {
2130
+ 				if (option(OPTSIDEBARSHORTPATH)) {
2131
+ 					tmp_folder_name_dot = strrchr(tmp->path, '.');
2132
+ 					tmp_folder_name_slash = strrchr(tmp->path, '/');
2133
+					if (tmp_folder_name_dot == NULL && tmp_folder_name_slash == NULL)
2055
+  						tmp_folder_name = mutt_basename(tmp->path);
2134
+  						tmp_folder_name = mutt_basename(tmp->path);
2056
+  					else
2135
+ 					tmp_folder_name = strrchr(tmp->path, '.');
2057
+ 						tmp_folder_name++;
2136
+ 					if (tmp_folder_name == NULL)
2058
+  				}
2137
+ 						tmp_folder_name = mutt_basename(tmp->path);
2059
+  				else
2138
+                                        else if (tmp_folder_name_dot > tmp_folder_name_slash)
2060
+  					tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2139
+                                                tmp_folder_name = tmp_folder_name_dot + 1;
2061
+  				sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
2140
+                                        else
2062
+ 				sidebar_folder_name[0]=0;
2141
+                                                tmp_folder_name = tmp_folder_name_slash + 1;
2063
+ 				for (i=0; i < sidebar_folder_depth; i++)
2142
+ 				}
2064
+ 					strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr)));
2143
+ 				else
2065
+ 				strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name));
2144
+ 					tmp_folder_name = tmp->path + strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ?  0 : 1);
2066
+ 			}
2145
+ 				sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
2067
+ 		}
2146
+				sidebar_folder_name[0]=0;
2068
+ 		printw( "%.*s", SidebarWidth - delim_len + 1,
2147
+				for (i=0; i < sidebar_folder_depth; i++)
2069
+ 			make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
2148
+					strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr)));
2070
+ 			tmp->msg_unread, tmp->msg_flagged));
2149
+				strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name));
2071
+ 		if (sidebar_folder_depth > 0)
2150
+			}
2072
+ 		        free(sidebar_folder_name);
2151
+		}
2073
+ 		lines++;
2152
+		printw( "%.*s", SidebarWidth - delim_len + 1,
2074
+ 	}
2153
+			make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
2075
+ 	SETCOLOR(MT_COLOR_NORMAL);
2154
+			tmp->msg_unread, tmp->msg_flagged));
2076
+ 	for ( ; lines < SidebarHeight; lines++ ) {
2155
+		if (sidebar_folder_depth > 0)
2077
+ 		int i = 0;
2156
+		        free(sidebar_folder_name);
2078
+ 		move( lines, 0 );
2157
+		lines++;
2079
+ 		for ( ; i < SidebarWidth - delim_len; i++ )
2158
+	}
2080
+ 			addch(' ');
2159
+	SETCOLOR(MT_COLOR_NORMAL);
2081
+ 	}
2160
+	for ( ; lines < SidebarHeight; lines++ ) {
2082
+ 	return 0;
2161
+		int i = 0;
2083
+ }
2162
+		move( lines, 0 );
2084
+ 
2163
+		for ( ; i < SidebarWidth - delim_len; i++ )
2085
+ 
2164
+			addch(' ');
2086
+ void set_buffystats(CONTEXT* Context)
2165
+	}
2087
+ {
2166
+	return 0;
2088
+         BUFFY *tmp = Incoming;
2167
+}
2089
+         while(tmp) {
2168
+
2090
+                 if(Context && (!strcmp(tmp->path, Context->path) ||
2169
+
2091
+                                !strcmp(tmp->realpath, Context->path))) {
2170
+void set_buffystats(CONTEXT* Context)
2092
+ 			tmp->msg_unread = Context->unread;
2171
+{
2093
+ 			tmp->msgcount = Context->msgcount;
2172
+        BUFFY *tmp = Incoming;
2094
+ 			tmp->msg_flagged = Context->flagged;
2173
+        while(tmp) {
2095
+                         break;
2174
+                if(Context && (!strcmp(tmp->path, Context->path) ||
2096
+                 }
2175
+                               !strcmp(tmp->realpath, Context->path))) {
2097
+                 tmp = tmp->next;
2176
+			tmp->msg_unread = Context->unread;
2098
+         }
2177
+			tmp->msgcount = Context->msgcount;
2099
+ }
2178
+			tmp->msg_flagged = Context->flagged;
2100
+ 
2179
+                        break;
2101
+ void scroll_sidebar(int op, int menu)
2180
+                }
2102
+ {
2181
+                tmp = tmp->next;
2103
+         if(!SidebarWidth) return;
2182
+        }
2104
+         if(!CurBuffy) return;
2183
+}
2105
+ 
2184
+
2106
+ 	switch (op) {
2185
+void scroll_sidebar(int op, int menu)
2107
+ 		case OP_SIDEBAR_NEXT:
2186
+{
2108
+ 			if ( CurBuffy->next == NULL ) return;
2187
+        if(!SidebarWidth) return;
2109
+ 			CurBuffy = CurBuffy->next;
2188
+        if(!CurBuffy) return;
2110
+ 			break;
2189
+
2111
+ 		case OP_SIDEBAR_PREV:
2190
+	switch (op) {
2112
+ 			if ( CurBuffy->prev == NULL ) return;
2191
+		case OP_SIDEBAR_NEXT:
2113
+ 			CurBuffy = CurBuffy->prev;
2192
+			if ( CurBuffy->next == NULL ) return;
2114
+ 			break;
2193
+			CurBuffy = CurBuffy->next;
2115
+ 		case OP_SIDEBAR_SCROLL_UP:
2194
+			break;
2116
+ 			CurBuffy = TopBuffy;
2195
+		case OP_SIDEBAR_PREV:
2117
+ 			if ( CurBuffy != Incoming ) {
2196
+			if ( CurBuffy->prev == NULL ) return;
2118
+ 				calc_boundaries(menu);
2197
+			CurBuffy = CurBuffy->prev;
2119
+ 				CurBuffy = CurBuffy->prev;
2198
+			break;
2120
+ 			}
2199
+		case OP_SIDEBAR_SCROLL_UP:
2121
+ 			break;
2200
+			CurBuffy = TopBuffy;
2122
+ 		case OP_SIDEBAR_SCROLL_DOWN:
2201
+			if ( CurBuffy != Incoming ) {
2123
+ 			CurBuffy = BottomBuffy;
2202
+				calc_boundaries(menu);
2124
+ 			if ( CurBuffy->next ) {
2203
+				CurBuffy = CurBuffy->prev;
2125
+ 				calc_boundaries(menu);
2204
+			}
2126
+ 				CurBuffy = CurBuffy->next;
2205
+			break;
2127
+ 			}
2206
+		case OP_SIDEBAR_SCROLL_DOWN:
2128
+ 			break;
2207
+			CurBuffy = BottomBuffy;
2129
+ 		default:
2208
+			if ( CurBuffy->next ) {
2130
+ 			return;
2209
+				calc_boundaries(menu);
2131
+ 	}
2210
+				CurBuffy = CurBuffy->next;
2132
+ 	calc_boundaries(menu);
2211
+			}
2133
+ 	draw_sidebar(menu);
2212
+			break;
2134
+ }
2213
+		default:
2135
+ 
2214
+			return;
2136
*** mutt-1.5.23-orig/sidebar.h	1969-12-31 18:00:00.000000000 -0600
2215
+	}
2137
--- mutt-1.5.23/sidebar.h	2014-04-11 10:14:01.000000000 -0500
2216
+	calc_boundaries(menu);
2217
+	draw_sidebar(menu);
2218
+}
2219
+
2220
*** mutt-1.5.24-orig/sidebar.h	1969-12-31 18:00:00.000000000 -0600
2221
--- mutt-1.5.24/sidebar.h	2015-09-16 23:18:13.000000000 -0500
2138
***************
2222
***************
2139
*** 0 ****
2223
*** 0 ****
2140
--- 1,36 ----
2224
--- 1,36 ----
Lines 2174-2181 Link Here
2174
+ void set_buffystats(CONTEXT*);
2258
+ void set_buffystats(CONTEXT*);
2175
+ 
2259
+ 
2176
+ #endif /* SIDEBAR_H */
2260
+ #endif /* SIDEBAR_H */
2177
*** mutt-1.5.23-orig/doc/Muttrc	2014-03-12 11:27:11.000000000 -0500
2261
*** mutt-1.5.24-orig/doc/Muttrc	2015-08-30 12:24:53.000000000 -0500
2178
--- mutt-1.5.23/doc/Muttrc	2014-04-11 10:14:01.000000000 -0500
2262
--- mutt-1.5.24/doc/Muttrc	2015-09-16 23:18:13.000000000 -0500
2179
***************
2263
***************
2180
*** 657,662 ****
2264
*** 657,662 ****
2181
--- 657,682 ----
2265
--- 657,682 ----
Lines 2205-2214 Link Here
2205
  # set crypt_autosign=no
2289
  # set crypt_autosign=no
2206
  #
2290
  #
2207
  # Name: crypt_autosign
2291
  # Name: crypt_autosign
2208
*** mutt-1.5.23-orig/imap/imap.c	2014-03-12 11:03:45.000000000 -0500
2292
*** mutt-1.5.24-orig/imap/imap.c	2015-08-30 12:06:38.000000000 -0500
2209
--- mutt-1.5.23/imap/imap.c	2014-04-11 10:14:01.000000000 -0500
2293
--- mutt-1.5.24/imap/imap.c	2015-09-16 23:18:13.000000000 -0500
2210
***************
2294
***************
2211
*** 1514,1520 ****
2295
*** 1523,1529 ****
2212
  
2296
  
2213
      imap_munge_mbox_name (munged, sizeof (munged), name);
2297
      imap_munge_mbox_name (munged, sizeof (munged), name);
2214
      snprintf (command, sizeof (command),
2298
      snprintf (command, sizeof (command),
Lines 2216-2222 Link Here
2216
  
2300
  
2217
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2301
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2218
      {
2302
      {
2219
--- 1514,1520 ----
2303
--- 1523,1529 ----
2220
  
2304
  
2221
      imap_munge_mbox_name (munged, sizeof (munged), name);
2305
      imap_munge_mbox_name (munged, sizeof (munged), name);
2222
      snprintf (command, sizeof (command),
2306
      snprintf (command, sizeof (command),
Lines 2224-2231 Link Here
2224
  
2308
  
2225
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2309
      if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2226
      {
2310
      {
2227
*** mutt-1.5.23-orig/imap/command.c	2014-03-12 11:03:45.000000000 -0500
2311
*** mutt-1.5.24-orig/imap/command.c	2015-08-30 12:06:38.000000000 -0500
2228
--- mutt-1.5.23/imap/command.c	2014-04-11 10:14:01.000000000 -0500
2312
--- mutt-1.5.24/imap/command.c	2015-09-16 23:18:13.000000000 -0500
2229
***************
2313
***************
2230
*** 1012,1017 ****
2314
*** 1012,1017 ****
2231
--- 1012,1024 ----
2315
--- 1012,1024 ----
(-)./files/extra-patch-sidebar-nntp.orig (+2328 lines)
Line 0 Link Here
1
Taken from http://lunar-linux.org/~tchan/mutt/patch-1.5.23.sidebar.20140412.txt
2
3
diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c
4
*** mutt-1.5.23-orig/buffy.c.orig	2015-08-30 19:06:38.000000000 +0200
5
--- mutt-1.5.23/buffy.c	2015-09-10 09:31:22.000000000 +0200
6
@@ -161,6 +161,49 @@
7
   }
8
 }
9
 
10
+static int buffy_compare_name(const void *a, const void *b) {
11
+  const BUFFY *b1 = * (BUFFY * const *) a;
12
+  const BUFFY *b2 = * (BUFFY * const *) b;
13
+
14
+  return mutt_strcoll(b1->path, b2->path);
15
+}
16
+
17
+static BUFFY *buffy_sort(BUFFY *b)
18
+{
19
+  BUFFY *tmp = b;
20
+  int buffycount = 0;
21
+  BUFFY **ary;
22
+  int i;
23
+
24
+  if (!option(OPTSIDEBARSORT))
25
+    return b;
26
+
27
+  for (; tmp != NULL; tmp = tmp->next)
28
+    buffycount++;
29
+
30
+  ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
31
+
32
+  tmp = b;
33
+  for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
34
+    ary[i] = tmp;
35
+  }
36
+
37
+  qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
38
+
39
+  for (i = 0; i < buffycount - 1; i++) {
40
+    ary[i]->next = ary[i+1];
41
+  }
42
+  ary[buffycount - 1]->next = NULL;
43
+  for (i = 1; i < buffycount; i++) {
44
+    ary[i]->prev = ary[i-1];
45
+  }
46
+  ary[0]->prev = NULL;
47
+
48
+  tmp = ary[0];
49
+  free(ary);
50
+  return tmp;
51
+}
52
+
53
 BUFFY *mutt_find_mailbox (const char *path)
54
 {
55
   BUFFY *tmp = NULL;
56
@@ -196,9 +239,13 @@
57
 static BUFFY *buffy_new (const char *path)
58
 {
59
   BUFFY* buffy;
60
+  char rp[PATH_MAX];
61
+  char *r;
62
 
63
   buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
64
   strfcpy (buffy->path, path, sizeof (buffy->path));
65
+  r = realpath(path, rp);
66
+  strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
67
   buffy->next = NULL;
68
   buffy->magic = 0;
69
 
70
@@ -243,8 +290,8 @@
71
     p = realpath (buf, f1);
72
     for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
73
     {
74
-      q = realpath ((*tmp)->path, f2);
75
-      if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
76
+      q = (*tmp)->realpath;
77
+      if (mutt_strcmp (p ? p : buf, q) == 0)
78
       {
79
 	dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
80
 	break;
81
@@ -282,6 +329,7 @@
82
     else
83
       (*tmp)->size = 0;
84
   }
85
+  Incoming = buffy_sort(Incoming);
86
   return 0;
87
 }
88
 
89
@@ -306,6 +354,11 @@
90
       return 0;
91
   }
92
 
93
+  if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
94
+      mailbox->new = 1;
95
+      return 1;
96
+  }
97
+
98
   if ((dirp = opendir (path)) == NULL)
99
   {
100
     mailbox->magic = 0;
101
@@ -357,6 +410,73 @@
102
 
103
   return 0;
104
 }
105
+  
106
+/* update message counts for the sidebar */
107
+void buffy_maildir_update (BUFFY* mailbox)
108
+{
109
+  char path[_POSIX_PATH_MAX];
110
+  DIR *dirp;
111
+  struct dirent *de;
112
+  char *p;
113
+
114
+  if(!option(OPTSIDEBAR))
115
+      return;
116
+
117
+  mailbox->msgcount = 0;
118
+  mailbox->msg_unread = 0;
119
+  mailbox->msg_flagged = 0;
120
+
121
+  snprintf (path, sizeof (path), "%s/new", mailbox->path);
122
+        
123
+  if ((dirp = opendir (path)) == NULL)
124
+  {   
125
+    mailbox->magic = 0;
126
+    return;
127
+  } 
128
+      
129
+  while ((de = readdir (dirp)) != NULL)
130
+  {
131
+    if (*de->d_name == '.')
132
+      continue;
133
+
134
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
135
+      mailbox->new = 1;
136
+      mailbox->msgcount++;
137
+      mailbox->msg_unread++;
138
+    }
139
+  }
140
+
141
+  closedir (dirp);
142
+  snprintf (path, sizeof (path), "%s/cur", mailbox->path);
143
+        
144
+  if ((dirp = opendir (path)) == NULL)
145
+  {   
146
+    mailbox->magic = 0;
147
+    return;
148
+  } 
149
+      
150
+  while ((de = readdir (dirp)) != NULL)
151
+  {
152
+    if (*de->d_name == '.')
153
+      continue;
154
+
155
+    if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
156
+      mailbox->msgcount++;
157
+      if ((p = strstr (de->d_name, ":2,"))) {
158
+        if (!strchr (p + 3, 'T')) {
159
+          if (!strchr (p + 3, 'S'))
160
+            mailbox->msg_unread++;
161
+          if (strchr(p + 3, 'F'))
162
+            mailbox->msg_flagged++;
163
+        }
164
+      }
165
+    }
166
+  }
167
+
168
+  mailbox->sb_last_checked = time(NULL);
169
+  closedir (dirp);
170
+}
171
+
172
 /* returns 1 if mailbox has new mail */ 
173
 static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
174
 {
175
@@ -368,7 +488,7 @@
176
   else
177
     statcheck = sb->st_mtime > sb->st_atime
178
       || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
179
-  if (statcheck)
180
+  if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
181
   {
182
     if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
183
     {
184
@@ -388,6 +508,27 @@
185
   return rc;
186
 }
187
 
188
+/* update message counts for the sidebar */
189
+void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
190
+{
191
+  CONTEXT *ctx = NULL;
192
+
193
+  if(!option(OPTSIDEBAR))
194
+      return;
195
+  if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
196
+      return; /* no check necessary */
197
+
198
+  ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
199
+  if(ctx)
200
+  {
201
+    mailbox->msgcount = ctx->msgcount;
202
+    mailbox->msg_unread = ctx->unread;
203
+    mailbox->msg_flagged = ctx->flagged;
204
+    mailbox->sb_last_checked = time(NULL);
205
+    mx_close_mailbox(ctx, 0);
206
+  }
207
+}
208
+
209
 int mutt_buffy_check (int force)
210
 {
211
   BUFFY *tmp;
212
@@ -461,17 +602,20 @@
213
       {
214
       case M_MBOX:
215
       case M_MMDF:
216
+	buffy_mbox_update (tmp, &sb);
217
 	if (buffy_mbox_hasnew (tmp, &sb) > 0)
218
 	  BuffyCount++;
219
 	break;
220
 
221
       case M_MAILDIR:
222
+	buffy_maildir_update (tmp);
223
 	if (buffy_maildir_hasnew (tmp) > 0)
224
 	  BuffyCount++;
225
 	break;
226
 
227
       case M_MH:
228
-	mh_buffy(tmp);
229
+	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
230
+        mh_buffy(tmp);
231
 	if (tmp->new)
232
 	  BuffyCount++;
233
 	break;
234
*** mutt-1.5.23-orig/buffy.h	2014-03-12 11:03:44.000000000 -0500
235
--- mutt-1.5.23/buffy.h	2014-04-11 10:14:01.000000000 -0500
236
***************
237
*** 23,35 ****
238
--- 23,41 ----
239
  typedef struct buffy_t
240
  {
241
    char path[_POSIX_PATH_MAX];
242
+   char realpath[_POSIX_PATH_MAX];
243
    off_t size;
244
    struct buffy_t *next;
245
+   struct buffy_t *prev;
246
    short new;			/* mailbox has new mail */
247
+   int msgcount;			/* total number of messages */
248
+   int msg_unread;		/* number of unread messages */
249
+   int msg_flagged;		/* number of flagged messages */
250
    short notified;		/* user has been notified */
251
    short magic;			/* mailbox type */
252
    short newly_created;		/* mbox or mmdf just popped into existence */
253
    time_t last_visited;		/* time of last exit from this mailbox */
254
+   time_t sb_last_checked;      /* time of last buffy check from sidebar */
255
  }
256
  BUFFY;
257
  
258
*** mutt-1.5.23-orig/color.c.orig	2015-08-30 19:06:38.000000000 +0200
259
--- mutt-1.5.23/color.c	2015-09-10 09:34:06.000000000 +0200
260
@@ -94,6 +94,8 @@
261
   { "underline",	MT_COLOR_UNDERLINE },
262
   { "index",		MT_COLOR_INDEX },
263
   { "prompt",		MT_COLOR_PROMPT },
264
+  { "sidebar_new",	MT_COLOR_NEW },
265
+  { "sidebar_flagged",	MT_COLOR_FLAGGED },
266
   { NULL,		0 }
267
 };
268
 
269
*** mutt-1.5.23-orig/compose.c	2014-03-12 11:03:45.000000000 -0500
270
--- mutt-1.5.23/compose.c	2014-04-12 12:15:56.000000000 -0500
271
***************
272
*** 72,78 ****
273
  
274
  #define HDR_XOFFSET 10
275
  #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
276
! #define W (COLS - HDR_XOFFSET)
277
  
278
  static const char * const Prompts[] =
279
  {
280
--- 72,78 ----
281
  
282
  #define HDR_XOFFSET 10
283
  #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
284
! #define W (COLS - HDR_XOFFSET - SidebarWidth)
285
  
286
  static const char * const Prompts[] =
287
  {
288
***************
289
*** 110,116 ****
290
  
291
  static void redraw_crypt_lines (HEADER *msg)
292
  {
293
!   mvaddstr (HDR_CRYPT, 0, "Security: ");
294
  
295
    if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
296
    {
297
--- 110,116 ----
298
  
299
  static void redraw_crypt_lines (HEADER *msg)
300
  {
301
!   mvaddstr (HDR_CRYPT, SidebarWidth, "Security: ");
302
  
303
    if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
304
    {
305
***************
306
*** 142,148 ****
307
    }
308
  
309
    clrtoeol ();
310
!   move (HDR_CRYPTINFO, 0);
311
    clrtoeol ();
312
  
313
    if ((WithCrypto & APPLICATION_PGP)
314
--- 142,148 ----
315
    }
316
  
317
    clrtoeol ();
318
!   move (HDR_CRYPTINFO, SidebarWidth);
319
    clrtoeol ();
320
  
321
    if ((WithCrypto & APPLICATION_PGP)
322
***************
323
*** 159,165 ****
324
        && (msg->security & ENCRYPT)
325
        && SmimeCryptAlg
326
        && *SmimeCryptAlg) {
327
!       mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
328
  		NONULL(SmimeCryptAlg));
329
    }
330
  }
331
--- 159,165 ----
332
        && (msg->security & ENCRYPT)
333
        && SmimeCryptAlg
334
        && *SmimeCryptAlg) {
335
!       mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
336
  		NONULL(SmimeCryptAlg));
337
    }
338
  }
339
***************
340
*** 172,178 ****
341
    int c;
342
    char *t;
343
  
344
!   mvaddstr (HDR_MIX, 0,     "     Mix: ");
345
  
346
    if (!chain)
347
    {
348
--- 172,178 ----
349
    int c;
350
    char *t;
351
  
352
!   mvaddstr (HDR_MIX, SidebarWidth,     "     Mix: ");
353
  
354
    if (!chain)
355
    {
356
***************
357
*** 187,193 ****
358
      if (t && t[0] == '0' && t[1] == '\0')
359
        t = "<random>";
360
      
361
!     if (c + mutt_strlen (t) + 2 >= COLS)
362
        break;
363
  
364
      addstr (NONULL(t));
365
--- 187,193 ----
366
      if (t && t[0] == '0' && t[1] == '\0')
367
        t = "<random>";
368
      
369
!     if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
370
        break;
371
  
372
      addstr (NONULL(t));
373
***************
374
*** 239,245 ****
375
  
376
    buf[0] = 0;
377
    rfc822_write_address (buf, sizeof (buf), addr, 1);
378
!   mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
379
    mutt_paddstr (W, buf);
380
  }
381
  
382
--- 239,245 ----
383
  
384
    buf[0] = 0;
385
    rfc822_write_address (buf, sizeof (buf), addr, 1);
386
!   mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
387
    mutt_paddstr (W, buf);
388
  }
389
  
390
***************
391
*** 249,258 ****
392
    draw_envelope_addr (HDR_TO, msg->env->to);
393
    draw_envelope_addr (HDR_CC, msg->env->cc);
394
    draw_envelope_addr (HDR_BCC, msg->env->bcc);
395
!   mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
396
    mutt_paddstr (W, NONULL (msg->env->subject));
397
    draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
398
!   mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
399
    mutt_paddstr (W, fcc);
400
  
401
    if (WithCrypto)
402
--- 249,258 ----
403
    draw_envelope_addr (HDR_TO, msg->env->to);
404
    draw_envelope_addr (HDR_CC, msg->env->cc);
405
    draw_envelope_addr (HDR_BCC, msg->env->bcc);
406
!   mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
407
    mutt_paddstr (W, NONULL (msg->env->subject));
408
    draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
409
!   mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
410
    mutt_paddstr (W, fcc);
411
  
412
    if (WithCrypto)
413
***************
414
*** 263,269 ****
415
  #endif
416
  
417
    SETCOLOR (MT_COLOR_STATUS);
418
!   mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
419
    clrtoeol ();
420
  
421
    NORMAL_COLOR;
422
--- 263,269 ----
423
  #endif
424
  
425
    SETCOLOR (MT_COLOR_STATUS);
426
!   mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
427
    clrtoeol ();
428
  
429
    NORMAL_COLOR;
430
***************
431
*** 299,305 ****
432
    /* redraw the expanded list so the user can see the result */
433
    buf[0] = 0;
434
    rfc822_write_address (buf, sizeof (buf), *addr, 1);
435
!   move (line, HDR_XOFFSET);
436
    mutt_paddstr (W, buf);
437
    
438
    return 0;
439
--- 299,305 ----
440
    /* redraw the expanded list so the user can see the result */
441
    buf[0] = 0;
442
    rfc822_write_address (buf, sizeof (buf), *addr, 1);
443
!   move (line, HDR_XOFFSET+SidebarWidth);
444
    mutt_paddstr (W, buf);
445
    
446
    return 0;
447
***************
448
*** 544,550 ****
449
  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
450
  	{
451
  	  mutt_str_replace (&msg->env->subject, buf);
452
! 	  move (HDR_SUBJECT, HDR_XOFFSET);
453
  	  if (msg->env->subject)
454
  	    mutt_paddstr (W, msg->env->subject);
455
  	  else
456
--- 544,550 ----
457
  	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
458
  	{
459
  	  mutt_str_replace (&msg->env->subject, buf);
460
! 	  move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
461
  	  if (msg->env->subject)
462
  	    mutt_paddstr (W, msg->env->subject);
463
  	  else
464
***************
465
*** 562,568 ****
466
  	{
467
  	  strfcpy (fcc, buf, fcclen);
468
  	  mutt_pretty_mailbox (fcc, fcclen);
469
! 	  move (HDR_FCC, HDR_XOFFSET);
470
  	  mutt_paddstr (W, fcc);
471
  	  fccSet = 1;
472
  	}
473
--- 562,568 ----
474
  	{
475
  	  strfcpy (fcc, buf, fcclen);
476
  	  mutt_pretty_mailbox (fcc, fcclen);
477
! 	  move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
478
  	  mutt_paddstr (W, fcc);
479
  	  fccSet = 1;
480
  	}
481
*** mutt-1.5.23-orig/configure.ac	2014-03-12 11:26:40.000000000 -0500
482
--- mutt-1.5.23/configure.ac	2014-04-11 10:14:01.000000000 -0500
483
***************
484
*** 1276,1281 ****
485
--- 1276,1283 ----
486
    AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
487
  fi
488
  
489
+ AC_CHECK_FUNCS(fmemopen open_memstream)
490
+ 
491
  dnl Documentation tools
492
  have_openjade="no"
493
  AC_PATH_PROG([OSPCAT], [ospcat], [none])
494
*** mutt-1.5.23-orig/curs_main.c	2014-03-12 11:06:17.000000000 -0500
495
--- mutt-1.5.23/curs_main.c	2014-04-12 21:45:21.000000000 -0500
496
***************
497
*** 26,32 ****
498
--- 26,34 ----
499
  #include "mailbox.h"
500
  #include "mapping.h"
501
  #include "sort.h"
502
+ #include "buffy.h"
503
  #include "mx.h"
504
+ #include "sidebar.h"
505
  
506
  #ifdef USE_POP
507
  #include "pop.h"
508
***************
509
*** 519,538 ****
510
         menu->redraw |= REDRAW_STATUS;
511
       if (do_buffy_notify)
512
       {
513
!        if (mutt_buffy_notify () && option (OPTBEEPNEW))
514
!  	beep ();
515
       }
516
       else
517
         do_buffy_notify = 1;
518
      }
519
  
520
      if (op != -1)
521
        mutt_curs_set (0);
522
  
523
      if (menu->redraw & REDRAW_FULL)
524
      {
525
        menu_redraw_full (menu);
526
        mutt_show_error ();
527
      }
528
  
529
      if (menu->menu == MENU_MAIN)
530
--- 521,551 ----
531
         menu->redraw |= REDRAW_STATUS;
532
       if (do_buffy_notify)
533
       {
534
!        if (mutt_buffy_notify ())
535
!        {
536
!          menu->redraw |= REDRAW_STATUS;
537
!          if (option (OPTBEEPNEW))
538
!            beep ();
539
!        }
540
       }
541
       else
542
         do_buffy_notify = 1;
543
      }
544
  
545
+     if(option(OPTSIDEBAR))
546
+         menu->redraw |= REDRAW_SIDEBAR;
547
+ 
548
      if (op != -1)
549
        mutt_curs_set (0);
550
  
551
      if (menu->redraw & REDRAW_FULL)
552
      {
553
        menu_redraw_full (menu);
554
+       draw_sidebar(menu->menu);
555
        mutt_show_error ();
556
+     } else if(menu->redraw & REDRAW_SIDEBAR) {
557
+         draw_sidebar(menu->menu);
558
+         menu->redraw &= ~REDRAW_SIDEBAR;
559
      }
560
  
561
      if (menu->menu == MENU_MAIN)
562
***************
563
*** 554,562 ****
564
--- 567,578 ----
565
  
566
        if (menu->redraw & REDRAW_STATUS)
567
        {
568
+         DrawFullLine = 1;
569
  	menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
570
+         DrawFullLine = 0;
571
  	move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
572
  	SETCOLOR (MT_COLOR_STATUS);
573
+         set_buffystats(Context);
574
  	mutt_paddstr (COLS, buf);
575
  	NORMAL_COLOR;
576
  	menu->redraw &= ~REDRAW_STATUS;
577
***************
578
*** 569,575 ****
579
  	menu->oldcurrent = -1;
580
  
581
        if (option (OPTARROWCURSOR))
582
! 	move (menu->current - menu->top + menu->offset, 2);
583
        else if (option (OPTBRAILLEFRIENDLY))
584
  	move (menu->current - menu->top + menu->offset, 0);
585
        else
586
--- 585,591 ----
587
  	menu->oldcurrent = -1;
588
  
589
        if (option (OPTARROWCURSOR))
590
! 	move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
591
        else if (option (OPTBRAILLEFRIENDLY))
592
  	move (menu->current - menu->top + menu->offset, 0);
593
        else
594
***************
595
*** 1011,1016 ****
596
--- 1027,1033 ----
597
  	  break;
598
  
599
  	CHECK_MSGCOUNT;
600
+         CHECK_VISIBLE;
601
  	CHECK_READONLY;
602
  	{
603
  	  int oldvcount = Context->vcount;
604
***************
605
*** 1070,1075 ****
606
--- 1087,1093 ----
607
  	  menu->redraw = REDRAW_FULL;
608
  	break;
609
  
610
+       case OP_SIDEBAR_OPEN:
611
        case OP_MAIN_CHANGE_FOLDER:
612
        case OP_MAIN_NEXT_UNREAD_MAILBOX:
613
  
614
***************
615
*** 1101,1107 ****
616
  	{
617
  	  mutt_buffy (buf, sizeof (buf));
618
  
619
! 	  if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
620
  	  {
621
  	    if (menu->menu == MENU_PAGER)
622
  	    {
623
--- 1119,1129 ----
624
  	{
625
  	  mutt_buffy (buf, sizeof (buf));
626
  
627
!           if ( op == OP_SIDEBAR_OPEN ) {
628
!               if(!CurBuffy)
629
!                 break;
630
!             strncpy( buf, CurBuffy->path, sizeof(buf) );  
631
! 	    } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
632
  	  {
633
  	    if (menu->menu == MENU_PAGER)
634
  	    {
635
***************
636
*** 1119,1124 ****
637
--- 1141,1147 ----
638
  	}
639
  
640
  	mutt_expand_path (buf, sizeof (buf));
641
+         set_curbuffy(buf);
642
  	if (mx_get_magic (buf) <= 0)
643
  	{
644
  	  mutt_error (_("%s is not a mailbox."), buf);
645
***************
646
*** 2209,2214 ****
647
--- 2232,2243 ----
648
  	mutt_what_key();
649
  	break;
650
  
651
+       case OP_SIDEBAR_SCROLL_UP:
652
+       case OP_SIDEBAR_SCROLL_DOWN:
653
+       case OP_SIDEBAR_NEXT:
654
+       case OP_SIDEBAR_PREV:
655
+         scroll_sidebar(op, menu->menu);
656
+         break;
657
        default:
658
  	if (menu->menu == MENU_MAIN)
659
  	  km_error_key (MENU_MAIN);
660
*** mutt-1.5.23-orig/flags.c	2014-03-12 11:03:45.000000000 -0500
661
--- mutt-1.5.23/flags.c	2014-04-11 10:14:01.000000000 -0500
662
***************
663
*** 22,29 ****
664
--- 22,31 ----
665
  
666
  #include "mutt.h"
667
  #include "mutt_curses.h"
668
+ #include "mutt_menu.h"
669
  #include "sort.h"
670
  #include "mx.h"
671
+ #include "sidebar.h"
672
  
673
  void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
674
  {
675
***************
676
*** 263,268 ****
677
--- 265,271 ----
678
     */
679
    if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged))
680
      h->searched = 0;
681
+ 	draw_sidebar(0);
682
  }
683
  
684
  void mutt_tag_set_flag (int flag, int bf)
685
*** mutt-1.5.23-orig/functions.h	2014-03-12 11:03:45.000000000 -0500
686
--- mutt-1.5.23/functions.h	2014-04-11 10:14:01.000000000 -0500
687
***************
688
*** 169,174 ****
689
--- 169,179 ----
690
    { "decrypt-save",		OP_DECRYPT_SAVE,		NULL },
691
  
692
  
693
+  { "sidebar-scroll-up",	OP_SIDEBAR_SCROLL_UP, NULL },
694
+  { "sidebar-scroll-down",	OP_SIDEBAR_SCROLL_DOWN, NULL },
695
+  { "sidebar-next",		OP_SIDEBAR_NEXT, NULL },
696
+  { "sidebar-prev",		OP_SIDEBAR_PREV, NULL },
697
+  { "sidebar-open",		OP_SIDEBAR_OPEN, NULL },
698
    { NULL,			0,				NULL }
699
  };
700
  
701
***************
702
*** 272,277 ****
703
--- 277,287 ----
704
  
705
    { "what-key",		OP_WHAT_KEY,		NULL },
706
  
707
+   { "sidebar-scroll-up",	OP_SIDEBAR_SCROLL_UP, NULL },
708
+   { "sidebar-scroll-down",	OP_SIDEBAR_SCROLL_DOWN, NULL },
709
+   { "sidebar-next",	OP_SIDEBAR_NEXT, NULL },
710
+   { "sidebar-prev",	OP_SIDEBAR_PREV, NULL },
711
+   { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
712
    { NULL,		0,				NULL }
713
  };
714
  
715
*** mutt-1.5.23-orig/globals.h	2014-03-12 11:06:17.000000000 -0500
716
--- mutt-1.5.23/globals.h	2014-04-11 10:14:01.000000000 -0500
717
***************
718
*** 117,122 ****
719
--- 117,125 ----
720
  WHERE char *SendCharset;
721
  WHERE char *Sendmail;
722
  WHERE char *Shell;
723
+ WHERE char *SidebarDelim;
724
+ WHERE char *SidebarFormat;
725
+ WHERE char *SidebarIndentStr;
726
  WHERE char *Signature;
727
  WHERE char *SimpleSearch;
728
  #if USE_SMTP
729
***************
730
*** 208,213 ****
731
--- 211,219 ----
732
  WHERE short ScoreThresholdRead;
733
  WHERE short ScoreThresholdFlag;
734
  
735
+ WHERE struct buffy_t *CurBuffy INITVAL(0);
736
+ WHERE short DrawFullLine INITVAL(0);
737
+ WHERE short SidebarWidth;
738
  #ifdef USE_IMAP
739
  WHERE short ImapKeepalive;
740
  WHERE short ImapPipelineDepth;
741
*** mutt-1.5.23-orig/handler.c.orig	2015-09-10 09:34:53.000000000 +0200
742
--- mutt-1.5.23/handler.c	2015-09-10 09:58:03.000000000 +0200
743
@@ -1625,6 +1625,11 @@
744
   int decode = 0;
745
   int rc = 0;
746
 
747
+#ifdef HAVE_FMEMOPEN
748
+  char *temp;
749
+  size_t tempsize;
750
+#endif
751
+
752
   fseeko (s->fpin, b->offset, 0);
753
 
754
   /* see if we need to decode this part before processing it */
755
@@ -1642,6 +1647,14 @@
756
     {
757
       /* decode to a tempfile, saving the original destination */
758
       fp = s->fpout;
759
+#ifdef HAVE_FMEMOPEN
760
+	if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
761
+	{
762
+	  mutt_error _("Unable to open memory stream!");
763
+	  dprint (1, (debugfile, "Can't open memory stream.\n"));
764
+	  goto bail;
765
+	}
766
+#else
767
       mutt_mktemp (tempfile, sizeof (tempfile));
768
       if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
769
       {
770
@@ -1649,6 +1662,7 @@
771
         dprint (1, (debugfile, "Can't open %s.\n", tempfile));
772
         return -1;
773
       }
774
+#endif
775
       /* decoding the attachment changes the size and offset, so save a copy
776
         * of the "real" values now, and restore them after processing
777
         */
778
@@ -1677,8 +1691,19 @@
779
       /* restore final destination and substitute the tempfile for input */
780
       s->fpout = fp;
781
       fp = s->fpin;
782
+#ifdef HAVE_FMEMOPEN
783
+	if(tempsize)
784
+		s->fpin = fmemopen(temp, tempsize, "r");
785
+	else /* fmemopen cannot handle zero-length buffers */
786
+		s->fpin = safe_fopen ("/dev/null", "r");
787
+	if(s->fpin == NULL) {
788
+		mutt_perror("failed to re-open memstream!");
789
+		return (-1);
790
+	}
791
+#else
792
       s->fpin = fopen (tempfile, "r");
793
       unlink (tempfile);
794
+#endif
795
 
796
       /* restore the prefix */
797
       s->prefix = savePrefix;
798
@@ -1704,9 +1729,14 @@
799
 
800
       /* restore the original source stream */
801
       safe_fclose (&s->fpin);
802
+#ifdef HAVE_FMEMOPEN
803
+	if(tempsize)
804
+	    FREE(&temp);
805
+#endif
806
       s->fpin = fp;
807
     }
808
   }
809
+  bail:
810
   s->flags |= M_FIRSTDONE;
811
 
812
   return rc;
813
@@ -1743,6 +1773,7 @@
814
   handler_t handler = NULL;
815
   int rc = 0;
816
 
817
+
818
   int oflags = s->flags;
819
   
820
   /* first determine which handler to use to process this part */
821
*** mutt-1.5.23-orig/init.h	2014-03-12 11:06:17.000000000 -0500
822
--- mutt-1.5.23/init.h	2014-04-11 10:14:01.000000000 -0500
823
***************
824
*** 1966,1971 ****
825
--- 1966,2019 ----
826
    ** not used.
827
    ** (PGP only)
828
    */
829
+   {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, UL "|"},
830
+   /*
831
+   ** .pp
832
+   ** This specifies the delimiter between the sidebar (if visible) and 
833
+   ** other screens.
834
+   */
835
+   {"sidebar_indentstr", DT_STR, R_BOTH, UL &SidebarIndentStr, UL " "},
836
+   /*
837
+   ** .pp
838
+   ** This specifies the string that is used to indent items
839
+   ** with sidebar_folderindent= yes
840
+   */
841
+   { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 },
842
+   /*
843
+   ** .pp
844
+   ** This specifies whether or not to show sidebar (left-side list of folders).
845
+   */
846
+   { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 },
847
+   /*
848
+   ** .pp
849
+   ** This specifies whether or not to sort the sidebar alphabetically.
850
+   */
851
+   { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 },
852
+   /*
853
+   ** .pp
854
+   ** The width of the sidebar.
855
+   */
856
+   { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 1 },
857
+   /*
858
+   ** .pp
859
+   ** Should the sidebar shorten the path showed.
860
+   */
861
+   {"sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%?F? [%F]?%* %?N?%N/?%4S"},
862
+   /*
863
+   ** .pp
864
+   ** Format string for the sidebar. The sequences `%N', `%F' and `%S'
865
+   ** will be replaced by the number of new or flagged messages or the total
866
+   ** size of them mailbox. `%B' will be replaced with the name of the mailbox.
867
+   ** The `%!' sequence will be expanded to `!' if there is one flagged message;
868
+   ** to `!!' if there are two flagged messages; and to `n!' for n flagged
869
+   ** messages, n>2.
870
+   */
871
+   { "sidebar_folderindent", DT_BOOL, R_BOTH, OPTSIDEBARFOLDERINDENT, 0 },
872
+   /*
873
+   ** .pp
874
+   ** Should folders be indented in the sidebar.
875
+   */
876
+ 
877
    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
878
    /*
879
    ** .pp
880
*** mutt-1.5.23-orig/mailbox.h	2014-03-12 11:03:45.000000000 -0500
881
--- mutt-1.5.23/mailbox.h	2014-04-11 10:14:01.000000000 -0500
882
***************
883
*** 27,32 ****
884
--- 27,33 ----
885
  #define M_NEWFOLDER	(1<<4) /* create a new folder - same as M_APPEND, but uses
886
  				* safe_fopen() for mbox-style folders.
887
  				*/
888
+ #define M_PEEK		(1<<5) /* revert atime back after taking a look (if applicable) */
889
  
890
  /* mx_open_new_message() */
891
  #define M_ADD_FROM	1	/* add a From_ line */
892
*** mutt-1.5.23-orig/main.c	2014-03-12 11:06:17.000000000 -0500
893
--- mutt-1.5.23/main.c	2014-04-11 10:14:01.000000000 -0500
894
***************
895
*** 50,55 ****
896
--- 50,56 ----
897
  #include <unistd.h>
898
  #include <errno.h>
899
  #include <sys/stat.h>
900
+ #include <limits.h>
901
  #include <sys/utsname.h>
902
  
903
  #ifdef HAVE_GETOPT_H
904
***************
905
*** 555,561 ****
906
  
907
  int main (int argc, char **argv)
908
  {
909
!   char folder[_POSIX_PATH_MAX] = "";
910
    char *subject = NULL;
911
    char *includeFile = NULL;
912
    char *draftFile = NULL;
913
--- 556,562 ----
914
  
915
  int main (int argc, char **argv)
916
  {
917
!   char folder[PATH_MAX] = "";
918
    char *subject = NULL;
919
    char *includeFile = NULL;
920
    char *draftFile = NULL;
921
***************
922
*** 1025,1030 ****
923
--- 1026,1038 ----
924
        strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
925
      mutt_expand_path (folder, sizeof (folder));
926
  
927
+     {
928
+       char tmpfolder[PATH_MAX];
929
+       strfcpy (tmpfolder, folder, sizeof (tmpfolder));
930
+       if(!realpath(tmpfolder, folder))
931
+           strfcpy (folder, tmpfolder, sizeof (tmpfolder));
932
+     }
933
+ 
934
      mutt_str_replace (&CurrentFolder, folder);
935
      mutt_str_replace (&LastFolder, folder);
936
  
937
***************
938
*** 1047,1052 ****
939
--- 1055,1061 ----
940
      if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
941
         || !explicit_folder)
942
      {
943
+       set_curbuffy(folder);
944
        mutt_index_menu ();
945
        if (Context)
946
  	FREE (&Context);
947
*** mutt-1.5.23-orig/Makefile.am	2014-03-12 11:03:44.000000000 -0500
948
--- mutt-1.5.23/Makefile.am	2014-04-11 10:14:01.000000000 -0500
949
***************
950
*** 32,37 ****
951
--- 32,38 ----
952
  	rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
953
  	score.c send.c sendlib.c signal.c sort.c \
954
  	status.c system.c thread.c charset.c history.c lib.c \
955
+ 	sidebar.c \
956
  	muttlib.c editmsg.c mbyte.c \
957
  	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
958
  
959
*** mutt-1.5.23-orig/Makefile.in	2014-03-12 11:26:44.000000000 -0500
960
--- mutt-1.5.23/Makefile.in	2014-04-12 12:12:38.000000000 -0500
961
***************
962
*** 129,135 ****
963
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
964
  	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
965
  	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
966
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
967
  am__objects_1 =
968
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
969
  	$(am__objects_1)
970
--- 129,136 ----
971
  	system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
972
  	history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
973
  	editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
974
! 	ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) \
975
! 	sidebar.$(OBJEXT)
976
  am__objects_1 =
977
  am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
978
  	$(am__objects_1)
979
***************
980
*** 468,474 ****
981
  	score.c send.c sendlib.c signal.c sort.c \
982
  	status.c system.c thread.c charset.c history.c lib.c \
983
  	muttlib.c editmsg.c mbyte.c \
984
! 	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
985
  
986
  nodist_mutt_SOURCES = $(BUILT_SOURCES)
987
  mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
988
--- 469,476 ----
989
  	score.c send.c sendlib.c signal.c sort.c \
990
  	status.c system.c thread.c charset.c history.c lib.c \
991
  	muttlib.c editmsg.c mbyte.c \
992
! 	url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c \
993
! 	sidebar.c
994
  
995
  nodist_mutt_SOURCES = $(BUILT_SOURCES)
996
  mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
997
***************
998
*** 500,506 ****
999
  	README.SSL smime.h group.h \
1000
  	muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
1001
  	ChangeLog mkchangelog.sh mutt_idna.h \
1002
! 	snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \
1003
  	txt2c.c txt2c.sh version.sh check_sec.sh
1004
  
1005
  EXTRA_SCRIPTS = smime_keys
1006
--- 502,508 ----
1007
  	README.SSL smime.h group.h \
1008
  	muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
1009
  	ChangeLog mkchangelog.sh mutt_idna.h \
1010
! 	snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in \
1011
  	txt2c.c txt2c.sh version.sh check_sec.sh
1012
  
1013
  EXTRA_SCRIPTS = smime_keys
1014
*** mutt-1.5.23-orig/mbox.c	2014-03-12 11:03:45.000000000 -0500
1015
--- mutt-1.5.23/mbox.c	2014-04-11 10:14:01.000000000 -0500
1016
***************
1017
*** 100,105 ****
1018
--- 100,106 ----
1019
      mutt_perror (ctx->path);
1020
      return (-1);
1021
    }
1022
+   ctx->atime = sb.st_atime;
1023
    ctx->mtime = sb.st_mtime;
1024
    ctx->size = sb.st_size;
1025
  
1026
***************
1027
*** 251,256 ****
1028
--- 252,258 ----
1029
  
1030
    ctx->size = sb.st_size;
1031
    ctx->mtime = sb.st_mtime;
1032
+   ctx->atime = sb.st_atime;
1033
  
1034
  #ifdef NFS_ATTRIBUTE_HACK
1035
    if (sb.st_mtime > sb.st_atime)
1036
*** mutt-1.5.23-orig/menu.c	2014-03-12 11:03:45.000000000 -0500
1037
--- mutt-1.5.23/menu.c	2014-04-12 21:31:16.000000000 -0500
1038
***************
1039
*** 24,29 ****
1040
--- 24,30 ----
1041
  #include "mutt_curses.h"
1042
  #include "mutt_menu.h"
1043
  #include "mbyte.h"
1044
+ #include "sidebar.h"
1045
  
1046
  extern size_t UngetCount;
1047
  
1048
***************
1049
*** 186,192 ****
1050
  {
1051
    char *scratch = safe_strdup (s);
1052
    int shift = option (OPTARROWCURSOR) ? 3 : 0;
1053
!   int cols = COLS - shift;
1054
  
1055
    mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
1056
    s[n - 1] = 0;
1057
--- 187,193 ----
1058
  {
1059
    char *scratch = safe_strdup (s);
1060
    int shift = option (OPTARROWCURSOR) ? 3 : 0;
1061
!   int cols = COLS - shift - SidebarWidth;
1062
  
1063
    mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
1064
    s[n - 1] = 0;
1065
***************
1066
*** 239,244 ****
1067
--- 240,246 ----
1068
    int do_color;
1069
    int attr;
1070
  
1071
+   draw_sidebar(1);
1072
    for (i = menu->top; i < menu->top + menu->pagelen; i++)
1073
    {
1074
      if (i < menu->max)
1075
***************
1076
*** 249,255 ****
1077
        menu_pad_string (buf, sizeof (buf));
1078
  
1079
        ATTRSET(attr);
1080
!       move(i - menu->top + menu->offset, 0);
1081
        do_color = 1;
1082
  
1083
        if (i == menu->current)
1084
--- 251,257 ----
1085
        menu_pad_string (buf, sizeof (buf));
1086
  
1087
        ATTRSET(attr);
1088
!       move(i - menu->top + menu->offset, SidebarWidth);
1089
        do_color = 1;
1090
  
1091
        if (i == menu->current)
1092
***************
1093
*** 272,278 ****
1094
      else
1095
      {
1096
        NORMAL_COLOR;
1097
!       CLEARLINE(i - menu->top + menu->offset);
1098
      }
1099
    }
1100
    NORMAL_COLOR;
1101
--- 274,280 ----
1102
      else
1103
      {
1104
        NORMAL_COLOR;
1105
!       CLEARLINE_WIN (i - menu->top + menu->offset);
1106
      }
1107
    }
1108
    NORMAL_COLOR;
1109
***************
1110
*** 289,295 ****
1111
      return;
1112
    }
1113
    
1114
!   move (menu->oldcurrent + menu->offset - menu->top, 0);
1115
    ATTRSET(menu->color (menu->oldcurrent));
1116
  
1117
    if (option (OPTARROWCURSOR))
1118
--- 291,297 ----
1119
      return;
1120
    }
1121
    
1122
!   move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth);
1123
    ATTRSET(menu->color (menu->oldcurrent));
1124
  
1125
    if (option (OPTARROWCURSOR))
1126
***************
1127
*** 301,313 ****
1128
      {
1129
        menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
1130
        menu_pad_string (buf, sizeof (buf));
1131
!       move (menu->oldcurrent + menu->offset - menu->top, 3);
1132
        print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
1133
      }
1134
  
1135
      /* now draw it in the new location */
1136
      SETCOLOR(MT_COLOR_INDICATOR);
1137
!     mvaddstr(menu->current + menu->offset - menu->top, 0, "->");
1138
    }
1139
    else
1140
    {
1141
--- 303,315 ----
1142
      {
1143
        menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
1144
        menu_pad_string (buf, sizeof (buf));
1145
!       move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3);
1146
        print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
1147
      }
1148
  
1149
      /* now draw it in the new location */
1150
      SETCOLOR(MT_COLOR_INDICATOR);
1151
!     mvaddstr(menu->current + menu->offset - menu->top, SidebarWidth, "->");
1152
    }
1153
    else
1154
    {
1155
***************
1156
*** 320,326 ****
1157
      menu_make_entry (buf, sizeof (buf), menu, menu->current);
1158
      menu_pad_string (buf, sizeof (buf));
1159
      SETCOLOR(MT_COLOR_INDICATOR);
1160
!     move(menu->current - menu->top + menu->offset, 0);
1161
      print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
1162
    }
1163
    menu->redraw &= REDRAW_STATUS;
1164
--- 322,328 ----
1165
      menu_make_entry (buf, sizeof (buf), menu, menu->current);
1166
      menu_pad_string (buf, sizeof (buf));
1167
      SETCOLOR(MT_COLOR_INDICATOR);
1168
!     move(menu->current - menu->top + menu->offset, SidebarWidth);
1169
      print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
1170
    }
1171
    menu->redraw &= REDRAW_STATUS;
1172
***************
1173
*** 332,338 ****
1174
    char buf[LONG_STRING];
1175
    int attr = menu->color (menu->current);
1176
    
1177
!   move (menu->current + menu->offset - menu->top, 0);
1178
    menu_make_entry (buf, sizeof (buf), menu, menu->current);
1179
    menu_pad_string (buf, sizeof (buf));
1180
  
1181
--- 334,340 ----
1182
    char buf[LONG_STRING];
1183
    int attr = menu->color (menu->current);
1184
    
1185
!   move (menu->current + menu->offset - menu->top, SidebarWidth);
1186
    menu_make_entry (buf, sizeof (buf), menu, menu->current);
1187
    menu_pad_string (buf, sizeof (buf));
1188
  
1189
***************
1190
*** 872,878 ****
1191
      
1192
      
1193
      if (option (OPTARROWCURSOR))
1194
!       move (menu->current - menu->top + menu->offset, 2);
1195
      else if (option (OPTBRAILLEFRIENDLY))
1196
        move (menu->current - menu->top + menu->offset, 0);
1197
      else
1198
--- 874,880 ----
1199
      
1200
      
1201
      if (option (OPTARROWCURSOR))
1202
!       move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
1203
      else if (option (OPTBRAILLEFRIENDLY))
1204
        move (menu->current - menu->top + menu->offset, 0);
1205
      else
1206
*** mutt-1.5.23-orig/mh.c	2014-03-12 11:03:45.000000000 -0500
1207
--- mutt-1.5.23/mh.c	2014-04-11 11:04:59.000000000 -0500
1208
***************
1209
*** 295,300 ****
1210
--- 295,326 ----
1211
    mhs_free_sequences (&mhs);
1212
  }
1213
  
1214
+ void mh_buffy_update (const char *path, int *msgcount, int *msg_unread, int *msg_flagged, time_t *sb_last_checked)
1215
+ {
1216
+   int i;
1217
+   struct mh_sequences mhs;
1218
+   memset (&mhs, 0, sizeof (mhs));
1219
+ 
1220
+   if(!option(OPTSIDEBAR))
1221
+       return;
1222
+ 
1223
+   if (mh_read_sequences (&mhs, path) < 0)
1224
+     return;
1225
+ 
1226
+   msgcount = 0;
1227
+   msg_unread = 0;
1228
+   msg_flagged = 0;
1229
+   for (i = 0; i <= mhs.max; i++)
1230
+     msgcount++;
1231
+     if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN) {
1232
+       msg_unread++;
1233
+     }
1234
+     if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED)
1235
+       msg_flagged++;
1236
+   mhs_free_sequences (&mhs);
1237
+   *sb_last_checked = time(NULL);
1238
+ }
1239
+ 
1240
  static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
1241
  {
1242
    int fd;
1243
*** mutt-1.5.23-orig/mutt_curses.h.orig	2015-08-30 19:06:38.000000000 +0200
1244
--- mutt-1.5.23/mutt_curses.h	2015-09-10 09:42:34.000000000 +0200
1245
@@ -64,6 +64,7 @@
1246
 #undef lines
1247
 #endif /* lines */
1248
 
1249
+#define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
1250
 #define CLEARLINE(x) move(x,0), clrtoeol()
1251
 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1252
 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1253
@@ -121,6 +122,8 @@
1254
   MT_COLOR_UNDERLINE,
1255
   MT_COLOR_INDEX,
1256
   MT_COLOR_PROMPT,
1257
+  MT_COLOR_NEW,
1258
+  MT_COLOR_FLAGGED,
1259
   MT_COLOR_MAX
1260
 };
1261
 
1262
*** mutt-1.5.23-orig/mutt_menu.h	2014-03-12 11:06:17.000000000 -0500
1263
--- mutt-1.5.23/mutt_menu.h	2014-04-11 10:14:01.000000000 -0500
1264
***************
1265
*** 34,39 ****
1266
--- 34,40 ----
1267
  #define REDRAW_FULL		(1<<5)
1268
  #define REDRAW_BODY		(1<<6)
1269
  #define REDRAW_SIGWINCH		(1<<7)
1270
+ #define REDRAW_SIDEBAR		(1<<8)
1271
  
1272
  #define M_MODEFMT "-- Mutt: %s"
1273
  
1274
*** mutt-1.5.23-orig/mutt.h	2014-03-12 11:06:17.000000000 -0500
1275
--- mutt-1.5.23/mutt.h	2014-04-11 10:14:01.000000000 -0500
1276
***************
1277
*** 421,426 ****
1278
--- 421,430 ----
1279
    OPTSAVEEMPTY,
1280
    OPTSAVENAME,
1281
    OPTSCORE,
1282
+   OPTSIDEBAR,
1283
+   OPTSIDEBARSHORTPATH,
1284
+   OPTSIDEBARSORT,
1285
+   OPTSIDEBARFOLDERINDENT,
1286
    OPTSIGDASHES,
1287
    OPTSIGONTOP,
1288
    OPTSORTRE,
1289
***************
1290
*** 861,866 ****
1291
--- 865,871 ----
1292
  {
1293
    char *path;
1294
    FILE *fp;
1295
+   time_t atime;
1296
    time_t mtime;
1297
    off_t size;
1298
    off_t vsize;
1299
***************
1300
*** 895,900 ****
1301
--- 900,906 ----
1302
    unsigned int quiet : 1;	/* inhibit status messages? */
1303
    unsigned int collapsed : 1;   /* are all threads collapsed? */
1304
    unsigned int closing : 1;	/* mailbox is being closed */
1305
+   unsigned int peekonly : 1;	/* just taking a glance, revert atime */
1306
  
1307
    /* driver hooks */
1308
    void *data;			/* driver specific data */
1309
*** mutt-1.5.23-orig/muttlib.c	2014-03-12 11:03:45.000000000 -0500
1310
--- mutt-1.5.23/muttlib.c	2014-04-11 10:14:01.000000000 -0500
1311
***************
1312
*** 1281,1286 ****
1313
--- 1281,1288 ----
1314
  	  pl = pw = 1;
1315
  
1316
  	/* see if there's room to add content, else ignore */
1317
+         if ( DrawFullLine )
1318
+         {
1319
  	if ((col < COLS && wlen < destlen) || soft)
1320
  	{
1321
  	  int pad;
1322
***************
1323
*** 1324,1329 ****
1324
--- 1326,1377 ----
1325
  	  col += wid;
1326
  	  src += pl;
1327
  	}
1328
+         }
1329
+         else
1330
+         {
1331
+ 	if ((col < COLS-SidebarWidth && wlen < destlen) || soft)
1332
+         {
1333
+ 	  int pad;
1334
+ 
1335
+ 	  /* get contents after padding */
1336
+ 	  mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags);
1337
+ 	  len = mutt_strlen (buf);
1338
+ 	  wid = mutt_strwidth (buf);
1339
+ 
1340
+ 	  /* try to consume as many columns as we can, if we don't have
1341
+ 	   * memory for that, use as much memory as possible */
1342
+ 	  pad = (COLS - SidebarWidth - col - wid) / pw;
1343
+ 	  if (pad > 0 && wlen + (pad * pl) + len > destlen)
1344
+ 	    pad = ((signed)(destlen - wlen - len)) / pl;
1345
+ 	  if (pad > 0)
1346
+ 	  {
1347
+ 	    while (pad--)
1348
+ 	    {
1349
+ 	      memcpy (wptr, src, pl);
1350
+ 	      wptr += pl;
1351
+ 	      wlen += pl;
1352
+ 	      col += pw;
1353
+ 	    }
1354
+ 	  }
1355
+ 	  else if (soft && pad < 0)
1356
+ 	  {
1357
+ 	    /* \0-terminate dest for length computation in mutt_wstr_trunc() */
1358
+ 	    *wptr = 0;
1359
+ 	    /* make sure right part is at most as wide as display */
1360
+ 	    len = mutt_wstr_trunc (buf, destlen, COLS, &wid);
1361
+ 	    /* truncate left so that right part fits completely in */
1362
+ 	    wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col);
1363
+ 	    wptr = dest + wlen;
1364
+ 	  }
1365
+ 	  if (len + wlen > destlen)
1366
+ 	    len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL);
1367
+ 	  memcpy (wptr, buf, len);
1368
+ 	  wptr += len;
1369
+ 	  wlen += len;
1370
+ 	  col += wid;
1371
+ 	  src += pl;
1372
+ 	}
1373
+         }
1374
  	break; /* skip rest of input */
1375
        }
1376
        else if (ch == '|')
1377
*** mutt-1.5.23-orig/mx.c	2014-03-12 11:03:45.000000000 -0500
1378
--- mutt-1.5.23/mx.c	2014-04-11 10:14:01.000000000 -0500
1379
***************
1380
*** 580,585 ****
1381
--- 580,586 ----
1382
   *		M_APPEND	open mailbox for appending
1383
   *		M_READONLY	open mailbox in read-only mode
1384
   *		M_QUIET		only print error messages
1385
+  *		M_PEEK		revert atime where applicable
1386
   *	ctx	if non-null, context struct to use
1387
   */
1388
  CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
1389
***************
1390
*** 602,607 ****
1391
--- 603,610 ----
1392
      ctx->quiet = 1;
1393
    if (flags & M_READONLY)
1394
      ctx->readonly = 1;
1395
+   if (flags & M_PEEK)
1396
+     ctx->peekonly = 1;
1397
  
1398
    if (flags & (M_APPEND|M_NEWFOLDER))
1399
    {
1400
***************
1401
*** 701,713 ****
1402
  void mx_fastclose_mailbox (CONTEXT *ctx)
1403
  {
1404
    int i;
1405
  
1406
    if(!ctx) 
1407
      return;
1408
  
1409
    /* never announce that a mailbox we've just left has new mail. #3290
1410
     * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
1411
!   mutt_buffy_setnotified(ctx->path);
1412
  
1413
    if (ctx->mx_close)
1414
      ctx->mx_close (ctx);
1415
--- 704,729 ----
1416
  void mx_fastclose_mailbox (CONTEXT *ctx)
1417
  {
1418
    int i;
1419
+ #ifndef BUFFY_SIZE
1420
+   struct utimbuf ut;
1421
+ #endif
1422
  
1423
    if(!ctx) 
1424
      return;
1425
+ #ifndef BUFFY_SIZE
1426
+   /* fix up the times so buffy won't get confused */
1427
+   if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime)
1428
+   {
1429
+     ut.actime = ctx->atime;
1430
+     ut.modtime = ctx->mtime;
1431
+     utime (ctx->path, &ut); 
1432
+   }
1433
+ #endif
1434
  
1435
    /* never announce that a mailbox we've just left has new mail. #3290
1436
     * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
1437
!   if(!ctx->peekonly)
1438
!     mutt_buffy_setnotified(ctx->path);
1439
  
1440
    if (ctx->mx_close)
1441
      ctx->mx_close (ctx);
1442
***************
1443
*** 719,724 ****
1444
--- 735,742 ----
1445
    mutt_clear_threads (ctx);
1446
    for (i = 0; i < ctx->msgcount; i++)
1447
      mutt_free_header (&ctx->hdrs[i]);
1448
+   ctx->msgcount -= ctx->deleted;
1449
+   set_buffystats(ctx);
1450
    FREE (&ctx->hdrs);
1451
    FREE (&ctx->v2r);
1452
    FREE (&ctx->path);
1453
***************
1454
*** 812,817 ****
1455
--- 830,839 ----
1456
      if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read 
1457
          && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
1458
        read_msgs++;
1459
+     if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
1460
+       ctx->unread--;
1461
+     if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged)
1462
+       ctx->flagged--;
1463
    }
1464
  
1465
    if (read_msgs && quadoption (OPT_MOVE) != M_NO)
1466
*** mutt-1.5.23-orig/mx.h	2014-03-12 11:03:45.000000000 -0500
1467
--- mutt-1.5.23/mx.h	2014-04-11 11:11:47.000000000 -0500
1468
***************
1469
*** 57,62 ****
1470
--- 57,63 ----
1471
  int mh_read_dir (CONTEXT *, const char *);
1472
  int mh_sync_mailbox (CONTEXT *, int *);
1473
  int mh_check_mailbox (CONTEXT *, int *);
1474
+ void mh_buffy_update (const char *, int *, int *, int *, time_t *);
1475
  int mh_check_empty (const char *);
1476
  
1477
  int maildir_read_dir (CONTEXT *);
1478
*** mutt-1.5.23-orig/OPS	2014-03-12 11:03:44.000000000 -0500
1479
--- mutt-1.5.23/OPS	2014-04-11 10:14:01.000000000 -0500
1480
***************
1481
*** 179,181 ****
1482
--- 179,186 ----
1483
  OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
1484
  OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
1485
  OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
1486
+ OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
1487
+ OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
1488
+ OP_SIDEBAR_NEXT "go down to next mailbox"
1489
+ OP_SIDEBAR_PREV "go to previous mailbox"
1490
+ OP_SIDEBAR_OPEN "open hilighted mailbox"
1491
*** mutt-1.5.23-orig/pager.c	2014-03-12 11:06:17.000000000 -0500
1492
--- mutt-1.5.23/pager.c	2014-04-12 21:53:15.000000000 -0500
1493
***************
1494
*** 29,34 ****
1495
--- 29,35 ----
1496
  #include "pager.h"
1497
  #include "attach.h"
1498
  #include "mbyte.h"
1499
+ #include "sidebar.h"
1500
  
1501
  #include "mutt_crypt.h"
1502
  
1503
***************
1504
*** 1095,1100 ****
1505
--- 1096,1102 ----
1506
    wchar_t wc;
1507
    mbstate_t mbstate;
1508
    int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap);
1509
+   wrap_cols -= SidebarWidth;
1510
  
1511
    if (check_attachment_marker ((char *)buf) == 0)
1512
      wrap_cols = COLS;
1513
***************
1514
*** 1572,1577 ****
1515
--- 1574,1580 ----
1516
  
1517
    int bodyoffset = 1;			/* offset of first line of real text */
1518
    int statusoffset = 0; 		/* offset for the status bar */
1519
+   int statuswidth;
1520
    int helpoffset = LINES - 2;		/* offset for the help bar. */
1521
    int bodylen = LINES - 2 - bodyoffset; /* length of displayable area */
1522
  
1523
***************
1524
*** 1746,1752 ****
1525
      if ((redraw & REDRAW_BODY) || topline != oldtopline)
1526
      {
1527
        do {
1528
! 	move (bodyoffset, 0);
1529
  	curline = oldtopline = topline;
1530
  	lines = 0;
1531
  	force_redraw = 0;
1532
--- 1749,1755 ----
1533
      if ((redraw & REDRAW_BODY) || topline != oldtopline)
1534
      {
1535
        do {
1536
! 	move (bodyoffset, SidebarWidth);
1537
  	curline = oldtopline = topline;
1538
  	lines = 0;
1539
  	force_redraw = 0;
1540
***************
1541
*** 1759,1764 ****
1542
--- 1762,1768 ----
1543
  			    &QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
1544
  	    lines++;
1545
  	  curline++;
1546
+   	  move(lines + bodyoffset, SidebarWidth);
1547
  	}
1548
  	last_offset = lineInfo[curline].offset;
1549
        } while (force_redraw);
1550
***************
1551
*** 1771,1776 ****
1552
--- 1775,1781 ----
1553
  	  addch ('~');
1554
  	addch ('\n');
1555
  	lines++;
1556
+   	move(lines + bodyoffset, SidebarWidth);
1557
        }
1558
        NORMAL_COLOR;
1559
  
1560
***************
1561
*** 1788,1816 ****
1562
        hfi.ctx = Context;
1563
        hfi.pager_progress = pager_progress_str;
1564
  
1565
        if (last_pos < sb.st_size - 1)
1566
  	snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
1567
        else
1568
  	strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str));
1569
  
1570
        /* print out the pager status bar */
1571
!       move (statusoffset, 0);
1572
        SETCOLOR (MT_COLOR_STATUS);
1573
  
1574
        if (IsHeader (extra) || IsMsgAttach (extra))
1575
        {
1576
! 	size_t l1 = COLS * MB_LEN_MAX;
1577
  	size_t l2 = sizeof (buffer);
1578
  	hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr;
1579
  	mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1580
! 	mutt_paddstr (COLS, buffer);
1581
        }
1582
        else
1583
        {
1584
  	char bn[STRING];
1585
  	snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
1586
! 	mutt_paddstr (COLS, bn);
1587
        }
1588
        NORMAL_COLOR;
1589
      }
1590
  
1591
--- 1793,1831 ----
1592
        hfi.ctx = Context;
1593
        hfi.pager_progress = pager_progress_str;
1594
  
1595
+       statuswidth = COLS - (option(OPTSTATUSONTOP) && PagerIndexLines > 0 ? SidebarWidth : 0);
1596
+ 
1597
        if (last_pos < sb.st_size - 1)
1598
  	snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
1599
        else
1600
  	strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str));
1601
  
1602
        /* print out the pager status bar */
1603
!       move (statusoffset, SidebarWidth);
1604
        SETCOLOR (MT_COLOR_STATUS);
1605
+       if(option(OPTSTATUSONTOP) && PagerIndexLines > 0) {
1606
+           CLEARLINE_WIN (statusoffset);
1607
+       } else {
1608
+           CLEARLINE (statusoffset);
1609
+           DrawFullLine = 1; /* for mutt_make_string_info */
1610
+       }
1611
  
1612
        if (IsHeader (extra) || IsMsgAttach (extra))
1613
        {
1614
! 	size_t l1 = statuswidth * MB_LEN_MAX;
1615
  	size_t l2 = sizeof (buffer);
1616
  	hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr;
1617
  	mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1618
! 	mutt_paddstr (statuswidth, buffer);
1619
        }
1620
        else
1621
        {
1622
  	char bn[STRING];
1623
  	snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
1624
! 	mutt_paddstr (statuswidth, bn);
1625
        }
1626
+       if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
1627
+           DrawFullLine = 0; /* reset */
1628
        NORMAL_COLOR;
1629
      }
1630
  
1631
***************
1632
*** 1819,1834 ****
1633
        /* redraw the pager_index indicator, because the
1634
         * flags for this message might have changed. */
1635
        menu_redraw_current (index);
1636
  
1637
        /* print out the index status bar */
1638
        menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1639
   
1640
!       move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
1641
        SETCOLOR (MT_COLOR_STATUS);
1642
!       mutt_paddstr (COLS, buffer);
1643
        NORMAL_COLOR;
1644
      }
1645
  
1646
      redraw = 0;
1647
  
1648
      if (option(OPTBRAILLEFRIENDLY)) {
1649
--- 1834,1855 ----
1650
        /* redraw the pager_index indicator, because the
1651
         * flags for this message might have changed. */
1652
        menu_redraw_current (index);
1653
+       draw_sidebar(MENU_PAGER);
1654
  
1655
        /* print out the index status bar */
1656
        menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1657
   
1658
!       move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)),
1659
!           (option(OPTSTATUSONTOP) ? 0: SidebarWidth));
1660
        SETCOLOR (MT_COLOR_STATUS);
1661
!       mutt_paddstr (COLS - (option(OPTSTATUSONTOP) ? 0 : SidebarWidth), buffer);
1662
        NORMAL_COLOR;
1663
      }
1664
  
1665
+     /* if we're not using the index, update every time */
1666
+     if ( index == 0 )
1667
+       draw_sidebar(MENU_PAGER);
1668
+ 
1669
      redraw = 0;
1670
  
1671
      if (option(OPTBRAILLEFRIENDLY)) {
1672
***************
1673
*** 2763,2768 ****
1674
--- 2784,2796 ----
1675
  	mutt_what_key ();
1676
  	break;
1677
  
1678
+       case OP_SIDEBAR_SCROLL_UP:
1679
+       case OP_SIDEBAR_SCROLL_DOWN:
1680
+       case OP_SIDEBAR_NEXT:
1681
+       case OP_SIDEBAR_PREV:
1682
+ 	scroll_sidebar(ch, MENU_PAGER);
1683
+  	break;
1684
+ 
1685
        default:
1686
  	ch = -1;
1687
  	break;
1688
*** mutt-1.5.23-orig/pattern.c	2014-03-12 11:03:45.000000000 -0500
1689
--- mutt-1.5.23/pattern.c	2014-04-11 10:14:01.000000000 -0500
1690
***************
1691
*** 154,159 ****
1692
--- 154,163 ----
1693
    HEADER *h = ctx->hdrs[msgno];
1694
    char *buf;
1695
    size_t blen;
1696
+ #ifdef HAVE_FMEMOPEN
1697
+   char *temp;
1698
+   size_t tempsize;
1699
+ #endif
1700
  
1701
    if ((msg = mx_open_message (ctx, msgno)) != NULL)
1702
    {
1703
***************
1704
*** 163,174 ****
1705
--- 167,186 ----
1706
        memset (&s, 0, sizeof (s));
1707
        s.fpin = msg->fp;
1708
        s.flags = M_CHARCONV;
1709
+ #ifdef HAVE_FMEMOPEN
1710
+       if((s.fpout = open_memstream(&temp, &tempsize)) == NULL)
1711
+       {
1712
+ 	mutt_perror ("Error opening memstream");
1713
+ 	return (0);
1714
+       }
1715
+ #else
1716
        mutt_mktemp (tempfile, sizeof (tempfile));
1717
        if ((s.fpout = safe_fopen (tempfile, "w+")) == NULL)
1718
        {
1719
  	mutt_perror (tempfile);
1720
  	return (0);
1721
        }
1722
+ #endif
1723
  
1724
        if (pat->op != M_BODY)
1725
  	mutt_copy_header (msg->fp, h, s.fpout, CH_FROM | CH_DECODE, NULL);
1726
***************
1727
*** 184,190 ****
1728
--- 196,206 ----
1729
  	  if (s.fpout)
1730
  	  {
1731
  	    safe_fclose (&s.fpout);
1732
+ #ifdef HAVE_FMEMOPEN
1733
+             FREE(&temp);
1734
+ #else
1735
  	    unlink (tempfile);
1736
+ #endif
1737
  	  }
1738
  	  return (0);
1739
  	}
1740
***************
1741
*** 193,203 ****
1742
--- 209,236 ----
1743
  	mutt_body_handler (h->content, &s);
1744
        }
1745
  
1746
+ #ifdef HAVE_FMEMOPEN
1747
+       fclose(s.fpout);
1748
+       lng = tempsize;
1749
+ 
1750
+       if(tempsize) {
1751
+           if ((fp = fmemopen(temp, tempsize, "r")) == NULL) {
1752
+             mutt_perror ("Error re-opening memstream");
1753
+             return (0);
1754
+           }
1755
+       } else { /* fmemopen cannot handle empty buffers */
1756
+           if ((fp = safe_fopen ("/dev/null", "r")) == NULL) {
1757
+             mutt_perror ("Error opening /dev/null");
1758
+             return (0);
1759
+           }
1760
+       }
1761
+ #else
1762
        fp = s.fpout;
1763
        fflush (fp);
1764
        fseek (fp, 0, 0);
1765
        fstat (fileno (fp), &st);
1766
        lng = (long) st.st_size;
1767
+ #endif
1768
      }
1769
      else
1770
      {
1771
***************
1772
*** 244,250 ****
1773
--- 277,288 ----
1774
      if (option (OPTTHOROUGHSRC))
1775
      {
1776
        safe_fclose (&fp);
1777
+ #ifdef HAVE_FMEMOPEN
1778
+       if(tempsize)
1779
+           FREE (&temp);
1780
+ #else
1781
        unlink (tempfile);
1782
+ #endif
1783
      }
1784
    }
1785
  
1786
*** mutt-1.5.23-orig/PATCHES	2014-03-12 11:03:44.000000000 -0500
1787
--- mutt-1.5.23/PATCHES	2014-04-12 12:36:35.000000000 -0500
1788
***************
1789
*** 0 ****
1790
--- 1 ----
1791
+ patch-1.5.23.sidebar.20140412.txt
1792
*** mutt-1.5.23-orig/protos.h	2014-03-12 11:06:17.000000000 -0500
1793
--- mutt-1.5.23/protos.h	2014-04-11 10:14:01.000000000 -0500
1794
***************
1795
*** 36,41 ****
1796
--- 36,48 ----
1797
    const char *pager_progress;
1798
  };
1799
  
1800
+ struct sidebar_entry {
1801
+     char                box[SHORT_STRING];
1802
+     unsigned int        size;
1803
+     unsigned int        new;
1804
+     unsigned int        flagged;
1805
+ };
1806
+ 
1807
  void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
1808
  
1809
  int mutt_extract_token (BUFFER *, BUFFER *, int);
1810
*** mutt-1.5.23-orig/sidebar.c	1969-12-31 18:00:00.000000000 -0600
1811
--- mutt-1.5.23/sidebar.c	2014-04-11 10:14:01.000000000 -0500
1812
***************
1813
*** 0 ****
1814
--- 1,405 ----
1815
+ /*
1816
+  * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1817
+  * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1818
+  * 
1819
+  *     This program is free software; you can redistribute it and/or modify
1820
+  *     it under the terms of the GNU General Public License as published by
1821
+  *     the Free Software Foundation; either version 2 of the License, or
1822
+  *     (at your option) any later version.
1823
+  * 
1824
+  *     This program is distributed in the hope that it will be useful,
1825
+  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1826
+  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1827
+  *     GNU General Public License for more details.
1828
+  * 
1829
+  *     You should have received a copy of the GNU General Public License
1830
+  *     along with this program; if not, write to the Free Software
1831
+  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1832
+  */ 
1833
+ 
1834
+ 
1835
+ #if HAVE_CONFIG_H
1836
+ # include "config.h"
1837
+ #endif
1838
+ 
1839
+ #include "mutt.h"
1840
+ #include "mutt_menu.h"
1841
+ #include "mutt_curses.h"
1842
+ #include "sidebar.h"
1843
+ #include "buffy.h"
1844
+ #include <libgen.h>
1845
+ #include "keymap.h"
1846
+ #include <stdbool.h>
1847
+ 
1848
+ /*BUFFY *CurBuffy = 0;*/
1849
+ static BUFFY *TopBuffy = 0;
1850
+ static BUFFY *BottomBuffy = 0;
1851
+ static int known_lines = 0;
1852
+ 
1853
+ void calc_boundaries() {
1854
+ 
1855
+     BUFFY *tmp = Incoming;
1856
+ 
1857
+ 	int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
1858
+ 
1859
+ 	if ( known_lines != LINES ) {
1860
+ 		TopBuffy = BottomBuffy = 0;
1861
+ 		known_lines = LINES;
1862
+ 	}
1863
+ 	for ( ; tmp->next != 0; tmp = tmp->next )
1864
+ 		tmp->next->prev = tmp;
1865
+ 
1866
+ 	if ( TopBuffy == 0 && BottomBuffy == 0 )
1867
+ 		TopBuffy = Incoming;
1868
+ 	if ( BottomBuffy == 0 ) {
1869
+ 		BottomBuffy = TopBuffy;
1870
+ 		while ( --count && BottomBuffy->next )
1871
+ 			BottomBuffy = BottomBuffy->next;
1872
+ 	}
1873
+ 	else if ( TopBuffy == CurBuffy->next ) {
1874
+ 		BottomBuffy = CurBuffy;
1875
+ 		tmp = BottomBuffy;
1876
+ 		while ( --count && tmp->prev)
1877
+ 			tmp = tmp->prev;
1878
+ 		TopBuffy = tmp;
1879
+ 	}
1880
+ 	else if ( BottomBuffy == CurBuffy->prev ) {
1881
+ 		TopBuffy = CurBuffy;
1882
+ 		tmp = TopBuffy;
1883
+ 		while ( --count && tmp->next )
1884
+ 			tmp = tmp->next;
1885
+ 		BottomBuffy = tmp;
1886
+ 	}
1887
+ }
1888
+ 
1889
+ static const char *
1890
+ sidebar_format_str (char *dest,
1891
+ 			size_t destlen,
1892
+ 			size_t col,
1893
+ 			char op,
1894
+ 			const char *src,
1895
+ 			const char *prefix,
1896
+ 			const char *ifstring,
1897
+ 			const char *elsestring,
1898
+ 			unsigned long data,
1899
+ 			format_flag flags)
1900
+ {
1901
+ /* casting from unsigned long - srsly?! */
1902
+ struct sidebar_entry *sbe = (struct sidebar_entry *) data;
1903
+ unsigned int optional;
1904
+ char fmt[SHORT_STRING], buf[SHORT_STRING];
1905
+ 
1906
+ optional = flags & M_FORMAT_OPTIONAL;
1907
+ 
1908
+ switch(op) {
1909
+ 	case 'F':
1910
+ 		if(!optional) {
1911
+ 			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1912
+ 			snprintf (dest, destlen, fmt, sbe->flagged);
1913
+ 		} else if(sbe->flagged == 0) {
1914
+ 			optional = 0;
1915
+ 		}
1916
+ 		break;
1917
+ 
1918
+ 	case '!':
1919
+ 		if(sbe->flagged == 0)
1920
+ 			mutt_format_s(dest, destlen, prefix, "");
1921
+ 		if(sbe->flagged == 1)
1922
+ 			mutt_format_s(dest, destlen, prefix, "!");
1923
+ 		if(sbe->flagged == 2)
1924
+ 			mutt_format_s(dest, destlen, prefix, "!!");
1925
+ 		if(sbe->flagged > 2) {
1926
+ 			snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
1927
+ 			mutt_format_s(dest, destlen, prefix, buf);
1928
+ 		}
1929
+ 		break;
1930
+ 
1931
+ 	case 'S':
1932
+ 		snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1933
+ 		snprintf (dest, destlen, fmt, sbe->size);
1934
+ 		break;
1935
+ 
1936
+ 	case 'N':
1937
+ 		if(!optional) {
1938
+ 			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1939
+ 			snprintf (dest, destlen, fmt, sbe->new);
1940
+ 		} else if(sbe->new == 0) {
1941
+ 			optional = 0;
1942
+ 		}
1943
+ 		break;
1944
+ 
1945
+ 	case 'B':
1946
+ 		mutt_format_s(dest, destlen, prefix, sbe->box);
1947
+ 		break;
1948
+ 	}
1949
+ 
1950
+ 	if(optional)
1951
+ 		mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
1952
+ 	else if (flags & M_FORMAT_OPTIONAL)
1953
+ 		mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
1954
+ 
1955
+ 	return (src);
1956
+ }
1957
+ 
1958
+ char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
1959
+     static char *entry = 0;
1960
+     struct sidebar_entry sbe;
1961
+     int SBvisual;
1962
+ 
1963
+     SBvisual = SidebarWidth - strlen(SidebarDelim);
1964
+     if (SBvisual < 1)
1965
+         return NULL;
1966
+ 
1967
+     sbe.new = new;
1968
+     sbe.flagged = flagged;
1969
+     sbe.size = size;
1970
+     strncpy(sbe.box, box, 31);
1971
+ 
1972
+     safe_realloc(&entry, SBvisual + 2);
1973
+     entry[SBvisual + 1] = '\0';
1974
+ 
1975
+     mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
1976
+ 
1977
+     return entry;
1978
+ }
1979
+ 
1980
+ void set_curbuffy(char buf[LONG_STRING])
1981
+ {
1982
+   BUFFY* tmp = CurBuffy = Incoming;
1983
+ 
1984
+   if (!Incoming)
1985
+     return;
1986
+ 
1987
+   while(1) {
1988
+     if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
1989
+       CurBuffy = tmp;
1990
+       break;
1991
+     }
1992
+ 
1993
+     if(tmp->next)
1994
+       tmp = tmp->next;
1995
+     else
1996
+       break;
1997
+   }
1998
+ }
1999
+ 
2000
+ int draw_sidebar(int menu) {
2001
+