Browse Source

adapt to ENGINE-959, without changing the Python side of the API

lucasaiu/message-struct-change
Luca Saiu 4 years ago
parent
commit
915f6d0001
  1. 4
      src/pEp/_pEp/message.hh
  2. 4
      src/pEp/_pEp/message_api.cc
  3. 5
      src/pEp/_pEp/pEpmodule.cc

4
src/pEp/_pEp/message.hh

@ -169,6 +169,10 @@ namespace pEp {
void enc_format(PEP_enc_format value) { _msg->enc_format = value; }
PEP_rating rating() { return _msg->rating; }
void rating(PEP_rating value) { _msg->rating = value; }
Message encrypt();
Message _encrypt(boost::python::list extra, int enc_format = 4, int flags = 0);

4
src/pEp/_pEp/message_api.cc

@ -47,12 +47,11 @@ namespace pEp {
boost::python::tuple decrypt_message(Message src, int flags) {
message *_dst = NULL;
stringlist_t *_keylist = NULL;
PEP_rating _rating = PEP_rating_undefined;
PEP_decrypt_flags_t _flags = (PEP_decrypt_flags_t) flags;
message *_src = src;
PEP_STATUS status = ::decrypt_message(Adapter::session(), _src, &_dst, &_keylist,
&_rating, &_flags);
&_flags);
_throw_status(status);
boost::python::list keylist;
@ -62,6 +61,7 @@ namespace pEp {
}
Message dst = _dst ? Message(_dst) : Message(src);
PEP_rating _rating = dst.rating ();
return boost::python::make_tuple(dst, keylist, _rating, _flags);
}

5
src/pEp/_pEp/pEpmodule.cc

@ -488,6 +488,11 @@ namespace pEp {
(void(Message::*)(int))
(void(Message::*)(PEP_enc_format)) &Message::enc_format,
"0: unencrypted, 1: inline PGP, 2: S/MIME, 3: PGP/MIME, 4: p≡p format")
.add_property("rating", (int(Message::*)())
(PEP_rating(Message::*)()) &Message::rating,
(void(Message::*)(int))
(void(Message::*)(PEP_rating)) &Message::rating,
"the message rating as computed on this endpoint")
.def("encrypt", (Message(Message::*)())&Message::encrypt)
.def("encrypt", (Message(Message::*)(boost::python::list))&Message::_encrypt)
.def("encrypt", (Message(Message::*)(boost::python::list, int))&Message::_encrypt)

Loading…
Cancel
Save