mirror of
https://github.com/owntracks/recorder.git
synced 2026-05-07 02:46:36 +00:00
in ronly mode, handle cards anyway
This commit is contained in:
39
recorder.c
39
recorder.c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user