forge
Explore
Log in

Don't you dare go Hollow

yumush

Clone
★ 0

0 watching0 forksRustAGPL-3.06.8 MiB27ceb05Tahinli8 hours ago399 commits

event.rs114 lines, 2.2 KiBHistoryRawDownload
1use bitcode::{Decode, Encode};
2
3use crate::model::{
4 Community, Friends, Id, Invitation, Member, Message, Presence, Rank, Sanction, ServerSettings,
5 User,
6};
7use crate::share::{Kind, Layer, Share};
8use crate::stats::Stats;
9
10#[derive(Debug, Clone, Encode, Decode)]
11pub enum Event {
12 MessageCreated(Message),
13 MessageUpdated(Message),
14 MyVotes {
15 message_id: Id,
16 positions: Vec<u32>,
17 },
18 MessagesDeleted {
19 community_id: Id,
20 ids: Vec<Id>,
21 },
22 MemberJoined {
23 community_id: Id,
24 member: Member,
25 },
26 MemberLeft {
27 community_id: Id,
28 user_id: Id,
29 },
30 RankChanged {
31 community_id: Id,
32 user_id: Id,
33 rank: Rank,
34 },
35 CommunityUpdated(Community),
36 CommunityAdded(Community),
37 Removed {
38 community_id: Id,
39 community_name: String,
40 sanction: Sanction,
41 reason: Option<String>,
42 },
43 FriendsUpdated(Friends),
44 InvitationsUpdated(Vec<Invitation>),
45 CommunityDeleted {
46 community_id: Id,
47 },
48 UserDeleted {
49 user_id: Id,
50 },
51 UserUpdated(User),
52 PresenceChanged {
53 user_id: Id,
54 presence: Presence,
55 },
56 VoiceJoined {
57 community_id: Id,
58 user_id: Id,
59 },
60 VoiceLeft {
61 community_id: Id,
62 user_id: Id,
63 },
64 ReportCreated,
65 VoiceMuted {
66 community_id: Option<Id>,
67 user_id: Id,
68 muted: bool,
69 },
70 SettingsUpdated(ServerSettings),
71 Typing {
72 community_id: Id,
73 user_id: Id,
74 },
75 ShareStarted {
76 community_id: Id,
77 share: Share,
78 },
79 ShareStopped {
80 community_id: Id,
81 user_id: Id,
82 kind: Kind,
83 },
84 StatsWanted(bool),
85 StatsOf {
86 user_id: Id,
87 stats: Stats,
88 },
89 Release,
90}
91
92#[derive(Debug, Clone, Encode, Decode)]
93pub enum Media {
94 Layers {
95 kind: Kind,
96 layers: Vec<Layer>,
97 },
98 Keyframe {
99 kind: Kind,
100 layer: Layer,
101 recover: bool,
102 },
103 Loss {
104 kind: Kind,
105 permille: u16,
106 },
107 VoiceEnded,
108}
109
110#[derive(Debug, Clone, Encode, Decode)]
111pub enum Down {
112 Event(Box<Event>),
113 Media(Media),
114}