rename MutedUntilTimestamp to Until

This commit is contained in:
Simon Laux
2020-02-09 12:01:09 +01:00
parent 5f4274b449
commit 621f1df913
2 changed files with 8 additions and 8 deletions

View File

@@ -1425,7 +1425,7 @@ pub unsafe extern "C" fn dc_set_chat_mute_duration(
let muteDuration = match duration { let muteDuration = match duration {
0 => MuteDuration::NotMuted, 0 => MuteDuration::NotMuted,
-1 => MuteDuration::Forever, -1 => MuteDuration::Forever,
_ => MuteDuration::MutedUntilTimestamp(time() + duration), _ => MuteDuration::Until(time() + duration),
}; };
let ffi_context = &*context; let ffi_context = &*context;
@@ -2535,7 +2535,7 @@ pub unsafe extern "C" fn dc_chat_get_remaining_mute_duration(chat: *mut dc_chat_
match ffi_chat.chat.mute_duration { match ffi_chat.chat.mute_duration {
MuteDuration::NotMuted => 0, MuteDuration::NotMuted => 0,
MuteDuration::Forever => -1, MuteDuration::Forever => -1,
MuteDuration::MutedUntilTimestamp(timestamp) => timestamp - time(), MuteDuration::Until(timestamp) => timestamp - time(),
} }
} }

View File

@@ -691,7 +691,7 @@ impl Chat {
match self.mute_duration { match self.mute_duration {
MuteDuration::NotMuted => false, MuteDuration::NotMuted => false,
MuteDuration::Forever => true, MuteDuration::Forever => true,
MuteDuration::MutedUntilTimestamp(timestamp) => timestamp > time(), MuteDuration::Until(timestamp) => timestamp > time(),
} }
} }
@@ -1921,7 +1921,7 @@ pub fn shall_attach_selfavatar(context: &Context, chat_id: ChatId) -> Result<boo
pub enum MuteDuration { pub enum MuteDuration {
NotMuted, NotMuted,
Forever, Forever,
MutedUntilTimestamp(i64), Until(i64)
} }
impl rusqlite::types::ToSql for MuteDuration { impl rusqlite::types::ToSql for MuteDuration {
@@ -1929,7 +1929,7 @@ impl rusqlite::types::ToSql for MuteDuration {
let duration = match &self { let duration = match &self {
MuteDuration::NotMuted => 0, MuteDuration::NotMuted => 0,
MuteDuration::Forever => -1, MuteDuration::Forever => -1,
MuteDuration::MutedUntilTimestamp(timestamp) => *timestamp as i64, MuteDuration::Until(timestamp) => *timestamp as i64,
}; };
let val = rusqlite::types::Value::Integer(duration as i64); let val = rusqlite::types::Value::Integer(duration as i64);
let out = rusqlite::types::ToSqlOutput::Owned(val); let out = rusqlite::types::ToSqlOutput::Owned(val);
@@ -1949,7 +1949,7 @@ impl rusqlite::types::FromSql for MuteDuration {
if val <= time() { if val <= time() {
MuteDuration::NotMuted MuteDuration::NotMuted
} else { } else {
MuteDuration::MutedUntilTimestamp(val) MuteDuration::Until(val)
} }
} }
} }
@@ -2880,7 +2880,7 @@ mod tests {
set_muted( set_muted(
&t.ctx, &t.ctx,
chat_id, chat_id,
MuteDuration::MutedUntilTimestamp(time() + 3600), MuteDuration::Until(time() + 3600),
) )
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
@@ -2891,7 +2891,7 @@ mod tests {
set_muted( set_muted(
&t.ctx, &t.ctx,
chat_id, chat_id,
MuteDuration::MutedUntilTimestamp(time() - 3600), MuteDuration::Until(time() - 3600),
) )
.unwrap(); .unwrap();
assert_eq!( assert_eq!(