.RE
.PP
.BR Unseen\-Sequence :
-unseen
+u
.RS 5
-Names the sequence or sequences which should be defined as those
-messages which are unread. The commands
+Names the sequence or sequences which shall contain any unread messages.
+The commands
.BR inc ,
.BR rcvstore ,
.BR mhshow ,
and
.B show
will add or remove messages from these
-sequences when they are incorporated or read. If not present or
-empty, no such sequences are defined. Otherwise, each message is
+sequences when they are incorporated or read. If defined with an empty
+value, no such sequences are defined. Otherwise, each message is
added to, or removed from, each sequence name given. Read the
.BR mh\-sequence (7)
man page for the details about this sequence.
-(profile, no default)
+(profile, default: u)
.RE
.PP
.BR Mh\-Sequences :
file.
.SS "The Unseen Sequence"
-Finally, many users like to indicate which messages have not been
-previously seen by them. The commands
+Finally, the unseen sequence indicates which messages have not been
+previously seen by the user.
+The commands
.BR inc ,
.BR rcvstore ,
.BR show ,
.BR mhshow ,
and
.B flist
-honor the profile entry
-\*(lqUnseen\-Sequence\*(rq to support this activity. This entry
-in the
-.I .mmh/profile
-should be defined as one or more sequence
-names separated by spaces. If there is a value for
-\*(lqUnseen\-Sequence\*(rq in the profile, then whenever new messages
-are placed in a folder (using
+honor the sequence.
+Whenever new messages are placed in a folder (using
.B inc
or
.BR rcvstore ),
-the new messages will also be added to all the sequences named in this
-profile entry. For example, a profile entry of
-.PP
-.RS 5
-Unseen\-Sequence: unseen
+the new messages will also be added to the unseen sequence.
.RE
.PP
-directs
-.B inc
-to add new messages to the sequence \*(lqunseen\*(rq.
-Unlike the behavior of the \*(lqPrevious\-Sequence\*(rq entry in the
-profile, however, the sequence(s) will
+.BR inc ,
+for example,
+adds new messages to the unseen sequence.
+Unlike the behavior of the previous sequence, however,
+the unseen sequence will
.B not
be zeroed by
.BR inc .
.BR next ,
or
.B prev
-displays a message, that message will be removed from
-any sequences named by the \*(lqUnseen\-Sequence\*(rq entry in the
-profile.
+display a message, that message will be removed from
+the unseen sequence.
+.PP
+The default unseen sequence is named `u'.
+To change, define a \*(lqUnseen\-Sequence\*(rq entry in your profile.
+It may also contain multiple sequence names, separated by spaces.
+In this case, anything that applied to a single unseen sequence,
+applies to multiple ones, too.
+.PP
+The unseen sequence mechanism is automatically activated.
+To deactivate it, define the \*(lqUnseen\-Sequence\*(rq entry
+in your profile with an empty value.
+
.SH FILES
.fc ^ ~
void
seq_setunseen(struct msgs *mp, int seen)
{
- int msgnum;
+ int n;
char **ap, *cp, *dp;
/*
*/
if ((cp = context_find(usequence))) {
dp = getcpy(cp);
- if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
- free(dp);
- return;
- }
} else {
+ /* not set in profile, thus use the default */
+ dp = getcpy(seq_unseen);
+ }
+ if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
+ /* contains no sequence name, i.e. we're finished */
+ free(dp);
return;
}
for (; *ap; ap++) {
if (seen) {
/* make sure sequence exists first */
- if (seq_getnum(mp, *ap) != -1)
- for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
- if (is_unseen(mp, msgnum))
- seq_delmsg(mp, *ap, msgnum);
+ if (seq_getnum(mp, *ap) != -1) {
+ for (n = mp->lowsel; n <= mp->hghsel; n++) {
+ if (is_unseen(mp, n)) {
+ seq_delmsg(mp, *ap, n);
+ }
+ }
+ }
} else {
- for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++)
- if (is_unseen(mp, msgnum))
- seq_addmsg(mp, *ap, msgnum, -1, 0);
+ for (n = mp->lowmsg; n <= mp->hghmsg; n++) {
+ if (is_unseen(mp, n)) {
+ seq_addmsg(mp, *ap, n, -1, 0);
+ }
+ }
}
}
nmhdir = toabsdir("+");
/*
- ** If we didn't specify any sequences, we search
- ** for the "Unseen-Sequence" profile entry and use
- ** all the sequences defined there. We check to
- ** make sure that the Unseen-Sequence entry doesn't
- ** contain more than NUMATTRS sequences.
+ ** If no sequences specified, we use the `unseen' sequence(s)
+ ** We check to make sure that the Unseen-Sequence entry doesn't
+ ** contain too many sequences.
*/
if (numsequences == 0) {
- if ((cp = context_find(usequence)) && *cp) {
- char **ap, *dp;
+ char **ap, *dp;
- dp = getcpy(cp);
- ap = brkstring(dp, " ", "\n");
- for (; ap && *ap; ap++) {
- if (numsequences >= NUMATTRS)
- adios(NULL, "too many sequences (more than %d) in %s profile entry", NUMATTRS, usequence);
- else
- sequencesToDo[numsequences++] = *ap;
+ if ((cp = context_find(usequence))) {
+ if (!*cp) {
+ adios(NULL, "profile entry %s set, but empty, and no sequence given", usequence);
}
} else {
- adios(NULL, "no sequence specified or %s profile entry found", usequence);
+ cp = seq_unseen; /* use default */
+ }
+ dp = getcpy(cp);
+ ap = brkstring(dp, " ", "\n");
+ for (; ap && *ap; ap++) {
+ if (numsequences >= NUMATTRS) {
+ adios(NULL, "too many sequences (more than %d) in %s profile entry", NUMATTRS, usequence);
+ } else {
+ sequencesToDo[numsequences++] = *ap;
+ }
}
}
}
if (i == 0) {
+ char *dp;
/* no sequence arguments; use unseen */
- unseen = context_find(usequence);
- if (unseen == NULL || unseen[0] == '\0') {
- adios(NULL, "must specify sequences or set %s", usequence);
+ if ((unseen = context_find(usequence))) {
+ if (!*unseen) {
+ adios(NULL, "profile entry %s set, but empty, and no sequences given", usequence);
+ }
+ } else {
+ unseen = seq_unseen; /* use default */
}
- for (ap = brkstring(unseen, " ", "\n"); *ap; ap++) {
+ dp = getcpy(unseen);
+ for (ap = brkstring(dp, " ", "\n"); *ap; ap++) {
sequences[i++] = *ap;
}
}
context_save(); /* save the context file */
/*
- ** Get the sequence number for each sequence
- ** specified by Unseen-Sequence
+ ** Get the sequence number for each `unseen' sequence
*/
- if ((cp = context_find(usequence)) && *cp) {
+ if (!(cp = context_find(usequence))) {
+ cp = seq_unseen; /* use default, if not set */
+ }
+ if (*cp) {
char **ap, *dp;
dp = getcpy(cp);
ap = brkstring(dp, " ", "\n");
- for (i = 0; ap && *ap; i++, ap++)
+ for (i = 0; ap && *ap; i++, ap++) {
seqnum[i] = seq_getnum(mp, *ap);
-
+ }
num_unseen_seq = i;
- if (dp)
+ if (dp) {
free(dp);
+ }
}
ontty = isatty(fileno(stdout));