Browse Source

print more

PYADPT-55
Volker Birk 6 years ago
parent
commit
b5c07f0bea
  1. 1
      test/minimail.py
  2. 9
      test/sync_handshake.py

1
test/minimail.py

@ -53,6 +53,7 @@ class Lock:
def send(inbox, msg, marker):
"send msg to inbox in MIME format"
sleep(1)
with Lock(inbox):
name = marker + "_" + token_urlsafe(16) + ".eml"
with open(inbox / name, "wb") as f:

9
test/sync_handshake.py

@ -48,6 +48,7 @@ SYNC_HANDSHAKE_REJECTED = 1
def print_msg(p):
if isinstance(p, pathlib.Path):
if p.name[:5] == "Phone":
color = "red"
elif p.name[:6] == "Laptop":
@ -59,6 +60,12 @@ def print_msg(p):
msg = pEp.Message(t)
print("\n" + colored(p.name, color))
print(colored(str(datetime.fromtimestamp(p.stat().st_mtime)), color))
elif isinstance(p, pEp.Message):
msg = p
else:
raise TypeError("print_msg(): pathlib.Path and pEp.Message supported, but "
+ str(type(p)) + " delivered")
m = re.search("<keysync>(.*)</keysync>", msg.opt_fields["pEp.sync"].replace("\n", " "))
if m:
if etree:
@ -113,6 +120,8 @@ def run(name, color=None):
l = minimail.recv_all(inbox, name)
for n, m in l:
msg = pEp.Message(m)
print(colored("*** Reading", color))
print_msg(msg)
msg2, keys, rating, flags = msg.decrypt()
except KeyboardInterrupt:

Loading…
Cancel
Save