1 #define OLMLIB_VERSION_MAJOR 3
2 #define OLMLIB_VERSION_MINOR 2
3 #define OLMLIB_VERSION_PATCH 15
5 #define OLM_STATIC_DEFINE
10 #define SERVER "https://matrix.org"
11 #define USER_ID "@pscho:matrix.org"
12 #define ROOM_ID "!XKFUjAsGrSSrpDFIxB:matrix.org"
17 // static MatrixClient _client;
18 // MatrixClient * client = &_client;
19 MatrixClient * client = (MatrixClient*)malloc(sizeof(MatrixClient));
20 MatrixClientInit(client);
22 MatrixHttpInit(&client->hc, SERVER);
23 MatrixClientSetUserId(client, USER_ID);
25 static char key[1024];
26 MatrixOlmAccountGetDeviceKey(&client->olmAccount, key, 1024);
27 printf("key: %s\n", key);
29 //MatrixClientSetUserId(client, USER_ID);
31 MatrixClientLoginPassword(client,
36 // MatrixClientSendEvent(client,
39 // "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}");
41 MatrixClientUploadDeviceKey(client);
42 MatrixClientGenerateOnetimeKeys(client, 10);
43 MatrixClientUploadOnetimeKeys(client);
45 // create megolmsession
46 MatrixMegolmOutSession * megolmOutSession;
47 MatrixClientNewMegolmOutSession(client,
50 printf("megolm session id: %.10s... key: %.10s...\n", megolmOutSession->id, megolmOutSession->key);
52 // heap_caps_get_free_size();
53 // xPortGetFreeHeapSize();
55 MatrixClientShareMegolmOutSession(client,
60 MatrixClientSendEventEncrypted(client,
63 "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}");
65 MatrixClientDeleteDevice(client);
67 MatrixHttpDeinit(&client->hc);
77 wifi_init("Hundehuette", "Affensicherespw55");