Wire notification platform dependencies and event diagnostics

This commit is contained in:
evgeny committed 2026-10-07 15:55:39 +02:00
1 parent 33c98a014f
commit f2e35da1fe
3 files changed
+46 -2

No files matched your search

+7 -2
View File
@@ -208,10 +208,15 @@ static void hc_on_chat_event(struct UTUN_INSTANCE* inst, int type, const uint8_t
for (unsigned i = 0; i < 32; i++) snprintf(message_id + i * 2, 3, "%02x", data[1 + cl + i]);
snprintf(json, sizeof(json), "{\"event\":\"feedback\",\"ch\":\"%.*s\",\"message_id\":\"%s\",\"kind\":%u}",
(int)cl, data + 1, message_id, data[33 + cl]);
} else if (type == 1 && data && len >= 10) { /* MSG_RECEIVED */
} else if (type == CHAT_EVT_MSG_RECEIVED) {
if (!data || len < 11 || !data[0] || len != data[0] + 10 || data[9 + data[0]] > 1) {
DEBUG_WARN(DEBUG_CATEGORY_CONTROL, "headless: invalid MSG_RECEIVED length=%d", len);
return;
}
uint8_t cl = data[0];
uint64_t author; memcpy(&author, data + 1 + cl, 8);
snprintf(json, sizeof(json), "{\"event\":\"msg\",\"ch\":\"%.*s\",\"author_id\":\"0x%016llx\"}", (int)cl, data + 1, (unsigned long long)author);
snprintf(json, sizeof(json), "{\"event\":\"msg\",\"ch\":\"%.*s\",\"author_id\":\"0x%016llx\",\"initial_sync\":%u}",
(int)cl, data + 1, (unsigned long long)author, data[9 + cl]);
} else if (type == 5 && data && len >= 2) { /* MEMBERS_CHANGED */
uint8_t cl = data[0];
snprintf(json, sizeof(json), "{\"event\":\"members_changed\",\"ch\":\"%.*s\"}", (int)cl, data + 1);