X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/d43e8671acc5709c192e159e0d91626f0677cdf1..a6eff84624ab1f3786d02aa2ec740b9a88090d94:/examples/SendEncrypted.c diff --git a/examples/SendEncrypted.c b/examples/SendEncrypted.c index 2d3bd74..f2bb8df 100644 --- a/examples/SendEncrypted.c +++ b/examples/SendEncrypted.c @@ -1,32 +1,45 @@ #include +#include -#define SERVER FixedBuf("matrix.org") -#define ACCESS_TOKEN FixedBuf("abc") -#define ROOM_ID FixedBuf("!jhpZBTbckszblMYjMK:matrix.org") +#define SERVER "https://matrix.org" +#define ACCESS_TOKEN "syt_cHNjaG8_yBvTjVTquGCikvsAenOJ_49mBMO" +#define DEVICE_ID "MAZNCCZLBR" +#define USER_ID "@pscho:matrix.org" +#define ROOM_ID "!XKFUjAsGrSSrpDFIxB:matrix.org" int -main( - int argc, - char **argv) +main(void) { MatrixClient client; - MatrixClientCreate(&client, + MatrixClientInit(&client, SERVER); + + MatrixHttpInit(&client); MatrixClientSetAccessToken(&client, ACCESS_TOKEN); + MatrixClientSetDeviceId(&client, + DEVICE_ID); + MatrixClientSetUserId(&client, + USER_ID); - MatrixMegolmSession megolm; - MatrixMegolmSessionInit(&megolm); - - MatrixRoomShareMegolmSession(&client, - ROOM_ID, - megolm); - - MatrixClientSendGroupEncrypted(&client, + // MatrixMegolmOutSession megolmOutSession; + // MatrixMegolmOutSessionInit(&megolmOutSession); + + // MatrixClientSetMegolmOutSession(&client, + // ROOM_ID, + // megolmOutSession); + + MatrixClientSendEventEncrypted(&client, ROOM_ID, - FixedBuf("m.room.message"), - FixedBuf("{\"body\":\"Hello\",\"msgtype\":\"m.text\"}")); + "m.room.message", + "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}"); + + MatrixClientShareMegolmOutSessionTest(&client, + "ULZZOKJBYN", + &client.megolmOutSessions[0]); + + MatrixHttpDeinit(&client); return 0; -} \ No newline at end of file +}