Skip to content
Permalink
Browse files

default_types: add metadatas map into ImMessage

Give the ability to store more datas into an ImMessage

Issue: #345
  • Loading branch information...
AmarOk1412 authored and aberaud committed Nov 22, 2018
1 parent 4d6e5ab commit b143bc459dcf70e7a68c1f7b9cc324d2966fd3b7
Showing with 5 additions and 2 deletions.
  1. +5 −2 include/opendht/default_types.h
@@ -114,8 +114,10 @@ class OPENDHT_PUBLIC ImMessage : public SignedValue<ImMessage>
ImMessage() {}
ImMessage(dht::Value::Id id, std::string&& m, long d = 0)
: id(id), msg(std::move(m)), date(d) {}
ImMessage(dht::Value::Id id, std::string&& dt, std::string&& m, long d = 0)
ImMessage(dht::Value::Id id, std::string &&dt, std::string &&m, long d = 0)
: id(id), msg(std::move(m)), datatype(std::move(dt)), date(d) {}
ImMessage(dht::Value::Id id, std::string &&dt, std::string &&m, std::map<std::string, std::string> &&md, long d = 0)
: id(id), msg(std::move(m)), datatype(std::move(dt)), metadatas(std::move(md)), date(d) {}

virtual void unpackValue(const Value& v) override {
to = v.recipient;
@@ -126,10 +128,11 @@ class OPENDHT_PUBLIC ImMessage : public SignedValue<ImMessage>
dht::Value::Id id {0};
std::string msg;
std::string datatype;
std::map<std::string, std::string> metadatas;
long date {0};
ImStatus status {ImStatus::NONE};

MSGPACK_DEFINE_MAP(id, msg, date, status, datatype)
MSGPACK_DEFINE_MAP(id, msg, date, status, datatype, metadatas)
};

class OPENDHT_PUBLIC TrustRequest : public EncryptedValue<TrustRequest>

0 comments on commit b143bc4

Please sign in to comment.
You can’t perform that action at this time.