aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-event.h
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dave@treblig.org>2016-09-01 00:22:44 +0100
committerDr. David Alan Gilbert <dave@treblig.org>2016-09-03 00:05:09 +0100
commit3857950b0b8c0310f1608d391db47d2e9f592e1a (patch)
treef7783cdc891de6429d8c2ec8f4bf719a2e4dec56 /matrix-event.h
parent511fa3c1e886fd968c6e29fcafd80f840b0b6f51 (diff)
downloadpurple-matrix-3857950b0b8c0310f1608d391db47d2e9f592e1a.tar.gz
event hooks
Some events need to do something else before the event can be transmitted, and indeed the contents of the event aren't necessarily known until that other thing has happened. Add a hook that gets called when the event is ready to be sent and when the event is to be free'd. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Diffstat (limited to 'matrix-event.h')
-rw-r--r--matrix-event.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/matrix-event.h b/matrix-event.h
index 2f079b2..6bdb35e 100644
--- a/matrix-event.h
+++ b/matrix-event.h
@@ -25,7 +25,14 @@
#include <glib.h>
struct _JsonObject;
+struct _MatrixRoomEvent;
+/* Callback by events;
+ * called with 'just_free' false prior to sending an event.
+ * called with 'just_free' true when freeing the event.
+ */
+typedef void (*EventSendHook)(struct _MatrixRoomEvent *event,
+ gboolean just_free);
typedef struct _MatrixRoomEvent {
/* for outgoing events, our made-up transaction id. NULL for incoming
* events.
@@ -37,6 +44,14 @@ typedef struct _MatrixRoomEvent {
gchar *event_type;
struct _JsonObject *content;
+
+ /* Hook (& data) called when the event is unqueued; the hook should
+ * do the send itself.
+ * Useful where a file has to be uploaded before sending the event.
+ */
+ EventSendHook hook;
+
+ void *hook_data;
} MatrixRoomEvent;