Fix mark as read
This commit is contained in:
parent
f642297868
commit
0250ce45f4
1 changed files with 5 additions and 2 deletions
|
@ -73,12 +73,16 @@ class RemoveDuplicateImapMessages:
|
||||||
if typ != 'OK':
|
if typ != 'OK':
|
||||||
self._log.error('Error, server replied: %s', data)
|
self._log.error('Error, server replied: %s', data)
|
||||||
return False
|
return False
|
||||||
|
typ, unseen_data = self.imap.store(message_id, '-FLAGS', '\Seen')
|
||||||
|
self._log.debug('Response: %s', typ)
|
||||||
|
if typ != 'OK':
|
||||||
|
self._log.error('Error, server replied: %s', unseen_data)
|
||||||
|
return False
|
||||||
self._process_message(message_id, data[0])
|
self._process_message(message_id, data[0])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _process_message(self, message_id, data):
|
def _process_message(self, message_id, data):
|
||||||
'''Process a mail message'''
|
'''Process a mail message'''
|
||||||
# print(data)
|
|
||||||
if isinstance(data[1], int):
|
if isinstance(data[1], int):
|
||||||
self._log.warning(
|
self._log.warning(
|
||||||
"Response part is integer %s in data '%s'. Try again.",
|
"Response part is integer %s in data '%s'. Try again.",
|
||||||
|
@ -88,7 +92,6 @@ class RemoveDuplicateImapMessages:
|
||||||
return False
|
return False
|
||||||
part = data[1].decode('utf-8')
|
part = data[1].decode('utf-8')
|
||||||
message = email.message_from_string(part)
|
message = email.message_from_string(part)
|
||||||
# print(message)
|
|
||||||
hash_obj = hashlib.sha256()
|
hash_obj = hashlib.sha256()
|
||||||
hash_obj.update(message.as_bytes())
|
hash_obj.update(message.as_bytes())
|
||||||
hash_obj.digest()
|
hash_obj.digest()
|
||||||
|
|
Loading…
Reference in a new issue