abouttreesummaryrefslogcommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPatrick2023-10-13 15:57:15 +0200
committerPatrick2023-10-13 15:57:15 +0200
commit9eaa420b7bf51cc81c50e7f4ca0f256498a07c86 (patch)
tree696c4397b60503be0e7a732ef24f6266cafcaa86 /examples
parent80dc4ce95cbe915a3aaa7e2e18f545916d6ec769 (diff)
downloadmatrix_esp_thesis-9eaa420b7bf51cc81c50e7f4ca0f256498a07c86.tar.gz
matrix_esp_thesis-9eaa420b7bf51cc81c50e7f4ca0f256498a07c86.zip
HTTP layer for ESP32, make static specifier in matrix.c optional by defining it as a macro
Diffstat (limited to 'examples')
-rw-r--r--examples/Send.c16
-rw-r--r--examples/SendEncrypted.c2
2 files changed, 13 insertions, 5 deletions
diff --git a/examples/Send.c b/examples/Send.c
index cddb966..9ab7dfb 100644
--- a/examples/Send.c
+++ b/examples/Send.c
@@ -1,8 +1,7 @@
#include <matrix.h>
#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 "!koVStwyiiKcBVbXZYz:matrix.org"
int
@@ -14,14 +13,23 @@ main(void)
MatrixHttpInit(&client);
- MatrixClientSetAccessToken(&client,
- ACCESS_TOKEN);
+
+ MatrixClientSetUserId(&client, USER_ID);
+
+ MatrixClientLoginPassword(&client,
+ "pscho",
+ "Wc23EbmB9G3faMq",
+ "Test1");
+
MatrixClientSendEvent(&client,
ROOM_ID,
"m.room.message",
"{\"body\":\"Hello\",\"msgtype\":\"m.text\"}");
+
+ MatrixClientDeleteDevice(&client);
+
MatrixHttpDeinit(&client);
return 0;
diff --git a/examples/SendEncrypted.c b/examples/SendEncrypted.c
index df1d272..c2fda6c 100644
--- a/examples/SendEncrypted.c
+++ b/examples/SendEncrypted.c
@@ -34,7 +34,7 @@ main(void)
// create megolmsession
MatrixMegolmOutSession * megolmOutSession;
- MatrixClientGetMegolmOutSession(&client,
+ MatrixClientNewMegolmOutSession(&client,
ROOM_ID,
&megolmOutSession);
printf("megolm session id: %.10s... key: %.10s...\n", megolmOutSession->id, megolmOutSession->key);