add more ser and de impls

This commit is contained in:
dignifiedquire
2020-02-11 23:22:55 +01:00
committed by holger krekel
parent beb91271de
commit 9cc99ffcd6
6 changed files with 491 additions and 513 deletions

View File

@@ -278,8 +278,8 @@ impl Chatlist {
// This is because we may want to display drafts here or stuff as
// "is typing".
// Also, sth. as "No messages" would not work if the summary comes from a message.
let mut ret = Lot::new();
if index >= self.ids.len() {
ret.text2 = Some("ErrBadChatlistIndex".to_string());
return ret;
@@ -321,6 +321,10 @@ impl Chatlist {
ret
}
pub fn get_index_for_id(&self, id: ChatId) -> Option<usize> {
self.ids.iter().position(|(chat_id, _)| chat_id == &id)
}
}
/// Returns the number of archived chats