diff --git a/test/minimail.py b/test/minimail.py index 354ca4c..e02dc69 100644 --- a/test/minimail.py +++ b/test/minimail.py @@ -19,6 +19,7 @@ delete the marker file to re-read all messages # this file is under GNU General Public License 3.0 +import os from secrets import token_urlsafe from time import sleep @@ -78,12 +79,18 @@ def recv_all(inbox, marker): r = [] while not r: with Lock(inbox): + newest = 0 for p in reversed([ path for path in inbox.glob("*.eml") ]): if newer(p, inbox / marker): with open(p, "rb") as f: t = f.read(-1) r.append((p, t)) + t = p.stat().st_mtime + if t > newest: + newest = t (inbox / marker).touch(exist_ok=True) + os.utime(str(inbox / marker), (newest, newest)) + if not r: sleep(1) diff --git a/test/sync_handshake.py b/test/sync_handshake.py index bea16dd..287fc0d 100644 --- a/test/sync_handshake.py +++ b/test/sync_handshake.py @@ -53,13 +53,13 @@ def print_msg(p): elif p.name[:6] == "Laptop": color = "green" else: - color = None + color = "lightblue" with open(p, "r") as f: t = f.read(-1) msg = pEp.Message(t) print("\n" + colored(p.name, color)) print(colored(str(datetime.fromtimestamp(p.stat().st_mtime)), color)) - m = re.search("(.*)", msg.opt_fields["pEp.sync"].replace("\n", " ")) + m = re.search("(.*)", msg.opt_fields["pEp.sync"].replace("\n", " ")) if m: if etree: tree = objectify.fromstring(m.group(1).replace("\r", ""))