Limit events in sync_events::Presence to PresenceEvents

This commit is contained in:
Jonas Platte 2019-12-31 17:09:15 +01:00
parent d2ae618822
commit 26d7e2f04d
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -5,8 +5,13 @@ use std::collections::HashMap;
use js_int::UInt; use js_int::UInt;
use ruma_api::{ruma_api, Outgoing}; use ruma_api::{ruma_api, Outgoing};
use ruma_events::{ use ruma_events::{
collections::{all, only}, collections::{
stripped, EventResult, all::{RoomEvent, StateEvent},
only::Event as NonRoomEvent,
},
presence::PresenceEvent,
stripped::StrippedState,
EventResult,
}; };
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -182,32 +187,33 @@ pub struct Timeline {
/// `/rooms/{roomId}/messages` endpoint. /// `/rooms/{roomId}/messages` endpoint.
pub prev_batch: String, pub prev_batch: String,
/// A list of events. /// A list of events.
#[wrap_incoming(all::RoomEvent with EventResult)] #[wrap_incoming(RoomEvent with EventResult)]
pub events: Vec<all::RoomEvent>, pub events: Vec<RoomEvent>,
} }
/// State events in the room. /// State events in the room.
#[derive(Clone, Debug, Serialize, Outgoing)] #[derive(Clone, Debug, Serialize, Outgoing)]
pub struct State { pub struct State {
/// A list of state events. /// A list of state events.
#[wrap_incoming(only::StateEvent with EventResult)] #[wrap_incoming(StateEvent with EventResult)]
pub events: Vec<only::StateEvent>, pub events: Vec<StateEvent>,
} }
/// The private data that this user has attached to this room. /// The private data that this user has attached to this room.
#[derive(Clone, Debug, Serialize, Outgoing)] #[derive(Clone, Debug, Serialize, Outgoing)]
pub struct AccountData { pub struct AccountData {
/// A list of events. /// A list of events.
#[wrap_incoming(only::Event with EventResult)] // TODO: Create
pub events: Vec<only::Event>, #[wrap_incoming(NonRoomEvent with EventResult)]
pub events: Vec<NonRoomEvent>,
} }
/// Ephemeral events not recorded in the timeline or state of the room. /// Ephemeral events not recorded in the timeline or state of the room.
#[derive(Clone, Debug, Serialize, Outgoing)] #[derive(Clone, Debug, Serialize, Outgoing)]
pub struct Ephemeral { pub struct Ephemeral {
/// A list of events. /// A list of events.
#[wrap_incoming(only::Event with EventResult)] #[wrap_incoming(NonRoomEvent with EventResult)]
pub events: Vec<only::Event>, pub events: Vec<NonRoomEvent>,
} }
/// Updates to the rooms that the user has been invited to. /// Updates to the rooms that the user has been invited to.
@ -222,14 +228,14 @@ pub struct InvitedRoom {
#[derive(Clone, Debug, Serialize, Outgoing)] #[derive(Clone, Debug, Serialize, Outgoing)]
pub struct InviteState { pub struct InviteState {
/// A list of state events. /// A list of state events.
#[wrap_incoming(stripped::StrippedState with EventResult)] #[wrap_incoming(StrippedState with EventResult)]
pub events: Vec<stripped::StrippedState>, pub events: Vec<StrippedState>,
} }
/// Updates to the presence status of other users. /// Updates to the presence status of other users.
#[derive(Clone, Debug, Serialize, Outgoing)] #[derive(Clone, Debug, Serialize, Outgoing)]
pub struct Presence { pub struct Presence {
/// A list of events. /// A list of events.
#[wrap_incoming(only::Event with EventResult)] #[wrap_incoming(PresenceEvent with EventResult)]
pub events: Vec<only::Event>, pub events: Vec<PresenceEvent>,
} }