Browse Source

Added partner parameter to deliverHandshakeResult

master
Edouard Tisserant 9 years ago
parent
commit
496594c26c
  1. 3
      src/pEpmodule.cc
  2. 4
      src/sync_mixin.cc
  3. 2
      src/sync_mixin.hh
  4. 11
      test/multipEp.py

3
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");

4
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);
}

2
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

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

Loading…
Cancel
Save