Browse Source

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

Also update the Engine entry in DEPENDENCIES.
pull/18/head
Luca Saiu as luca from a local script 2 years ago
parent
commit
dbeceffa11
  1. 2
      DEPENDENCIES
  2. 17
      src/pEp/_pEp/basic_api.cc
  3. 2
      src/pEp/_pEp/basic_api.hh
  4. 14
      src/pEp/_pEp/pEpmodule.cc

2
DEPENDENCIES

@ -1,6 +1,6 @@
# 1st Party Dependencies # 1st Party Dependencies
## Prefer git tags instead of SHA hashes when possible. ## Prefer git tags instead of SHA hashes when possible.
pEpEngine=v3.3.0-RC7 pEpEngine=v3.3.0-RC10
libpEpAdapter= v3.2.0-RC5 libpEpAdapter= v3.2.0-RC5
libpEpCxx=v3.2.0-RC1 libpEpCxx=v3.2.0-RC1

17
src/pEp/_pEp/basic_api.cc

@ -7,6 +7,7 @@
// Engine // Engine
#include <pEp/keymanagement.h> #include <pEp/keymanagement.h>
#include <pEp/message_api.h> #include <pEp/message_api.h>
#include <pEp/echo_api.h>
#include <pEp/Adapter.hh> #include <pEp/Adapter.hh>
// local // local
@ -221,5 +222,21 @@ namespace pEp {
_throw_status(status); _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);
}
} // namespace PythonAdapter } // namespace PythonAdapter
} // namespace pEp } // namespace pEp

2
src/pEp/_pEp/basic_api.hh

@ -34,6 +34,8 @@ namespace pEp {
void set_own_key(Identity &ident, string fpr); void set_own_key(Identity &ident, string fpr);
void set_comm_partner_key(Identity &ident, string fpr); void set_comm_partner_key(Identity &ident, string fpr);
void send_ping(Identity &own_identity, Identity &other_identity);
} /* namespace PythonAdapter */ } /* namespace PythonAdapter */
} /* namespace pEp */ } /* namespace pEp */

14
src/pEp/_pEp/pEpmodule.cc

@ -13,6 +13,7 @@
#include <pEp/key_reset.h> #include <pEp/key_reset.h>
#include <pEp/message_api.h> #include <pEp/message_api.h>
#include <pEp/sync_api.h> #include <pEp/sync_api.h>
#include <pEp/echo_api.h>
#include <pEp/status_to_string.h> #include <pEp/status_to_string.h>
// libpEpAdapter // libpEpAdapter
@ -688,6 +689,19 @@ namespace pEp {
"ident partner identity this key is used for\n" "ident partner identity this key is used for\n"
"fpr fingerprint of the key to set as the identity default\n"); "fpr fingerprint of the key to set as the identity default\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 // message API
enum_<PEP_rating>("rating") enum_<PEP_rating>("rating")

Loading…
Cancel
Save