From 484194c114711c1f76736901c9c4521a9ad89882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Mon, 23 Apr 2018 17:05:15 -0400 Subject: [PATCH] immessage: add support for custom datatypes --- include/opendht/default_types.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/opendht/default_types.h b/include/opendht/default_types.h index 58595163..205ec3ed 100644 --- a/include/opendht/default_types.h +++ b/include/opendht/default_types.h @@ -114,6 +114,8 @@ public: 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) + : id(id), datatype(std::move(dt)), msg(std::move(m)), date(d) {} virtual void unpackValue(const Value& v) override { to = v.recipient; @@ -123,10 +125,11 @@ public: dht::InfoHash to; dht::Value::Id id {0}; std::string msg; + std::string datatype; long date {0}; ImStatus status {ImStatus::NONE}; - MSGPACK_DEFINE_MAP(id, msg, date, status) + MSGPACK_DEFINE_MAP(id, msg, date, status, datatype) }; class OPENDHT_PUBLIC TrustRequest : public EncryptedValue