abouttreesummaryrefslogcommitdiff
path: root/examples/Sync.c
diff options
context:
space:
mode:
authorPatrick2023-06-19 21:21:16 +0200
committerPatrick2023-06-19 21:21:16 +0200
commitad9d01050b7b6d592a83ce14eeef7068bd981028 (patch)
treef6263c85f4c9905bccb1887e50d2777c61b24405 /examples/Sync.c
parentd382d193cb2d550cc769afa76e55823865a39023 (diff)
downloadmatrix_esp_thesis-ad9d01050b7b6d592a83ce14eeef7068bd981028.tar.gz
matrix_esp_thesis-ad9d01050b7b6d592a83ce14eeef7068bd981028.zip
olm session management
Diffstat (limited to 'examples/Sync.c')
-rw-r--r--examples/Sync.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/examples/Sync.c b/examples/Sync.c
index 5043884..a49cf65 100644
--- a/examples/Sync.c
+++ b/examples/Sync.c
@@ -1,31 +1,28 @@
#include <matrix.h>
+#include <stdio.h>
-#define SERVER "matrix.org"
-#define ACCESS_TOKEN "abc"
-#define ROOM_ID "!jhpZBTbckszblMYjMK:matrix.org"
+#define SERVER "https://matrix.org"
+#define ACCESS_TOKEN "syt_cHNjaG8_yBvTjVTquGCikvsAenOJ_49mBMO"
+#define DEVICE_ID "MAZNCCZLBR"
int
-main(
- int argc,
- char **argv)
+main(void)
{
MatrixClient client;
- MatrixClientCreate(&client,
+ MatrixClientInit(&client,
SERVER);
+
+ MatrixHttpInit(&client);
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");
+ static char syncBuffer[20000];
+ MatrixClientSync(&client,
+ syncBuffer, 20000);
+ printf("%s", syncBuffer);
+
+ MatrixHttpDeinit(&client);
return 0;
} \ No newline at end of file