Browse Source

make send_ping, now an Engine API function, available to Python

Also update the Engine entry in DEPENDENCIES.
positron-nkls-mixnet
Luca Saiu as luca from a local script 2 years ago
committed by Luca Saiu
parent
commit
9a216c8e09
  1. 31
      src/pEp/_pEp/basic_api.cc
  2. 3
      src/pEp/_pEp/basic_api.hh
  3. 13
      src/pEp/_pEp/pEpmodule.cc

31
src/pEp/_pEp/basic_api.cc

@ -9,6 +9,7 @@
#include <pEp/message_api.h>
#include <pEp/echo_api.h>
#include <pEp/mixnet.h>
#include <pEp/echo_api.h>
#include <pEp/Adapter.hh>
// local
@ -222,21 +223,6 @@ namespace pEp {
_throw_status(status);
}
void send_ping(Identity &own_identity, Identity &other_identity)
{
const std::string own_userid = (*own_identity).user_id;
if (own_userid == "")
throw invalid_argument("user_id needed for own identity");
else if (own_userid != PEP_OWN_USERID)
throw invalid_argument("suppesedly own identity not own");
::pEp_identity *own_identity_c = own_identity;
::pEp_identity *other_identity_c = other_identity;
PEP_STATUS status = PEP_STATUS_OK;
status = ::send_ping(Adapter::session(), own_identity_c, other_identity_c);
_throw_status(status);
boost::python::list onion_identities(unsigned trusted_no, unsigned total_no)
{
::identity_list *identities = NULL;
@ -253,7 +239,22 @@ namespace pEp {
}
free_identity_list(identities);
return result;
}
void send_ping(Identity &own_identity, Identity &other_identity)
{
const std::string own_userid = (*own_identity).user_id;
if (own_userid == "")
throw invalid_argument("user_id needed for own identity");
else if (own_userid != PEP_OWN_USERID)
throw invalid_argument("suppesedly own identity not own");
::pEp_identity *own_identity_c = own_identity;
::pEp_identity *other_identity_c = other_identity;
PEP_STATUS status = PEP_STATUS_OK;
status = ::send_ping(Adapter::session(), own_identity_c, other_identity_c);
_throw_status(status);
}
} // namespace PythonAdapter

3
src/pEp/_pEp/basic_api.hh

@ -38,6 +38,9 @@ namespace pEp {
void send_ping(Identity &own_identity, Identity &other_identity);
boost::python::list onion_identities(unsigned trusted_no, unsigned total_no);
void send_ping(Identity &own_identity, Identity &other_identity);
} /* namespace PythonAdapter */
} /* namespace pEp */

13
src/pEp/_pEp/pEpmodule.cc

@ -769,6 +769,19 @@ namespace pEp {
"blob a blob returned by Message.serialize\n"
"\n");
def("send_ping",
&send_ping,
"send_ping(own_identity, other_identity)\n"
"\n"
"send a Distribution.Ping message from the given own identity\n"
"to the given identity, usually but not necessarily non-own.\n"
"\n"
"Both identities must have been updated, the own identity\n"
"with pEp.myself() and the second with Identity.update()\n"
"\n"
"own_identity the sender identity\n"
"other_identity the recipient identity\n");
// message API
enum_<PEP_rating>("rating")

Loading…
Cancel
Save