abouttreesummaryrefslogcommitdiff
path: root/examples/SendEncrypted.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/SendEncrypted.c')
-rw-r--r--examples/SendEncrypted.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/SendEncrypted.c b/examples/SendEncrypted.c
new file mode 100644
index 0000000..2d3bd74
--- /dev/null
+++ b/examples/SendEncrypted.c
@@ -0,0 +1,32 @@
+#include <matrix.h>
+
+#define SERVER FixedBuf("matrix.org")
+#define ACCESS_TOKEN FixedBuf("abc")
+#define ROOM_ID FixedBuf("!jhpZBTbckszblMYjMK:matrix.org")
+
+int
+main(
+ int argc,
+ char **argv)
+{
+ MatrixClient client;
+ MatrixClientCreate(&client,
+ SERVER);
+
+ MatrixClientSetAccessToken(&client,
+ ACCESS_TOKEN);
+
+ MatrixMegolmSession megolm;
+ MatrixMegolmSessionInit(&megolm);
+
+ MatrixRoomShareMegolmSession(&client,
+ ROOM_ID,
+ megolm);
+
+ MatrixClientSendGroupEncrypted(&client,
+ ROOM_ID,
+ FixedBuf("m.room.message"),
+ FixedBuf("{\"body\":\"Hello\",\"msgtype\":\"m.text\"}"));
+
+ return 0;
+} \ No newline at end of file