mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Equivalent mutt_buffy, but readable code

Signed-off-by: Aron Griffis <agriffis@n01se.net>

+19 -46
+19 -46
buffy.c
··· 508 508 */ 509 509 void mutt_buffy (char *s, size_t slen) 510 510 { 511 - int count; 512 511 BUFFY *tmp = Incoming; 512 + int pass, found = 0; 513 513 514 514 mutt_expand_path (s, slen); 515 - switch (mutt_buffy_check (0)) 515 + 516 + if (mutt_buffy_check (0)) 516 517 { 517 - case 0: 518 - 519 - *s = '\0'; 520 - break; 521 - 522 - case 1: 523 - 524 - while (tmp && !tmp->new) 525 - tmp = tmp->next; 526 - if (!tmp) 527 - { 528 - *s = '\0'; 529 - mutt_buffy_check (1); /* buffy was wrong - resync things */ 530 - break; 531 - } 532 - mutt_expand_path (tmp->path, sizeof (tmp->path)); 533 - strfcpy (s, tmp->path, slen); 534 - mutt_pretty_mailbox (s, slen); 535 - break; 536 - 537 - default: 538 - 539 - count = 0; 540 - while (count < 3) 541 - { 542 - mutt_expand_path (tmp->path, sizeof (tmp->path)); 543 - if (mutt_strcmp (s, tmp->path) == 0) 544 - count++; 545 - else if (count && tmp->new) 546 - break; 547 - tmp = tmp->next; 548 - if (!tmp) 518 + for (pass = 0; pass < 2; pass++) 519 + for (tmp = Incoming; tmp; tmp = tmp->next) 549 520 { 550 - tmp = Incoming; 551 - count++; 521 + mutt_expand_path (tmp->path, sizeof (tmp->path)); 522 + if ((found || pass) && tmp->new) 523 + { 524 + strfcpy (s, tmp->path, slen); 525 + mutt_pretty_mailbox (s, slen); 526 + return; 527 + } 528 + if (mutt_strcmp (s, tmp->path) == 0) 529 + found = 1; 552 530 } 553 - } 554 - if (count >= 3) 555 - { 556 - *s = '\0'; 557 - mutt_buffy_check (1); /* buffy was wrong - resync things */ 558 - break; 559 - } 560 - strfcpy (s, tmp->path, slen); 561 - mutt_pretty_mailbox (s, slen); 562 - break; 531 + 532 + mutt_buffy_check (1); /* buffy was wrong - resync things */ 563 533 } 534 + 535 + /* no folders with new mail */ 536 + *s = '\0'; 564 537 }