Browse Source

Message: add set_opt_field and remove_opt_field, making opt fields modifiable from Python

Also update DEPENDENCIES to use a new Engine RC with the new (trivial) API
functions.
pull/17/head
Luca Saiu 2 years ago
parent
commit
b46c26f1f8
  1. 2
      DEPENDENCIES
  2. 14
      src/pEp/_pEp/message.cc
  3. 3
      src/pEp/_pEp/message.hh
  4. 16
      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.2.0-RC27 pEpEngine=v3.3.0-RC7
libpEpAdapter= v3.2.0-RC5 libpEpAdapter= v3.2.0-RC5
libpEpCxx=v3.2.0-RC1 libpEpCxx=v3.2.0-RC1

14
src/pEp/_pEp/message.cc

@ -300,6 +300,20 @@ namespace pEp {
_msg->attachments = bl; _msg->attachments = bl;
} }
void Message::remove_opt_field(string name)
{
::message *msg_c = _msg.get();
PEP_STATUS status = ::message_remove_opt_field(Adapter::session(), msg_c, name.c_str());
_throw_status(status);
}
void Message::set_opt_field(string name, string value)
{
::message *msg_c = _msg.get();
PEP_STATUS status = ::message_set_opt_field(Adapter::session(), msg_c, name.c_str(), value.c_str());
_throw_status(status);
}
Message Message::encrypt() Message Message::encrypt()
{ {
boost::python::list extra; boost::python::list extra;

3
src/pEp/_pEp/message.hh

@ -300,6 +300,9 @@ namespace pEp {
_msg->enc_format = value; _msg->enc_format = value;
} }
void remove_opt_field(string name);
void set_opt_field(string name, string value);
Message encrypt(); Message encrypt();
Message _encrypt(boost::python::list extra, int enc_format = 4, int flags = 0); Message _encrypt(boost::python::list extra, int enc_format = 4, int flags = 0);

16
src/pEp/_pEp/pEpmodule.cc

@ -535,6 +535,22 @@ namespace pEp {
(void(Message::*)(int))(void(Message::*)(PEP_enc_format)) & (void(Message::*)(int))(void(Message::*)(PEP_enc_format)) &
Message::enc_format, Message::enc_format,
"0: unencrypted, 1: inline PGP, 2: S/MIME, 3: PGP/MIME, 4: p≡p format") "0: unencrypted, 1: inline PGP, 2: S/MIME, 3: PGP/MIME, 4: p≡p format")
.def("remove_opt_field", &Message::remove_opt_field,
"msg.remove_opt_field(name)\n"
"\n"
"alters msg removing an opt_field with the given name, if present.\n"
"\n"
" msg a message\n"
" name the field name as a string\n")
.def("set_opt_field", &Message::set_opt_field,
"msg.set_opt_field(name, value)\n"
"\n"
"alters msg replacing an opt_field, or adding it, if the same field\n"
"was not present before.\n"
"\n"
" msg a message\n"
" name the field name as a string\n"
" value the new field value as a string\n")
.def("encrypt", (Message(Message::*)()) & Message::encrypt) .def("encrypt", (Message(Message::*)()) & Message::encrypt)
.def( .def(
"encrypt", "encrypt",

Loading…
Cancel
Save