Browse Source

name files with device name

PYADPT-55
Volker Birk 6 years ago
parent
commit
06518e74ae
  1. 1
      src/pEpmodule.hh
  2. 4
      test/minimail.py
  3. 10
      test/sync_handshake.py

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

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

10
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("<!-- " + str(m.from_) + " -->\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

Loading…
Cancel
Save