Store typed timer in ChatEphemeralTimerModified event

This commit is contained in:
Alexander Krotov
2020-07-10 02:55:17 +03:00
parent e5d5009d6a
commit f28a0db7d0
3 changed files with 7 additions and 3 deletions

View File

@@ -401,7 +401,7 @@ pub unsafe extern "C" fn dc_event_get_data2_int(event: *mut dc_event_t) -> libc:
| Event::MsgRead { msg_id, .. } => msg_id.to_u32() as libc::c_int,
Event::SecurejoinInviterProgress { progress, .. }
| Event::SecurejoinJoinerProgress { progress, .. } => *progress as libc::c_int,
Event::ChatEphemeralTimerModified { timer, .. } => *timer as libc::c_int,
Event::ChatEphemeralTimerModified { timer, .. } => timer.to_u32() as libc::c_int,
}
}

View File

@@ -179,7 +179,7 @@ impl ChatId {
context.emit_event(Event::ChatEphemeralTimerModified {
chat_id: self,
timer: timer.to_u32(),
timer,
});
Ok(())
}

View File

@@ -5,6 +5,7 @@ use async_std::sync::{channel, Receiver, Sender, TrySendError};
use strum::EnumProperty;
use crate::chat::ChatId;
use crate::ephemeral::Timer as EphemeralTimer;
use crate::message::MsgId;
#[derive(Debug)]
@@ -197,7 +198,10 @@ pub enum Event {
/// Chat ephemeral timer changed.
#[strum(props(id = "2021"))]
ChatEphemeralTimerModified { chat_id: ChatId, timer: u32 },
ChatEphemeralTimerModified {
chat_id: ChatId,
timer: EphemeralTimer,
},
/// Contact(s) created, renamed, blocked or deleted.
///