MCPcopy Create free account
hub / github.com/chatmail/core / init_imap

Method init_imap

python/src/deltachat/testplugin.py:364–381  ·  view source on GitHub ↗

initialize direct_imap and cleanup server state.

(self, acc)

Source from the content-addressed store, hash-verified

362 acc.add_account_plugin(logger, name="logger-" + acc._logid)
363
364 def init_imap(self, acc):
365 """initialize direct_imap and cleanup server state."""
366 from deltachat.direct_imap import DirectImap
367
368 assert acc.is_configured()
369 if not hasattr(acc, "direct_imap"):
370 acc.direct_imap = DirectImap(acc)
371 addr = acc.get_config("addr")
372 if addr not in self._imap_cleaned:
373 imap = acc.direct_imap
374 for folder in imap.list_folders():
375 if folder.lower() == "inbox" or folder.lower() == "deltachat":
376 assert imap.select_folder(folder)
377 imap.delete("1:*", expunge=True)
378 else:
379 imap.conn.folder.delete(folder)
380 acc.log(f"imap cleaned for addr {addr}")
381 self._imap_cleaned.add(addr)
382
383
384class ACFactory:

Callers 2

wait_one_configuredMethod · 0.95
_onconfigure_start_ioMethod · 0.95

Calls 7

DirectImapClass · 0.90
is_configuredMethod · 0.45
get_configMethod · 0.45
list_foldersMethod · 0.45
select_folderMethod · 0.45
deleteMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected