If multiple -a options are supplied, then *do* trigger timed reminders

that are in the future.
This commit is contained in:
David F. Skoll
2012-01-12 13:04:53 -05:00
parent c45364fdb3
commit 245cebee56
5 changed files with 54 additions and 12 deletions

View File

@@ -149,10 +149,16 @@ The \fB\-h\fR option ("hush...") suppresses certain warning and information
messages. In particular, if no reminders are triggered, this mode messages. In particular, if no reminders are triggered, this mode
produces no output. produces no output.
.TP .TP
\fB\-a\fR .B \-a
The \fB\-a\fR option causes \fBRemind\fR not to immediately trigger timed The \fB\-a\fR option causes \fBRemind\fR not to immediately
reminders that would also be queued. It also causes \fBRemind\fR not to trigger timed reminders that would also be queued. It also causes
place timed reminders in a calendar. \fBRemind\fR not to place timed reminders in a calendar. If you
supply two or more \fB\-a\fR options, then \fBRemind\fR \fIwill\fR
trigger timed reminders that are in the future, but will not trigger
timed reminders whose time has passed. (Regardless of how many
\fB\-a\fR options you supply, \fBRemind\fR will not include timed
reminders in the calendar if at least one \fB\-a\fR option is used.)
.TP .TP
\fB\-q\fR \fB\-q\fR
The \fB\-q\fR option causes \fBRemind\fR not to queue timed reminders The \fB\-q\fR option causes \fBRemind\fR not to queue timed reminders
@@ -1869,7 +1875,7 @@ If non-zero, then the \fB\-c\fR option was supplied on the command line.
.B $Daemon (read-only) .B $Daemon (read-only)
If the daemon mode \fB\-z\fR was invoked, contains the number of If the daemon mode \fB\-z\fR was invoked, contains the number of
minutes between wakeups. If not running in daemon mode, contains minutes between wakeups. If not running in daemon mode, contains
0. For the MS-DOS version, always contains 0. 0.
.TP .TP
.B $DateSep .B $DateSep
This variable can be set only to "/" or "-". It holds the character This variable can be set only to "/" or "-". It holds the character
@@ -1885,15 +1891,13 @@ from 0 to 9999.
.TP .TP
.B $DontFork (read-only) .B $DontFork (read-only)
If non-zero, then the \fB\-c\fR option was supplied on the command line. If non-zero, then the \fB\-c\fR option was supplied on the command line.
For the MS-DOS version, always contains 1.
.TP .TP
.B $DontTrigAts (read-only) .B $DontTrigAts (read-only)
If non-zero, then the \fB\-a\fR option was supplied on the command line. The number of times that the \fB\-a\fR option was supplied on the
For the MS-DOS version, always contains 0. command line.
.TP .TP
.B $DontQueue (read-only) .B $DontQueue (read-only)
If non-zero, then the \fB\-q\fR option was supplied on the command line. If non-zero, then the \fB\-q\fR option was supplied on the command line.
For the MS-DOS version, always contains 1.
.TP .TP
.B $EndSent (STRING type) .B $EndSent (STRING type)
Contains a list of characters that end a sentence. The \fBMSF\fR Contains a list of characters that end a sentence. The \fBMSF\fR
@@ -1996,7 +2000,7 @@ If non-zero, then the \fB\-n\fR option was supplied on the command line.
.TP .TP
.B $NumQueued (read-only) .B $NumQueued (read-only)
Contains the number of reminders queued so far for background Contains the number of reminders queued so far for background
timed triggering. For MS-DOS, always returns 0. timed triggering.
.TP .TP
.B $NumTrig (read-only) .B $NumTrig (read-only)
Contains the number of reminders triggered for the current date. One Contains the number of reminders triggered for the current date. One

View File

@@ -924,7 +924,17 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err)
/* Don't trigger timed reminders if DontIssueAts is true, and if the /* Don't trigger timed reminders if DontIssueAts is true, and if the
reminder is for today */ reminder is for today */
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0; if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) {
if (DontIssueAts > 1) {
/* If two or more -a options, then *DO* issue ats that are in the
future */
if (tim->ttime < SystemTime(0) / 60) {
return 0;
}
} else {
return 0;
}
}
/* Don't trigger "old" timed reminders */ /* Don't trigger "old" timed reminders */
/*** REMOVED... /*** REMOVED...

View File

@@ -317,7 +317,7 @@ void InitRemind(int argc, char const *argv[])
case 'a': case 'a':
case 'A': case 'A':
DontIssueAts = 1; DontIssueAts++;
break; break;
case 'q': case 'q':

View File

@@ -83,6 +83,22 @@ rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
../src/remind -p12 ../tests/sun.rem 1 Jan 2011 >> ../tests/test.out 2>&1 ../src/remind -p12 ../tests/sun.rem 1 Jan 2011 >> ../tests/test.out 2>&1
# Test -a vs -aa
../src/remind -q -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up
REM 1 Jan 2012 AT 9:00 MSG 9am: Should not show up
REM 1 Jan 2012 AT 10:00 MSG 10am: Should not show up
MSG [$DontTrigAts]
EOF
../src/remind -q -a -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up
REM 1 Jan 2012 AT 9:00 MSG 9am: Should show up
REM 1 Jan 2012 AT 10:00 MSG 10am: Should show up
MSG [$DontTrigAts]
EOF
cmp -s ../tests/test.out ../tests/test.cmp cmp -s ../tests/test.out ../tests/test.cmp
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
echo "Remind: Acceptance test PASSED" echo "Remind: Acceptance test PASSED"

View File

@@ -5013,3 +5013,15 @@ January 31
2011/12/31 * * * * Sunset: 16:30 2011/12/31 * * * * Sunset: 16:30
2011/12/31 * * * * Dusk: 17:05 2011/12/31 * * * * Dusk: 17:05
# rem2ps end # rem2ps end
Reminders for Sunday, 1st January, 2012:
1
Reminders for Sunday, 1st January, 2012:
9am: Should show up
10am: Should show up
2