ensure payload is written to REC even if not location

This commit is contained in:
Jan-Piet Mens 2015-08-15 09:04:50 +02:00
parent 78ff4b41bb
commit 7fd3161c2f

View File

@ -442,9 +442,16 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
/* Is it OwnTracks Greenwich CSV? */
if ((json = csv(m->payload, tid, t, &lat, &lon, &tst)) == NULL) {
/* It's not JSON or it's not a location CSV; store it */
if ((fp = pathn("a", "rec", username, device, "rec")) != NULL) {
fprintf(fp, RECFORMAT, isotime(now),
utstring_body(rest),
bindump(m->payload, m->payloadlen));
fclose(fp);
}
return;
}
fprintf(stderr, "+++++ %s\n", json_stringify(json, NULL));
// fprintf(stderr, "+++++ %s\n", json_stringify(json, NULL));
}
#if 0