Browse Source

Identity.color now returns PEP_color instead of int

Message.outgoing_color returns PEP_color instead of int
pEp.color(rating) now returns PEP_color) instead of int
PYADPT-55
heck 5 years ago
parent
commit
8f93104ebe
  1. 2
      src/identity.cc
  2. 3
      src/identity.hh
  3. 2
      src/message.cc
  4. 3
      src/message.hh
  5. 6
      src/pEpmodule.cc

2
src/identity.cc

@ -125,7 +125,7 @@ namespace pEp {
return (int) rating; return (int) rating;
} }
int Identity::color() PEP_color Identity::color()
{ {
return _color(rating()); return _color(rating());
} }

3
src/identity.hh

@ -5,6 +5,7 @@
#include <boost/python.hpp> #include <boost/python.hpp>
#include <pEp/pEpEngine.h> #include <pEp/pEpEngine.h>
#include <pEp/message_api.h>
#include <string> #include <string>
#include <memory> #include <memory>
#include <cstddef> #include <cstddef>
@ -57,7 +58,7 @@ namespace pEp {
void flags(identity_flags_t flags) { _ident->flags = flags; } void flags(identity_flags_t flags) { _ident->flags = flags; }
int rating(); int rating();
int color(); PEP_color color();
Identity copy(); Identity copy();
Identity deepcopy(dict& memo); Identity deepcopy(dict& memo);

2
src/message.cc

@ -333,7 +333,7 @@ namespace pEp {
return (int) rating; return (int) rating;
} }
int Message::outgoing_color() PEP_color Message::outgoing_color()
{ {
return _color(outgoing_rating()); return _color(outgoing_rating());
} }

3
src/message.hh

@ -6,6 +6,7 @@
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <pEp/message.h> #include <pEp/message.h>
#include <pEp/message_api.h>
#include <string> #include <string>
#include "str_attr.hh" #include "str_attr.hh"
#include "identity.hh" #include "identity.hh"
@ -132,7 +133,7 @@ namespace pEp {
boost::python::tuple decrypt(int flags=0); boost::python::tuple decrypt(int flags=0);
int outgoing_rating(); int outgoing_rating();
int outgoing_color(); PEP_color outgoing_color();
Message deepcopy(dict& memo); Message deepcopy(dict& memo);
Message copy(); Message copy();
}; };

6
src/pEpmodule.cc

@ -241,7 +241,7 @@ BOOST_PYTHON_MODULE(pEp)
(void(pEp::PythonAdapter::Identity::*)(identity_flags_t)) &pEp::PythonAdapter::Identity::flags, (void(pEp::PythonAdapter::Identity::*)(identity_flags_t)) &pEp::PythonAdapter::Identity::flags,
"flags (p≡p internal)") "flags (p≡p internal)")
.add_property("rating", &pEp::PythonAdapter::Identity::rating, "rating of Identity") .add_property("rating", &pEp::PythonAdapter::Identity::rating, "rating of Identity")
.add_property("color", &pEp::PythonAdapter::Identity::color, "color of Identity") .add_property("color", &pEp::PythonAdapter::Identity::color, "color of Identity as PEP_color")
.add_property("is_pEp_user", &pEp::PythonAdapter::Identity::is_pEp_user, "True if this is an identity of a pEp user") .add_property("is_pEp_user", &pEp::PythonAdapter::Identity::is_pEp_user, "True if this is an identity of a pEp user")
.def("__deepcopy__", &pEp::PythonAdapter::Identity::deepcopy) .def("__deepcopy__", &pEp::PythonAdapter::Identity::deepcopy)
.def("update", &pEp::PythonAdapter::Identity::update, "update Identity") .def("update", &pEp::PythonAdapter::Identity::update, "update Identity")
@ -391,7 +391,7 @@ BOOST_PYTHON_MODULE(pEp)
" flags flags set while decryption\n" " flags flags set while decryption\n"
) )
.add_property("outgoing_rating", &Message::outgoing_rating, "rating outgoing message will have") .add_property("outgoing_rating", &Message::outgoing_rating, "rating outgoing message will have")
.add_property("outgoing_color", &Message::outgoing_color, "color outgoing message will have") .add_property("outgoing_color", &Message::outgoing_color, "color outgoing message will have as PEP_color")
.def("__deepcopy__", &Message::deepcopy) .def("__deepcopy__", &Message::deepcopy)
.def("__copy__", &Message::copy); .def("__copy__", &Message::copy);
@ -497,7 +497,7 @@ BOOST_PYTHON_MODULE(pEp)
def("color", &_color, def("color", &_color,
"c = color(rating)\n" "c = color(rating)\n"
"\n" "\n"
"calculate color value out of rating" "calculate color value out of rating. Returns PEP_color"
); );
def("trustwords", &_trustwords, def("trustwords", &_trustwords,
"text = trustwords(ident_own, ident_partner)\n" "text = trustwords(ident_own, ident_partner)\n"

Loading…
Cancel
Save