diff options
| author | Patrick | 2023-05-15 18:47:59 +0200 |
|---|---|---|
| committer | Patrick | 2023-05-15 18:47:59 +0200 |
| commit | d43e8671acc5709c192e159e0d91626f0677cdf1 (patch) | |
| tree | 85d2c65ddb3c36bea1e9ea814cf9434e52fcae97 /examples/Login.c | |
| download | matrix_esp_thesis-d43e8671acc5709c192e159e0d91626f0677cdf1.tar.gz matrix_esp_thesis-d43e8671acc5709c192e159e0d91626f0677cdf1.zip | |
Initial commit. Rudimentary readme, mockup examples without actual implementation, Makefile, Olm submodule
Diffstat (limited to 'examples/Login.c')
| -rw-r--r-- | examples/Login.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/Login.c b/examples/Login.c new file mode 100644 index 0000000..5f07e87 --- /dev/null +++ b/examples/Login.c @@ -0,0 +1,27 @@ +#include <stdio.h>
+#include <matrix.h>
+
+#define SERVER FixedBuf("matrix.org")
+#define USERNAME FixedBuf("@pscho:matrix.org")
+#define PASSWORD FixedBuf("abcde")
+
+
+int
+main(
+ int argc,
+ char **argv)
+{
+ MatrixClient client;
+ MatrixClientInit(&client, SERVER);
+
+ MatrixClientLoginPassword(&client,
+ USERNAME,
+ PASSWORD);
+
+ static char accessTokenCharBuffer[ACCESS_TOKEN_LEN];
+ FixedBuffer accessTokenBuffer = { accessTokenCharBuffer, ACCESS_TOKEN_LEN, 0 };
+ MatrixClientGetAccessToken(&client, &accessTokenBuffer);
+ printf("Access Token: %.*s\n", accessTokenBuffer.len, (char *)accessTokenBuffer.ptr);
+
+ return 0;
+}
\ No newline at end of file |
