Line data Source code
1 : /* 2 : * Famedly Matrix SDK 3 : * Copyright (C) 2019, 2020, 2021 Famedly GmbH 4 : * 5 : * This program is free software: you can redistribute it and/or modify 6 : * it under the terms of the GNU Affero General Public License as 7 : * published by the Free Software Foundation, either version 3 of the 8 : * License, or (at your option) any later version. 9 : * 10 : * This program is distributed in the hope that it will be useful, 11 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 : * GNU Affero General Public License for more details. 14 : * 15 : * You should have received a copy of the GNU Affero General Public License 16 : * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 : */ 18 : 19 : enum EventUpdateType { 20 : /// Newly received events from /sync 21 : timeline, 22 : 23 : /// A state update not visible in the timeline currently 24 : state, 25 : 26 : /// Messages that have been fetched when requesting past history 27 : history, 28 : 29 : /// The state of an invite 30 : inviteState, 31 : 32 : /// Events that came down timeline, but we only received the keys for it later so we send a second update for them in the decrypted state 33 : decryptedTimelineQueue, 34 : } 35 : 36 : /// Represents a new event (e.g. a message in a room) or an update for an 37 : /// already known event. 38 : class EventUpdate { 39 : /// Usually 'timeline', 'state' or whatever. 40 : final EventUpdateType type; 41 : 42 : /// Most events belong to a room. If not, this equals to eventType. 43 : final String roomID; 44 : 45 : // The json payload of the content of this event. 46 : final Map<String, dynamic> content; 47 : 48 38 : EventUpdate({ 49 : required this.roomID, 50 : required this.type, 51 : required this.content, 52 : }); 53 : }