mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Implement trigtags()
This commit is contained in:
@@ -1189,7 +1189,8 @@ tags; see their documentation for details.
|
|||||||
.PP
|
.PP
|
||||||
The \fBTAG\fR keyword is followed by a tag consisting of up to
|
The \fBTAG\fR keyword is followed by a tag consisting of up to
|
||||||
48 characters. You can have as many TAG clauses as you like in
|
48 characters. You can have as many TAG clauses as you like in
|
||||||
a given REM statement.
|
a given REM statement. A tag can contain any character except for
|
||||||
|
whitespace and a comma.
|
||||||
.PP
|
.PP
|
||||||
If you supply the \fB\-y\fR option to \fBRemind\fR, then any
|
If you supply the \fB\-y\fR option to \fBRemind\fR, then any
|
||||||
reminder that lacks a \fBTAG\fR will have one synthesized. The
|
reminder that lacks a \fBTAG\fR will have one synthesized. The
|
||||||
@@ -3691,6 +3692,12 @@ returns "30 November 1994 AT 22:00" for EST, which is 5 hours behind UTC.
|
|||||||
The value for your time zone may differ.
|
The value for your time zone may differ.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
.B trigtags()
|
||||||
|
Returns a comma-separated list of the TAGs associated with the most recent
|
||||||
|
\fBREM\fR command that was triggered. Returns the empty string if there
|
||||||
|
were no TAGs. If there are multiple tags, they are each separated by
|
||||||
|
a single comma, not a comma and a space.
|
||||||
|
.TP
|
||||||
.B trigtime()
|
.B trigtime()
|
||||||
Returns the time of the last \fBREM\fR command with an \fBAT\fR
|
Returns the time of the last \fBREM\fR command with an \fBAT\fR
|
||||||
clause. If the last \fBREM\fR did not have an \fBAT\fR clause,
|
clause. If the last \fBREM\fR did not have an \fBAT\fR clause,
|
||||||
|
|||||||
@@ -474,7 +474,12 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
|||||||
case T_Tag:
|
case T_Tag:
|
||||||
r = ParseToken(s, &buf);
|
r = ParseToken(s, &buf);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
|
if (strchr(DBufValue(&buf), ',')) {
|
||||||
|
DBufFree(&buf);
|
||||||
|
return E_PARSE_ERR;
|
||||||
|
}
|
||||||
AppendTag(&(trig->tags), DBufValue(&buf));
|
AppendTag(&(trig->tags), DBufValue(&buf));
|
||||||
|
DBufFree(&buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_Duration:
|
case T_Duration:
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ static int FTrigeventstart (func_info *);
|
|||||||
static int FTrigfrom (func_info *);
|
static int FTrigfrom (func_info *);
|
||||||
static int FTrigger (func_info *);
|
static int FTrigger (func_info *);
|
||||||
static int FTrigpriority (func_info *);
|
static int FTrigpriority (func_info *);
|
||||||
|
static int FTrigtags (func_info *);
|
||||||
static int FTrigrep (func_info *);
|
static int FTrigrep (func_info *);
|
||||||
static int FTrigscanfrom (func_info *);
|
static int FTrigscanfrom (func_info *);
|
||||||
static int FTrigtime (func_info *);
|
static int FTrigtime (func_info *);
|
||||||
@@ -306,6 +307,7 @@ BuiltinFunc Func[] = {
|
|||||||
{ "trigpriority", 0, 0, 0, FTrigpriority },
|
{ "trigpriority", 0, 0, 0, FTrigpriority },
|
||||||
{ "trigrep", 0, 0, 0, FTrigrep },
|
{ "trigrep", 0, 0, 0, FTrigrep },
|
||||||
{ "trigscanfrom", 0, 0, 0, FTrigscanfrom },
|
{ "trigscanfrom", 0, 0, 0, FTrigscanfrom },
|
||||||
|
{ "trigtags", 0, 0, 0, FTrigtags },
|
||||||
{ "trigtime", 0, 0, 0, FTrigtime },
|
{ "trigtime", 0, 0, 0, FTrigtime },
|
||||||
{ "trigtimedelta",0, 0, 0, FTrigtimedelta },
|
{ "trigtimedelta",0, 0, 0, FTrigtimedelta },
|
||||||
{ "trigtimerep", 0, 0, 0, FTrigtimerep },
|
{ "trigtimerep", 0, 0, 0, FTrigtimerep },
|
||||||
@@ -1559,6 +1561,11 @@ static int FTrigrep(func_info *info)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int FTrigtags(func_info *info)
|
||||||
|
{
|
||||||
|
return RetStrVal(DBufValue(&(LastTrigger.tags)), info);
|
||||||
|
}
|
||||||
|
|
||||||
static int FTrigpriority(func_info *info)
|
static int FTrigpriority(func_info *info)
|
||||||
{
|
{
|
||||||
RetVal.type = INT_TYPE;
|
RetVal.type = INT_TYPE;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ int main(int argc, char *argv[])
|
|||||||
ArgV = (char const **) argv;
|
ArgV = (char const **) argv;
|
||||||
|
|
||||||
InitRemind(argc, (char const **) argv);
|
InitRemind(argc, (char const **) argv);
|
||||||
|
DBufInit(&(LastTrigger.tags));
|
||||||
ClearLastTriggers();
|
ClearLastTriggers();
|
||||||
|
|
||||||
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
|
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
|
||||||
@@ -1424,6 +1425,7 @@ ClearLastTriggers(void)
|
|||||||
LastTrigger.warn[0] = 0;
|
LastTrigger.warn[0] = 0;
|
||||||
LastTrigger.omitfunc[0] = 0;
|
LastTrigger.omitfunc[0] = 0;
|
||||||
LastTrigger.passthru[0] = 0;
|
LastTrigger.passthru[0] = 0;
|
||||||
|
DBufFree(&(LastTrigger.tags));
|
||||||
|
|
||||||
LastTimeTrig.ttime = NO_TIME;
|
LastTimeTrig.ttime = NO_TIME;
|
||||||
LastTimeTrig.delta = NO_DELTA;
|
LastTimeTrig.delta = NO_DELTA;
|
||||||
@@ -1444,8 +1446,10 @@ SaveAllTriggerInfo(Trigger const *t, TimeTrig const *tt, int trigdate, int trigt
|
|||||||
void
|
void
|
||||||
SaveLastTrigger(Trigger const *t)
|
SaveLastTrigger(Trigger const *t)
|
||||||
{
|
{
|
||||||
|
DBufFree(&(LastTrigger.tags));
|
||||||
memcpy(&LastTrigger, t, sizeof(LastTrigger));
|
memcpy(&LastTrigger, t, sizeof(LastTrigger));
|
||||||
DBufInit(&(LastTrigger.tags));
|
DBufInit(&(LastTrigger.tags));
|
||||||
|
DBufPuts(&(LastTrigger.tags), DBufValue(&(t->tags)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -233,6 +233,15 @@ REM Wed UNTIL 1991-01-01 MSG Expired
|
|||||||
REM Wed SCANFROM 1991-02-26 MSG SCANFROM
|
REM Wed SCANFROM 1991-02-26 MSG SCANFROM
|
||||||
|
|
||||||
CLEAR-OMIT-CONTEXT
|
CLEAR-OMIT-CONTEXT
|
||||||
|
|
||||||
|
# Test trigtags and tag parsing
|
||||||
|
|
||||||
|
REM tag ill,egal MSG bad tag
|
||||||
|
REM MSG The tags are: [trigtags()]
|
||||||
|
REM TAG foo The tags are: [trigtags()]
|
||||||
|
REM TAG foo TAG bar TAG quux TAG znort TAG cabbage The tags are: [trigtags()]
|
||||||
|
REM MSG The tags are: [trigtags()]
|
||||||
|
|
||||||
# Test ADDOMIT
|
# Test ADDOMIT
|
||||||
|
|
||||||
REM Mon 15 Feb ADDOMIT MSG Family Day
|
REM Mon 15 Feb ADDOMIT MSG Family Day
|
||||||
|
|||||||
Reference in New Issue
Block a user