abouttreesummaryrefslogcommitdiff
path: root/examples/Sync.c
blob: 5043884ac8197602808b0dfecd06f2e773d09664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
}