diff options
| author | Patrick | 2023-05-15 18:47:59 +0200 |
|---|---|---|
| committer | Patrick | 2023-05-15 18:47:59 +0200 |
| commit | d43e8671acc5709c192e159e0d91626f0677cdf1 (patch) | |
| tree | 85d2c65ddb3c36bea1e9ea814cf9434e52fcae97 /examples/Sync.c | |
| download | matrix_esp_thesis-d43e8671acc5709c192e159e0d91626f0677cdf1.tar.gz matrix_esp_thesis-d43e8671acc5709c192e159e0d91626f0677cdf1.zip | |
Initial commit. Rudimentary readme, mockup examples without actual implementation, Makefile, Olm submodule
Diffstat (limited to 'examples/Sync.c')
| -rw-r--r-- | examples/Sync.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/Sync.c b/examples/Sync.c new file mode 100644 index 0000000..5043884 --- /dev/null +++ b/examples/Sync.c @@ -0,0 +1,31 @@ +#include <matrix.h>
+
+#define SERVER "matrix.org"
+#define ACCESS_TOKEN "abc"
+#define ROOM_ID "!jhpZBTbckszblMYjMK:matrix.org"
+
+int
+main(
+ int argc,
+ char **argv)
+{
+ MatrixClient client;
+ MatrixClientCreate(&client,
+ SERVER);
+
+ MatrixClientSetAccessToken(&client,
+ ACCESS_TOKEN);
+
+ static char syncCharBuffer[1024];
+ FixedBuffer syncBuffer = { syncCharBuffer, 1024, 0 };
+ int syncN = 1;
+
+ while (syncN > 0)
+ {
+ MatrixClientSyncN(&client, &syncBuffer, &syncN);
+ printf("%.*s", syncBuffer.len, (char *)syncBuffer.ptr);
+ }
+ printf("\n");
+
+ return 0;
+}
\ No newline at end of file |
