use bitcode::{Decode, Encode}; use crate::model::{ Community, Friends, Id, Invitation, Member, Message, Presence, Rank, Sanction, ServerSettings, User, }; use crate::share::{Kind, Layer, Share}; use crate::stats::Stats; #[derive(Debug, Clone, Encode, Decode)] pub enum Event { MessageCreated(Message), MessageUpdated(Message), MyVotes { message_id: Id, positions: Vec, }, MessagesDeleted { community_id: Id, ids: Vec, }, MemberJoined { community_id: Id, member: Member, }, MemberLeft { community_id: Id, user_id: Id, }, RankChanged { community_id: Id, user_id: Id, rank: Rank, }, CommunityUpdated(Community), CommunityAdded(Community), Removed { community_id: Id, community_name: String, sanction: Sanction, reason: Option, }, FriendsUpdated(Friends), InvitationsUpdated(Vec), CommunityDeleted { community_id: Id, }, UserDeleted { user_id: Id, }, UserUpdated(User), PresenceChanged { user_id: Id, presence: Presence, }, VoiceJoined { community_id: Id, user_id: Id, }, VoiceLeft { community_id: Id, user_id: Id, }, ReportCreated, VoiceMuted { community_id: Option, user_id: Id, muted: bool, }, SettingsUpdated(ServerSettings), Typing { community_id: Id, user_id: Id, }, ShareStarted { community_id: Id, share: Share, }, ShareStopped { community_id: Id, user_id: Id, kind: Kind, }, StatsWanted(bool), StatsOf { user_id: Id, stats: Stats, }, Release, Imported { tag: String, result: Result, crate::error::ReleaseProblem>, }, } #[derive(Debug, Clone, Encode, Decode)] pub enum Media { Layers { kind: Kind, layers: Vec, }, Keyframe { kind: Kind, layer: Layer, recover: bool, }, Loss { kind: Kind, permille: u16, }, VoiceEnded, } #[derive(Debug, Clone, Encode, Decode)] pub enum Down { Event(Box), Media(Media), }