1use super::*;
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
4pub struct ResSendICE {
5 pub error: Option<SendICEError>,
6}
7
8#[derive(Serialize, Deserialize, Debug, Clone)]
9pub struct SendICE {
10 pub user: UserId,
11 pub from: UserId,
12 pub ice: String,
13}
14
15#[derive(Serialize, Deserialize, Debug, Clone)]
16#[serde(tag = "type")]
17pub enum SendICEError {
18 InvalidCallId,
19}
20
21impl CallState {
22 pub fn send_ice(&mut self, req: SendICE) -> Result<(), SendICEError> {
23 let mailbox = self
24 .user_mail
25 .get_mut(&req.user)
26 .ok_or(SendICEError::InvalidCallId)?;
27 mailbox.push(UserMail {
28 ty: UserMailType::IncomingICE,
29 data: req.ice,
30 from: req.from,
31 });
32 Ok(())
33 }
34}