From 06518e74ae6ca0a5aca71f4808b2defb058f81e7 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Fri, 22 Mar 2019 10:49:11 +0100 Subject: [PATCH] name files with device name --- src/pEpmodule.hh | 1 + test/minimail.py | 4 ++-- test/sync_handshake.py | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pEpmodule.hh b/src/pEpmodule.hh index 0ff9959..4451dcf 100644 --- a/src/pEpmodule.hh +++ b/src/pEpmodule.hh @@ -8,6 +8,7 @@ namespace pEp { namespace PythonAdapter { + extern string device_name; void _throw_status(PEP_STATUS status); void messageToSend(Message msg); PEP_STATUS _messageToSend(::message *msg); diff --git a/test/minimail.py b/test/minimail.py index 6e57279..8ffd49f 100644 --- a/test/minimail.py +++ b/test/minimail.py @@ -49,11 +49,11 @@ class Lock: lockfile.touch() -def send(inbox, msg): +def send(inbox, msg, marker): "send msg to inbox in MIME format" with Lock(inbox): - name = token_urlsafe(16) + ".eml" + name = marker + "_" + token_urlsafe(16) + ".eml" with open(inbox / name, "wb") as f: f.write(str(msg).encode()) diff --git a/test/sync_handshake.py b/test/sync_handshake.py index f733d37..0c5d176 100644 --- a/test/sync_handshake.py +++ b/test/sync_handshake.py @@ -24,7 +24,7 @@ import minimail inbox = pathlib.Path("..") / "TestInbox" -device = "" +device_name = "" def messageToSend(msg): @@ -33,18 +33,18 @@ def messageToSend(msg): else: m = msg print("\n" + m.attachments[0].decode()) - minimail.send(inbox, msg) + minimail.send(inbox, msg, device_name) class UserInterface(pEp.UserInterface): def notifyHandshake(self, me, partner, signal): - print("on " + device + " signal " + str(signal) + " for identities " + str(me.fpr) + " " + + print("on " + device_name + " signal " + str(signal) + " for identities " + str(me.fpr) + " " + str(partner.fpr)) def run(name): - global device - device = name + global device_name + device_name = name me = pEp.Identity("alice@peptest.ch", name + " of Alice Neuman") pEp.myself(me) pEp.messageToSend = messageToSend