From a7771fd2e83d64228fb675749fc936151249dbd3 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Wed, 4 Jan 2012 14:49:09 +0100 Subject: [PATCH] Inverted the second arg of seq_setunseen(), to be more natural. --- sbr/seq_setunseen.c | 21 ++++++++++----------- uip/inc.c | 2 +- uip/mhshow.c | 2 +- uip/rcvstore.c | 2 +- uip/show.c | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/sbr/seq_setunseen.c b/sbr/seq_setunseen.c index 2bb09b9..e628393 100644 --- a/sbr/seq_setunseen.c +++ b/sbr/seq_setunseen.c @@ -13,12 +13,11 @@ ** We scan through the folder and act upon all messages ** that are marked with the SELECT_UNSEEN bit. ** -** If seen == 1, delete messages from unseen sequence. -** If seen == 0, add messages to unseen sequence. +** Either add messages to or (if doadd is false) delete messages from +** the unseen sequence(s). */ - void -seq_setunseen(struct msgs *mp, int seen) +seq_setunseen(struct msgs *mp, int doadd) { int n; char **ap, *cp, *dp; @@ -44,7 +43,13 @@ seq_setunseen(struct msgs *mp, int seen) ** bit set to/from each of these sequences. */ for (; *ap; ap++) { - if (seen) { + if (doadd) { + for (n = mp->lowmsg; n <= mp->hghmsg; n++) { + if (is_unseen(mp, n)) { + seq_addmsg(mp, *ap, n, -1, 0); + } + } + } else { /* make sure sequence exists first */ if (seq_getnum(mp, *ap) != -1) { for (n = mp->lowsel; n <= mp->hghsel; n++) { @@ -53,12 +58,6 @@ seq_setunseen(struct msgs *mp, int seen) } } } - } else { - for (n = mp->lowmsg; n <= mp->hghmsg; n++) { - if (is_unseen(mp, n)) { - seq_addmsg(mp, *ap, n, -1, 0); - } - } } } diff --git a/uip/inc.c b/uip/inc.c index f712152..6a756d9 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -527,7 +527,7 @@ main(int argc, char **argv) fclose(in); in = NULL; } - seq_setunseen(mp, 0); /* set the Unseen-Sequence */ + seq_setunseen(mp, 1); /* add new msgs to unseen sequences */ seq_save(mp); /* synchronize sequences */ context_save(); /* save the context file */ done(0); diff --git a/uip/mhshow.c b/uip/mhshow.c index 07a05a9..a090e2e 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -389,7 +389,7 @@ do_cache: set_unseen(mp, msgnum); seq_setprev(mp); /* set the Previous-Sequence */ - seq_setunseen(mp, 1); /* unset the Unseen-Sequence */ + seq_setunseen(mp, 0); /* unset unseen seqs for shown msgs */ if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1), sizeof(*cts)))) diff --git a/uip/rcvstore.c b/uip/rcvstore.c index b934220..ba3cfcc 100644 --- a/uip/rcvstore.c +++ b/uip/rcvstore.c @@ -215,7 +215,7 @@ main(int argc, char **argv) done(1); } - seq_setunseen(mp, 0); /* synchronize any Unseen-Sequence's */ + seq_setunseen(mp, 1); /* add new msgs to unseen sequences */ seq_save(mp); /* synchronize and save message sequences */ folder_free(mp); /* free folder/message structure */ diff --git a/uip/show.c b/uip/show.c index 80d7e6b..f279cde 100644 --- a/uip/show.c +++ b/uip/show.c @@ -237,7 +237,7 @@ usage: set_unseen(mp, msgnum); seq_setprev(mp); /* set the Previous-Sequence */ - seq_setunseen(mp, 1); /* unset the Unseen-Sequence */ + seq_setunseen(mp, 0); /* unset unseen seqs for shown msgs */ if (mp->numsel > MAXARGS - 2) adios(NULL, "more than %d messages for show exec", -- 1.7.10.4