diff --git a/lacre/core.py b/lacre/core.py index 6d68f05..934876a 100644 --- a/lacre/core.py +++ b/lacre/core.py @@ -28,7 +28,7 @@ import copy import email import email.message import email.utils -from email.policy import SMTP +from email.policy import SMTPUTF8 import GnuPG import os import smtplib @@ -124,7 +124,7 @@ def _gpg_encrypt_copy(message, cmdline, to, encrypt_f): def _gpg_encrypt_to_bytes(message, cmdline, to, encrypt_f) -> bytes: msg_copy = _gpg_encrypt_copy(message, cmdline, to, encrypt_f) - return msg_copy.as_bytes(policy=SMTP) + return msg_copy.as_bytes(policy=SMTPUTF8) def _gpg_encrypt_to_str(message, cmdline, to, encrypt_f) -> str: diff --git a/lacre/keyring.py b/lacre/keyring.py index eb158ff..03c09ef 100644 --- a/lacre/keyring.py +++ b/lacre/keyring.py @@ -102,9 +102,14 @@ class KeyRing: async def _load(self): last_mod = self._read_mod_time() + LOG.debug(f'Keyring was last modified: {last_mod}') if self._is_modified(last_mod): + LOG.debug('Keyring has been modified') async with self._sema: + LOG.debug('About to re-load the keyring') self.replace_keyring(self._load_keyring_from(self._path)) + else: + LOG.debug('Keyring not modified recently, continuing') self._last_mod = self._read_mod_time() diff --git a/lacre/mailop.py b/lacre/mailop.py index 3a3be51..7eff347 100644 --- a/lacre/mailop.py +++ b/lacre/mailop.py @@ -16,7 +16,7 @@ There are 3 operations available: import logging import lacre.core as core from email.message import Message -from email.policy import SMTP +from email.policy import SMTP, SMTPUTF8 LOG = logging.getLogger(__name__) @@ -124,7 +124,7 @@ class KeepIntact(MailOperation): def perform(self, message: Message) -> bytes: """Return MESSAGE unmodified.""" - return message.as_bytes(policy=SMTP) + return message.as_bytes(policy=SMTPUTF8) def __repr__(self): """Return representation with just method and email."""