From 72bc9f0ae467f4fd71fed02826190163d5837c1f Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 6 Dec 2025 04:21:31 +0000 Subject: [PATCH] api(rpc-client): accept Account for Chat.{add,remove}_contact() --- .../src/deltachat_rpc_client/chat.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/chat.py b/deltachat-rpc-client/src/deltachat_rpc_client/chat.py index 82b104bd7..dbfea9269 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/chat.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/chat.py @@ -219,10 +219,12 @@ class Chat: """Mark all messages in this chat as noticed.""" self._rpc.marknoticed_chat(self.account.id, self.id) - def add_contact(self, *contact: Union[int, str, Contact]) -> None: + def add_contact(self, *contact: Union[int, str, Contact, "Account"]) -> None: """Add contacts to this group.""" + from .account import Account + for cnt in contact: - if isinstance(cnt, str): + if isinstance(cnt, (str, Account)): contact_id = self.account.create_contact(cnt).id elif not isinstance(cnt, int): contact_id = cnt.id @@ -230,10 +232,12 @@ class Chat: contact_id = cnt self._rpc.add_contact_to_chat(self.account.id, self.id, contact_id) - def remove_contact(self, *contact: Union[int, str, Contact]) -> None: + def remove_contact(self, *contact: Union[int, str, Contact, "Account"]) -> None: """Remove members from this group.""" + from .account import Account + for cnt in contact: - if isinstance(cnt, str): + if isinstance(cnt, (str, Account)): contact_id = self.account.create_contact(cnt).id elif not isinstance(cnt, int): contact_id = cnt.id