diff --git a/src/pEp/_pEp/basic_api.cc b/src/pEp/_pEp/basic_api.cc index 4fa55cf..4146f50 100644 --- a/src/pEp/_pEp/basic_api.cc +++ b/src/pEp/_pEp/basic_api.cc @@ -9,6 +9,7 @@ #include #include #include +#include #include // 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 diff --git a/src/pEp/_pEp/basic_api.hh b/src/pEp/_pEp/basic_api.hh index ca6cdef..cffe13b 100644 --- a/src/pEp/_pEp/basic_api.hh +++ b/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 */ diff --git a/src/pEp/_pEp/pEpmodule.cc b/src/pEp/_pEp/pEpmodule.cc index 633b210..516ae44 100644 --- a/src/pEp/_pEp/pEpmodule.cc +++ b/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_("rating")