From 32ff949202a6b358bd8c5be5be18775d1d153860 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Tue, 9 Apr 2019 12:57:15 +0200 Subject: [PATCH] easier --- src/adapter.cc | 20 ++------------------ src/adapter.hh | 5 ----- src/pEpmodule.cc | 8 ++++---- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/adapter.cc b/src/adapter.cc index 305fca2..e411a4c 100644 --- a/src/adapter.cc +++ b/src/adapter.cc @@ -7,8 +7,7 @@ namespace pEp { namespace PythonAdapter { Adapter::Adapter(bool unregister_this) - : flag_unregister(unregister_this), passive_mode(false), - unencrypted_subject(false) + : flag_unregister(unregister_this) { session(init); } @@ -42,13 +41,8 @@ namespace pEp { case init: ++booked; - if (!_session) { + if (!_session) status = ::init(&_session, _messageToSend, _inject_sync_event); - if (!status) { - ::config_passive_mode(_session, passive_mode); - ::config_unencrypted_subject(_session, unencrypted_subject); - } - } break; default: @@ -61,16 +55,6 @@ namespace pEp { return _session; } - void Adapter::config_passive_mode(bool enable) - { - ::config_passive_mode(session(), enable); - } - - void Adapter::config_unencrypted_subject(bool enable) - { - ::config_unencrypted_subject(session(), enable); - } - PyObject *Adapter::ui_object(PyObject *value) { lock_guard lock(mtx()); diff --git a/src/adapter.hh b/src/adapter.hh index fcee9fc..8ae71ff 100644 --- a/src/adapter.hh +++ b/src/adapter.hh @@ -14,8 +14,6 @@ namespace pEp { class Adapter { bool flag_unregister; - bool passive_mode; - bool unencrypted_subject; public: Adapter(bool unregister_this = false); @@ -34,9 +32,6 @@ namespace pEp { return q; } - void config_passive_mode(bool enable); - void config_unencrypted_subject(bool enable); - protected: static PyObject *ui_object(PyObject *value = nullptr); static int _inject_sync_event(SYNC_EVENT ev, void *management); diff --git a/src/pEpmodule.cc b/src/pEpmodule.cc index 4f53eec..8a5d4b0 100644 --- a/src/pEpmodule.cc +++ b/src/pEpmodule.cc @@ -24,12 +24,12 @@ namespace pEp { void config_passive_mode(bool enable) { - adapter.config_passive_mode(enable); + ::config_passive_mode(adapter.session(), enable); } void config_unencrypted_subject(bool enable) { - adapter.config_unencrypted_subject(enable); + ::config_unencrypted_subject(adapter.session(), enable); } scope *_scope = NULL; @@ -92,10 +92,10 @@ BOOST_PYTHON_MODULE(pEp) scope().attr("about") = about(); - def("config_passive_mode", pEp::PythonAdapter::config_passive_mode, + def("passive_mode", pEp::PythonAdapter::config_passive_mode, "do not attach pub keys to all messages"); - def("config_unencrypted_subject", pEp::PythonAdapter::config_unencrypted_subject, + def("unencrypted_subject", pEp::PythonAdapter::config_unencrypted_subject, "do not encrypt the subject of messages"); auto identity_class = class_("Identity",