From 496594c26cdfda76959474e271082e988bbd7c85 Mon Sep 17 00:00:00 2001 From: Edouard Tisserant Date: Tue, 13 Sep 2016 16:36:23 +0200 Subject: [PATCH] Added partner parameter to deliverHandshakeResult --- src/pEpmodule.cc | 3 ++- src/sync_mixin.cc | 4 ++-- src/sync_mixin.hh | 2 +- test/multipEp.py | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/pEpmodule.cc b/src/pEpmodule.cc index 5e279af..2e0bb9d 100644 --- a/src/pEpmodule.cc +++ b/src/pEpmodule.cc @@ -345,8 +345,9 @@ BOOST_PYTHON_MODULE(pEp) "inject an event into the sync state machine (for debugging purposes only)") #endif .def("deliverHandshakeResult", &SyncMixIn::deliverHandshakeResult, - "deliverHandshakeResult(self, result)\n" + "deliverHandshakeResult(self, partber, result)\n" "\n" + " partner identity of communication partner\n" " result -1: cancel, 0: accepted, 1: rejected\n" "\n" "call to deliver the handshake result"); diff --git a/src/sync_mixin.cc b/src/sync_mixin.cc index 0e8f2c5..80af846 100644 --- a/src/sync_mixin.cc +++ b/src/sync_mixin.cc @@ -51,9 +51,9 @@ namespace pEp { return PEP_STATUS_OK; } - void SyncMixIn::deliverHandshakeResult(int result) + void SyncMixIn::deliverHandshakeResult(Identity partner, int result) { - PEP_STATUS status = ::deliverHandshakeResult(session, + PEP_STATUS status = ::deliverHandshakeResult(session, partner, (sync_handshake_result) result); _throw_status(status); } diff --git a/src/sync_mixin.hh b/src/sync_mixin.hh index 41d71a5..0a38d4e 100644 --- a/src/sync_mixin.hh +++ b/src/sync_mixin.hh @@ -18,7 +18,7 @@ namespace pEp { throw runtime_error("override this method"); } - virtual void deliverHandshakeResult(int result); + virtual void deliverHandshakeResult(Identity partner, int result); #ifndef NDEBUG virtual void _inject(int event, Identity partner, object extra); #endif diff --git a/test/multipEp.py b/test/multipEp.py index 3214213..24617e2 100644 --- a/test/multipEp.py +++ b/test/multipEp.py @@ -75,9 +75,9 @@ def pEp_instance_run(iname, conn, msgs_folders, handshakes_seen, handshakes_vali handshakes_seen.remove(tw) handshakes_validated.append(tw) printi("ACCEPTED (already seen)") - self.deliverHandshakeResult(0) + self.deliverHandshakeResult(partner, 0) else: - handshakes_pending.append(tw) + handshakes_pending.append((tw,partner)) handshakes_seen.append(tw) printheader() @@ -116,12 +116,13 @@ def pEp_instance_run(iname, conn, msgs_folders, handshakes_seen, handshakes_vali printheader() printheader("check validated handshakes") - for tw in handshakes_pending: + for tple in handshakes_pending: + tw, partner = tple if tw in handshakes_validated: handshakes_validated.remove(tw) - handshakes_pending.remove(tw) + handshakes_pending.remove(tple) printi("ACCEPT pending handshake : "+ tw) - handler.deliverHandshakeResult(0) + handler.deliverHandshakeResult(partner, 0) printheader()