From 00311f58dc5c07cdbda3b4c2d4f0c9a1968f4005 Mon Sep 17 00:00:00 2001 From: LDA Date: Sun, 9 Jun 2024 02:13:49 +0200 Subject: [PATCH] [WIP] Start making bare-bones /sync reply schema. --- Schema/SyncResponse.json | 105 +++++++++++++++++++++++++++++++++++++++ src/Room.c | 4 +- 2 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 Schema/SyncResponse.json diff --git a/Schema/SyncResponse.json b/Schema/SyncResponse.json new file mode 100644 index 0000000..a75f712 --- /dev/null +++ b/Schema/SyncResponse.json @@ -0,0 +1,105 @@ +{ + "guard": "TELODENDRIA_SCHEMA_SYNCRESPONSE_H", + "header": "Schema\/SyncResponse.h", + "types": { + "Event": { + "fields": { + "content": { + "type": "object", + "required": true + }, + "type": { + "type": "string", + "required": true + } + }, + "type": "struct" + }, + "AccountData": { + "fields": { + "events": { "type": "[Event]" } + }, + "type": "struct" + }, + "StrippedStateEvent": { + "fields": { + "events": { "type": "[Event]" } + }, + "type": "struct" + }, + "InviteState": { + "fields": { + "content": { + "type": "object", + "required": true + }, + "sender": { + "type": "string", + "required": true + }, + "state_key": { + "type": "string", + "required": true + }, + "type": { + "type": "string", + "required": true + } + }, + "type": "struct" + }, + "InvitedRooms": { + "fields": { + "invite_state": { "type": "InviteState" } + }, + "type": "struct" + }, + "ClientEventWithoutRoomID": { + "fields": { + "content": { "type": "object", "required": true }, + "event_id": { "type": "string", "required": true }, + "origin_server_ts": { "type": "integer", "required": true }, + "sender": { "type": "string", "required": true }, + "state_key": { "type": "string" }, + "type": { "type": "string", "required": true } + }, + "type": "struct" + }, + "Timeline": { + "fields": { + "events": { "type": "[ClientEventWithoutRoomID]", "required": true }, + "limited": { "type": "boolean" }, + "prev_batch": { "type": "string" } + }, + "type": "struct" + }, + "JoinedRooms": { + "fields": { + "timeline": { "type": "Timeline" } + }, + "type": "struct" + }, + "Rooms": { + "fields": { + "invite": { "type": "InvitedRooms" }, + "join": { "type": "JoinedRooms" } + }, + "type": "struct" + }, + "SyncResponse": { + "fields": { + "next_batch": { + "type": "string", + "required": true + }, + "account_data": { + "type": "AccountData" + }, + "rooms": { + "type": "Rooms" + } + }, + "type": "struct" + } + } +} diff --git a/src/Room.c b/src/Room.c index 6766773..87d9056 100644 --- a/src/Room.c +++ b/src/Room.c @@ -1812,9 +1812,7 @@ RoomAddEventV1(Room *room, PduV1 pdu) DbUnlock(room->db, event_ref); - /* TODO: Store DAG relationships, somehow. - * Also keep track of PDU depth. */ - + /* TODO: Store DAG relationships, somehow. */ pdu_json = PduV1ToJson(&pdu); { CommonID *sid= UserIdParse(pdu.sender, NULL);