Browse Source

adding DONT_TRIGGER_SYNC flag

PYADPT-55
Volker Birk 6 years ago
parent
commit
911ecab116
  1. 4
      src/message.cc
  2. 2
      src/message.hh
  3. 9
      src/message_api.cc
  4. 2
      src/message_api.hh
  5. 2
      src/pEpmodule.cc
  6. 7
      test/sync_handshake.py

4
src/message.cc

@ -305,8 +305,8 @@ namespace pEp {
return encrypt_message(*this, extra, enc_format, flags);
}
boost::python::tuple Message::decrypt() {
return decrypt_message(*this);
boost::python::tuple Message::decrypt(int flags) {
return decrypt_message(*this, flags);
}
int Message::outgoing_rating()

2
src/message.hh

@ -130,7 +130,7 @@ namespace pEp {
Message encrypt();
Message _encrypt(boost::python::list extra, int enc_format=4, int flags=0);
boost::python::tuple decrypt();
boost::python::tuple decrypt(int flags=0);
int outgoing_rating();
int outgoing_color();
Message deepcopy(dict& memo);

9
src/message_api.cc

@ -39,12 +39,12 @@ namespace pEp {
return Message(_dst);
}
boost::python::tuple decrypt_message(Message src)
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 = 0;
PEP_decrypt_flags_t _flags = (PEP_decrypt_flags_t) flags;
message *_src = src;
PEP_STATUS status = decrypt_message(adapter.session(), _src, &_dst, &_keylist,
@ -57,11 +57,8 @@ namespace pEp {
free_stringlist(_keylist);
}
int rating = (int) _rating;
int flags = (int) _flags;
Message dst = _dst ? Message(_dst) : Message(src);
return boost::python::make_tuple(dst, keylist, rating, flags);
return boost::python::make_tuple(dst, keylist, _rating, _flags);
}
int _color(int rating)

2
src/message_api.hh

@ -9,7 +9,7 @@ namespace pEp {
namespace PythonAdapter {
Message encrypt_message(Message src, boost::python::list extra = boost::python::list(),
int enc_format = 4, int flags = 0);
boost::python::tuple decrypt_message(Message src);
boost::python::tuple decrypt_message(Message src, int flags=0);
int _color(int rating);
void _config_keep_sync_msg(bool enabled);
object sync_search(string name);

2
src/pEpmodule.cc

@ -270,7 +270,7 @@ BOOST_PYTHON_MODULE(pEp)
" 3 for PGP/MIME, 4 for pEp\n"
" flags 1 is force encryption\n"
)
.def("decrypt", &Message::decrypt,
.def("decrypt", &Message::decrypt, boost::python::arg("flags")=0,
"msg2, keys, rating, flags = msg1.decrypt()\n"
"\n"
"decrypts a p≡p message and returns a tuple with data\n"

7
test/sync_handshake.py

@ -19,6 +19,7 @@ $ cd $DEV && HOME=$PWD lldb python3 -- ../sync_handshake.py -e $DEV
import pathlib
import os
import sys
import pEp
import minimail
@ -32,10 +33,12 @@ inbox = pathlib.Path("..") / "TestInbox"
device_name = ""
output = print
DONT_TRIGGER_SYNC = 0x200
def messageToSend(msg):
if msg.enc_format:
m, keys, rating, flags = msg.decrypt()
m, keys, rating, flags = msg.decrypt(DONT_TRIGGER_SYNC)
else:
m = msg
output("<!-- " + device_name + " -->\n" + m.attachments[0].decode())
@ -81,7 +84,7 @@ if __name__=="__main__":
dest="exec_for", help="execute for name of simulated device " +
"(default: name of actual directory)")
optParser.add_option("--color", action="store", type="string",
desct="color", help="print debug output in this color")
dest="color", help="print debug output in this color", default=None)
options, args = optParser.parse_args()
if not options.exec_for:

Loading…
Cancel
Save