X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/d43e8671acc5709c192e159e0d91626f0677cdf1..HEAD:/examples/Send.c diff --git a/examples/Send.c b/examples/Send.c index 95167cc..d5d27b9 100644 --- a/examples/Send.c +++ b/examples/Send.c @@ -1,25 +1,38 @@ #include -#define SERVER FixedBuf("matrix.org") -#define ACCESS_TOKEN FixedBuf("abc") -#define ROOM_ID FixedBuf("!jhpZBTbckszblMYjMK:matrix.org") +#define SERVER "https://matrix.org" +#define USER_ID "@example:matrix.org" +#define ROOM_ID "!example:matrix.org" +#define USERNAME "" +#define PASSWORD "" +#define DEVICE_NAME "" int -main( - int argc, - char **argv) +main(void) { MatrixClient client; - MatrixClientCreate(&client, - SERVER); + MatrixClientInit(&client); + + MatrixHttpInit(&client.hc, SERVER); + + + MatrixClientSetUserId(&client, USER_ID); + + MatrixClientLoginPassword(&client, + USERNAME, + PASSWORD, + DEVICE_NAME); - MatrixClientSetAccessToken(&client, - ACCESS_TOKEN); MatrixClientSendEvent(&client, ROOM_ID, - FixedBuf("m.room.message"), - FixedBuf("{\"body\":\"Hello\",\"msgtype\":\"m.text\"}")); + "m.room.message", + "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}"); + + + MatrixClientDeleteDevice(&client); + + MatrixHttpDeinit(&client.hc); return 0; -} \ No newline at end of file +}