in ronly mode, handle cards anyway

This commit is contained in:
Jan-Piet Mens
2015-10-21 16:51:46 +02:00
parent 835e37cc97
commit e3ded0df48

View File

@@ -503,26 +503,6 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
return;
}
#ifdef WITH_RONLY
/*
* If we cannot find `r' in the JSON, or if `r' isn't true,
* abort.
*/
if ((j = json_find_member(json, "r")) == NULL) {
// printf("Ignoring publish: no `r'\n");
json_delete(json);
return;
}
if ((j->tag != JSON_BOOL) || (j->bool_ == FALSE)) {
// printf("Ignoring publish: `r' is false\n");
json_delete(json);
return;
}
#endif
_type = T_UNKNOWN;
if ((j = json_find_member(json, "_type")) != NULL) {
if (j->tag == JSON_STRING) {
@@ -571,6 +551,25 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
goto cleanup;
}
#ifdef WITH_RONLY
/*
* If we cannot find `r' in the JSON, or if `r' isn't true,
* abort. This happens here so that we can still capture
* info and cards &c.
*/
if ((j = json_find_member(json, "r")) == NULL) {
// printf("Ignoring publish: no `r'\n");
goto cleanup;
}
if ((j->tag != JSON_BOOL) || (j->bool_ == FALSE)) {
// printf("Ignoring publish: `r' is false\n");
goto cleanup;
}
#endif
/*
* We are now handling location-related JSON. Normalize tst, lat, lon
* to numbers, particularly for Greenwich which produces strings