From: markus schnalke Date: Wed, 4 Jan 2012 13:49:09 +0000 (+0100) Subject: Inverted the second arg of seq_setunseen(), to be more natural. X-Git-Tag: mmh-thesis-end~429 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=a7771fd2e83d64228fb675749fc936151249dbd3;p=mmh Inverted the second arg of seq_setunseen(), to be more natural. --- 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",