Encapsulate TDLib state mutations
This commit is contained in:
@@ -70,14 +70,14 @@ impl ChatClient for TdClient {
|
||||
where
|
||||
F: FnOnce(&mut Vec<ChatInfo>),
|
||||
{
|
||||
updater(self.chats_mut());
|
||||
TdClient::update_chats(self, updater);
|
||||
}
|
||||
|
||||
fn update_folders<F>(&mut self, updater: F)
|
||||
where
|
||||
F: FnOnce(&mut Vec<FolderInfo>),
|
||||
{
|
||||
updater(self.folders_mut());
|
||||
TdClient::update_folders(self, updater);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,18 +204,18 @@ impl MessageClient for TdClient {
|
||||
}
|
||||
|
||||
fn clear_current_chat_messages(&mut self) {
|
||||
self.current_chat_messages_mut().clear()
|
||||
TdClient::clear_current_chat_messages(self)
|
||||
}
|
||||
|
||||
fn set_current_chat_messages(&mut self, messages: Vec<MessageInfo>) {
|
||||
*self.current_chat_messages_mut() = messages;
|
||||
TdClient::set_current_chat_messages(self, messages);
|
||||
}
|
||||
|
||||
fn update_current_chat_messages<F>(&mut self, updater: F)
|
||||
where
|
||||
F: FnOnce(&mut Vec<MessageInfo>),
|
||||
{
|
||||
updater(self.current_chat_messages_mut());
|
||||
TdClient::update_current_chat_messages(self, updater);
|
||||
}
|
||||
|
||||
fn set_current_chat_id(&mut self, chat_id: Option<ChatId>) {
|
||||
@@ -253,7 +253,7 @@ impl UserClient for TdClient {
|
||||
where
|
||||
F: FnOnce(&mut UserCache),
|
||||
{
|
||||
updater(self.user_cache_mut());
|
||||
TdClient::update_user_cache(self, updater);
|
||||
}
|
||||
|
||||
async fn process_pending_user_ids(&mut self) {
|
||||
|
||||
Reference in New Issue
Block a user