NEW: Add support for OwnTracks Pico by pretending ../pico is a base topic

addresses #205
This commit is contained in:
Jan-Piet Mens
2017-07-19 22:29:43 +02:00
parent 5d432c69a1
commit b8bfa75748
+10
View File
@@ -600,6 +600,16 @@ void handle_message(void *userdata, char *topic, char *payload, size_t payloadle
if (utstring_len(reltopic) == 0)
utstring_printf(reltopic, "-");
/*
* Are we handing ../user/device/pico from OwnTracks Pico / Homie?
* Pretend we have a base-topic publish, so change "/pico" to "*"
*/
if ( (count == (4 + skipslash)) && (strcmp(UB(reltopic), "pico") == 0)) {
utstring_renew(reltopic);
utstring_printf(reltopic, "*");
}
utstring_printf(basetopic, "%s/%s/%s", topics[0 + skipslash], topics[1 + skipslash], topics[2 + skipslash]);
utstring_printf(username, "%s", topics[1 + skipslash]);