new recorder option --norec

This commit is contained in:
Jan-Piet Mens
2015-10-23 17:03:19 +02:00
parent 2d49bddf9b
commit 8930e401fc
3 changed files with 15 additions and 0 deletions

View File

@@ -284,6 +284,11 @@ Note in particular the `--hosted` option: you specify neither a host name or a p
When the recorder has received a publish or two, visit it with your favorite Web browser by pointing your browser at `http://127.0.0.1:8083`.
### Recorder options
`--norec` disables writing of REC files, so no location history or other similar publishes are stored, and the Lua `otr_putrec()` function is not invoked even if it exists. What is stored are CARDS and PHOTOS, as well as the LAST location of a device. As such, the API's `/locations` endpoint becomes useless.
## Design decisions
We took a number of decisions for the design of the recorder and its utilities:

View File

@@ -306,6 +306,9 @@ static void putrec(struct udata *ud, time_t now, UT_string *reltopic, UT_string
FILE *fp;
int rc = 0;
if (ud->norec)
return;
#ifdef WITH_LUA
rc = hooks_norec(ud, UB(username), UB(device), string);
#endif
@@ -1002,6 +1005,7 @@ void usage(char *prog)
#endif
printf(" --precision ghash precision (dflt: %d)\n", GHASHPREC);
printf(" --hosted use OwnTracks Hosted\n");
printf(" --norec don't maintain REC files\n");
printf("\n");
printf("Options override these environment variables:\n");
printf(" $OTR_HOST MQTT hostname\n");
@@ -1045,6 +1049,7 @@ int main(int argc, char **argv)
udata.skipdemo = TRUE;
udata.revgeo = TRUE;
udata.verbose = TRUE;
udata.norec = FALSE;
#ifdef WITH_LMDB
udata.gc = NULL;
udata.t2t = NULL; /* Topic to TID */
@@ -1100,6 +1105,7 @@ int main(int argc, char **argv)
{ "quiet", no_argument, 0, 8},
{ "initialize", no_argument, 0, 9},
{ "label", required_argument, 0, 10},
{ "norec", no_argument, 0, 11},
#ifdef WITH_LUA
{ "lua-script", required_argument, 0, 7},
#endif
@@ -1117,6 +1123,9 @@ int main(int argc, char **argv)
break;
switch (ch) {
case 11:
udata.norec = TRUE;
break;
case 10:
free(udata.label);
udata.label = strdup(optarg);

View File

@@ -19,6 +19,7 @@ struct udata {
int revgeo; /* True (default) if we should do reverse Geo lookups */
int qos; /* Subscribe QoS */
int verbose; /* TRUE if print verbose messages to stdout */
int norec; /* If TRUE, no .REC files are written to */
#ifdef WITH_LMDB
struct gcache *gc;
struct gcache *t2t; /* topic to tid */