mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 05:16:28 +03:00
cleanup
This commit is contained in:
@@ -14,23 +14,23 @@ def db_folder_attr(name):
|
|||||||
class ImapConn:
|
class ImapConn:
|
||||||
def __init__(self, account):
|
def __init__(self, account):
|
||||||
self.account = account
|
self.account = account
|
||||||
host = account.get_config("configured_mail_server"),
|
host = account.get_config("configured_mail_server")
|
||||||
user = account.get_config("addr"),
|
user = account.get_config("addr")
|
||||||
pw = account.get_config("mail_pw"))
|
pw = account.get_config("mail_pw")
|
||||||
self.connection = imaplib.IMAP4_SSL(host)
|
self.connection = imaplib.IMAP4_SSL(host)
|
||||||
self.connection.login(user, pw)
|
self.connection.login(user, pw)
|
||||||
self._original_msg_count = {}
|
self._original_msg_count = {}
|
||||||
self.select_folder("INBOX")
|
self.select_folder("INBOX")
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
try:
|
|
||||||
self.connection.logout()
|
|
||||||
except Exception:
|
|
||||||
print("Could not logout direct_imap conn")
|
|
||||||
try:
|
try:
|
||||||
self.connection.close()
|
self.connection.close()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
try:
|
||||||
|
self.connection.logout()
|
||||||
|
except Exception:
|
||||||
|
print("Could not logout direct_imap conn")
|
||||||
|
|
||||||
def select_folder(self, foldername):
|
def select_folder(self, foldername):
|
||||||
status, messages = self.connection.select(foldername)
|
status, messages = self.connection.select(foldername)
|
||||||
|
|||||||
@@ -1505,11 +1505,9 @@ class TestOnlineAccount:
|
|||||||
ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT")
|
ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT")
|
||||||
|
|
||||||
lp.sec("ac2: wait for incoming location message")
|
lp.sec("ac2: wait for incoming location message")
|
||||||
# ac2._evtracker.get_matching("DC_EVENT_INCOMING_MSG") # "enabled-location streaming"
|
|
||||||
|
|
||||||
# currently core emits location changed before event_incoming message
|
# currently core emits location changed before event_incoming message
|
||||||
ac2._evtracker.get_matching("DC_EVENT_LOCATION_CHANGED")
|
ac2._evtracker.get_matching("DC_EVENT_LOCATION_CHANGED")
|
||||||
# ac2._evtracker.get_matching("DC_EVENT_INCOMING_MSG") # text message with location
|
|
||||||
|
|
||||||
locations = chat2.get_locations()
|
locations = chat2.get_locations()
|
||||||
assert len(locations) == 1
|
assert len(locations) == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user