Browse Source

adding copy()

PYADPT-55
Volker Birk 9 years ago
parent
commit
4297f90398
  1. 6
      src/message.cc
  2. 2
      src/message.hh
  3. 2
      src/message_api.cc
  4. 3
      src/pEpmodule.cc

6
src/message.cc

@ -117,6 +117,7 @@ namespace pEp {
_msg->from = ::identity_dup(*from); _msg->from = ::identity_dup(*from);
if (!_msg->from) if (!_msg->from)
throw bad_alloc(); throw bad_alloc();
_msg->dir = dir;
} }
} }
@ -311,6 +312,11 @@ namespace pEp {
return _color(outgoing_rating()); return _color(outgoing_rating());
} }
Message Message::copy()
{
return Message(_str());
}
Message outgoing_message(Identity me) Message outgoing_message(Identity me)
{ {
::myself(session, me); ::myself(session, me);

2
src/message.hh

@ -128,7 +128,7 @@ namespace pEp {
boost::python::tuple decrypt(); boost::python::tuple decrypt();
int outgoing_rating(); int outgoing_rating();
int outgoing_color(); int outgoing_color();
Message copy();
}; };
Message outgoing_message(Identity me); Message outgoing_message(Identity me);

2
src/message_api.cc

@ -23,7 +23,7 @@ namespace pEp {
free_stringlist(_extra); free_stringlist(_extra);
_throw_status(status); _throw_status(status);
if (!_dst || _dst == src) { if (!_dst || _dst == _src) {
Message dst(src); Message dst(src);
return dst; return dst;
} }

3
src/pEpmodule.cc

@ -186,7 +186,8 @@ BOOST_PYTHON_MODULE(pEp)
.def("encrypt", (Message(Message::*)(list,int,int))&Message::encrypt, "encrypt message") .def("encrypt", (Message(Message::*)(list,int,int))&Message::encrypt, "encrypt message")
.def("decrypt", &Message::decrypt, "decrypt message") .def("decrypt", &Message::decrypt, "decrypt message")
.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")
.def("copy", &Message::copy, "deep copy of message");
// basic API // basic API

Loading…
Cancel
Save