Browse Source

safe user_id, flags are enough for now

PYADPT-55
Volker Birk 7 years ago
parent
commit
c5be17d7de
  1. 5
      src/basic_api.cc
  2. 10
      src/message_api.cc
  3. 3
      src/pEpmodule.cc

5
src/basic_api.cc

@ -26,10 +26,9 @@ namespace pEp {
throw invalid_argument("address needed");
if (ident.username() == "")
throw invalid_argument("username needed");
if (!(ident.user_id() == "" || ident.user_id() == PEP_OWN_USERID))
throw invalid_argument("user_id must be empty or '" PEP_OWN_USERID "'");
ident.user_id(PEP_OWN_USERID);
if (ident.user_id() == "")
ident.user_id(ident.address());
PEP_STATUS status = myself(adapter.session(), ident);
_throw_status(status);

10
src/message_api.cc

@ -2,6 +2,7 @@
// see LICENSE.txt
#include "message_api.hh"
#include "basic_api.hh"
#include <pEp/pEpEngine.h>
#include <pEp/message_api.h>
#include <pEp/sync_api.h>
@ -18,6 +19,9 @@ namespace pEp {
if (_from.username() == "")
throw invalid_argument("encrypt_message: src.from_.username empty");
if (_from.user_id() == "")
src.from().user_id(_from.address());
stringlist_t *_extra = to_stringlist(extra);
PEP_enc_format _enc_format = (PEP_enc_format) enc_format;
PEP_encrypt_flags_t _flags = (PEP_encrypt_flags_t) flags;
@ -55,13 +59,9 @@ namespace pEp {
int rating = (int) _rating;
int flags = (int) _flags;
string sync_status = flags & PEP_decrypt_flag_ignore ?
"MESSAGE_IGNORE" :
flags & PEP_decrypt_flag_consume ?
"MESSAGE_CONSUME" : "";
Message dst = _dst ? Message(_dst) : Message(src);
return boost::python::make_tuple(dst, keylist, rating, sync_status, flags);
return boost::python::make_tuple(dst, keylist, rating, flags);
}
int _color(int rating)

3
src/pEpmodule.cc

@ -258,8 +258,7 @@ BOOST_PYTHON_MODULE(pEp)
" msg the decrypted p≡p message\n"
" keys a list of keys being used\n"
" rating the rating of the message as integer\n"
" consumed boolean denoting message is consumed by sync\n"
" flags flags set while decryption (reserved)\n"
" flags flags set while decryption\n"
)
.add_property("outgoing_rating", &Message::outgoing_rating, "rating outgoing message will have")
.add_property("outgoing_color", &Message::outgoing_color, "color outgoing message will have")

Loading…
Cancel
Save