aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/eventitem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/eventitem.h b/lib/eventitem.h
index 7b2c3c44..137ddf63 100644
--- a/lib/eventitem.h
+++ b/lib/eventitem.h
@@ -20,6 +20,7 @@
#include "events/stateevent.h"
+#include <any>
#include <utility>
namespace Quotient {
@@ -72,6 +73,12 @@ public:
return std::exchange(evt, move(other));
}
+ /// Store arbitrary data with the event item
+ void setUserData(std::any userData) { data = userData; }
+ /// Obtain custom data previously stored with the event item
+ const std::any& userdata() const { return data; }
+ std::any& userData() { return data; }
+
protected:
template <typename EventT>
EventT* getAs()
@@ -81,6 +88,7 @@ protected:
private:
RoomEventPtr evt;
+ std::any data;
};
class TimelineItem : public EventItemBase {