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