mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
api(deltachat-rpc-client): add Account.bring_online()
This commit is contained in:
@@ -87,6 +87,14 @@ class Account:
|
|||||||
"""Configure an account."""
|
"""Configure an account."""
|
||||||
yield self._rpc.configure.future(self.id)
|
yield self._rpc.configure.future(self.id)
|
||||||
|
|
||||||
|
def bring_online(self):
|
||||||
|
"""Start I/O and wait until IMAP becomes IDLE."""
|
||||||
|
self.start_io()
|
||||||
|
while True:
|
||||||
|
event = self.wait_for_event()
|
||||||
|
if event.kind == EventType.IMAP_INBOX_IDLE:
|
||||||
|
break
|
||||||
|
|
||||||
def create_contact(self, obj: Union[int, str, Contact], name: Optional[str] = None) -> Contact:
|
def create_contact(self, obj: Union[int, str, Contact], name: Optional[str] = None) -> Contact:
|
||||||
"""Create a new Contact or return an existing one.
|
"""Create a new Contact or return an existing one.
|
||||||
|
|
||||||
|
|||||||
@@ -54,11 +54,7 @@ class ACFactory:
|
|||||||
@futuremethod
|
@futuremethod
|
||||||
def get_online_account(self):
|
def get_online_account(self):
|
||||||
account = yield self.new_configured_account.future()
|
account = yield self.new_configured_account.future()
|
||||||
account.start_io()
|
account.bring_online()
|
||||||
while True:
|
|
||||||
event = account.wait_for_event()
|
|
||||||
if event.kind == EventType.IMAP_INBOX_IDLE:
|
|
||||||
break
|
|
||||||
return account
|
return account
|
||||||
|
|
||||||
def get_online_accounts(self, num: int) -> List[Account]:
|
def get_online_accounts(self, num: int) -> List[Account]:
|
||||||
|
|||||||
Reference in New Issue
Block a user