Browse Source

adding identities list to deliverHandshakeResult()

PYADPT-55
Volker Birk 6 years ago
parent
commit
5861fe53ab
  1. 4
      src/pEpmodule.cc
  2. 26
      src/user_interface.cc
  3. 2
      src/user_interface.hh

4
src/pEpmodule.cc

@ -405,9 +405,11 @@ BOOST_PYTHON_MODULE(pEp)
"\n"
"overwrite this method with an implementation of a handshake dialog")
.def("deliverHandshakeResult", &UserInterface::deliverHandshakeResult,
"deliverHandshakeResult(self, result)\n"
boost::python::arg("identities")=object(),
"deliverHandshakeResult(self, result, identities=None)\n"
"\n"
" result -1: cancel, 0: accepted, 1: rejected\n"
" identities list of identities to share or None for all\n"
"\n"
"call to deliver the handshake result of the handshake dialog")
;

26
src/user_interface.cc

@ -51,10 +51,32 @@ namespace pEp {
return PEP_STATUS_OK;
}
void UserInterface::deliverHandshakeResult(int result)
void UserInterface::deliverHandshakeResult(int result, object identities)
{
identity_list *shared_identities = nullptr;
if (identities != boost::python::api::object()) {
shared_identities = new_identity_list(nullptr);
if (!shared_identities)
throw bad_alloc();
try {
identity_list *si = shared_identities;
for (int i=0; i < boost::python::len(identities); ++i) {
Identity ident = extract< Identity >(identities[i]);
si = identity_list_add(si, ident);
if (!si)
throw bad_alloc();
}
}
catch (exception& ex) {
free_identity_list(shared_identities);
throw ex;
}
}
PEP_STATUS status = ::deliverHandshakeResult(adapter.session(),
(sync_handshake_result) result);
(sync_handshake_result) result, shared_identities);
free_identity_list(shared_identities);
_throw_status(status);
}

2
src/user_interface.hh

@ -24,7 +24,7 @@ namespace pEp {
throw runtime_error("override this method");
}
virtual void deliverHandshakeResult(int result);
virtual void deliverHandshakeResult(int result, object identities);
PEP_rating get_key_rating_for_user(string user_id, string fpr);

Loading…
Cancel
Save