#include <matrix.h>\r
#include <stdio.h>\r
\r
-#define SERVER "https://matrix.org"\r
-#define USER_ID "@pscho:matrix.org"\r
-#define ROOM_ID "!XKFUjAsGrSSrpDFIxB:matrix.org"\r
+#define SERVER "https://matrix.org"\r
+#define USER_ID "@example:matrix.org"\r
+#define ROOM_ID "!example:matrix.org"\r
+#define USERNAME ""\r
+#define PASSWORD ""\r
+#define DEVICE_NAME ""\r
+\r
+// device id of another device to share the megolm session with\r
+// I used the device id of a logged in Element web session\r
+#define DEVICE_ID2 ""\r
\r
int\r
main(void)\r
MatrixClientSetUserId(&client, USER_ID);\r
\r
MatrixClientLoginPassword(&client,\r
- "pscho",\r
- "Wc23EbmB9G3faMq",\r
- "Test1");\r
+ USERNAME,\r
+ PASSWORD,\r
+ DEVICE_NAME);\r
\r
MatrixClientUploadDeviceKeys(&client);\r
MatrixClientGenerateOnetimeKeys(&client, 10);\r
MatrixClientUploadOnetimeKeys(&client);\r
\r
- // // get device key\r
- // static char deviceKey[128];\r
- // MatrixClientGetDeviceKey(&client,\r
- // "ULZZOKJBYN",\r
- // deviceKey, 128);\r
- // printf("device key for %s: %s\n", "ULZZOKJBYN", deviceKey);\r
-\r
// create megolmsession\r
MatrixMegolmOutSession * megolmOutSession;\r
MatrixClientNewMegolmOutSession(&client,\r
&megolmOutSession);\r
printf("megolm session id: %.10s... key: %.10s...\n", megolmOutSession->id, megolmOutSession->key);\r
\r
- // // create olmsession\r
- // MatrixOlmSession * olmSession;\r
- // MatrixClientGetOlmSession(&client,\r
- // USER_ID,\r
- // "ULZZOKJBYN",\r
- // &olmSession);\r
- // printf("olm session created\n");\r
-\r
MatrixClientShareMegolmOutSession(&client,\r
USER_ID,\r
- "ULZZOKJBYN",\r
+ DEVICE_ID2,\r
megolmOutSession);\r
- // MatrixClientShareMegolmOutSessionTest(&client,\r
- // USER_ID,\r
- // "ULZZOKJBYN",\r
- // megolmOutSession);\r
\r
MatrixClientSendEventEncrypted(&client,\r
ROOM_ID,\r