Browse Source

fix bug in minimail

master
Volker Birk 6 years ago
parent
commit
d6346a6b9c
  1. 7
      test/minimail.py
  2. 4
      test/sync_handshake.py

7
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)

4
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("<payload>(.*)</payload>", msg.opt_fields["pEp.sync"].replace("\n", " "))
m = re.search("<keysync>(.*)</keysync>", msg.opt_fields["pEp.sync"].replace("\n", " "))
if m:
if etree:
tree = objectify.fromstring(m.group(1).replace("\r", ""))

Loading…
Cancel
Save