From ce4f2f699b7992879dea7e3f07c1140f70b2c2b9 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Fri, 23 Oct 2015 08:05:27 +0200 Subject: [PATCH] ronly fix --- recorder.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/recorder.c b/recorder.c index 40482dc..52beaa0 100644 --- a/recorder.c +++ b/recorder.c @@ -599,13 +599,20 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m * This JSON payload might actually belong to an RONLY user * but it doesn't have an `r:true' in it. Determine whether * the basetopic belongs to such a user, and force r_ok - * accordingly. + * accordingly. If this is _type:location it holds the definitive + * truth. */ if (is_ronly(ud, basetopic)) { r_ok = TRUE; // printf("*** forcing TRUE b/c ronlydb (blen=%ld)\n", blen); } + + if ((j = json_find_member(json, "_type")) != NULL) { + if ((j->tag == JSON_STRING) && (strcmp(j->string_, "location") == 0)) { + r_ok = FALSE; + } + } } else { r_ok = TRUE; if ((j->tag != JSON_BOOL) || (j->bool_ == FALSE)) {