X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/d43e8671acc5709c192e159e0d91626f0677cdf1..464bfb1912d0806143386f61c33dd45fbafc38e8:/examples/Sync.c?ds=sidebyside diff --git a/examples/Sync.c b/examples/Sync.c index 5043884..e845056 100644 --- a/examples/Sync.c +++ b/examples/Sync.c @@ -1,31 +1,27 @@ #include +#include -#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" 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[40000]; + MatrixClientSync(&client, + syncBuffer, 40000); + printf("%s", syncBuffer); + + MatrixHttpDeinit(&client); return 0; } \ No newline at end of file