aboutsummaryrefslogtreecommitdiff
path: root/lib/eventitem.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/eventitem.h')
-rw-r--r--lib/eventitem.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/eventitem.h b/lib/eventitem.h
index 7b2c3c44..2d3d9ef6 100644
--- a/lib/eventitem.h
+++ b/lib/eventitem.h
@@ -1,25 +1,14 @@
/******************************************************************************
- * Copyright (C) 2018 Kitsune Ral <kitsune-ral@users.sf.net>
+ * SPDX-FileCopyrightText: 2018 Kitsune Ral <kitsune-ral@users.sf.net>
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#pragma once
#include "events/stateevent.h"
+#include <any>
#include <utility>
namespace Quotient {
@@ -72,6 +61,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 +76,7 @@ protected:
private:
RoomEventPtr evt;
+ std::any data;
};
class TimelineItem : public EventItemBase {