]> gitweb.ps.run Git - matrix_esp_thesis/blob - examples/Login.c
Initial commit. Rudimentary readme, mockup examples without actual implementation...
[matrix_esp_thesis] / examples / Login.c
1 #include <stdio.h>\r
2 #include <matrix.h>\r
3 \r
4 #define SERVER FixedBuf("matrix.org")\r
5 #define USERNAME FixedBuf("@pscho:matrix.org")\r
6 #define PASSWORD FixedBuf("abcde")\r
7 \r
8 \r
9 int\r
10 main(\r
11     int argc,\r
12     char **argv)\r
13 {\r
14     MatrixClient client;\r
15     MatrixClientInit(&client, SERVER);\r
16 \r
17     MatrixClientLoginPassword(&client,\r
18         USERNAME,\r
19         PASSWORD);\r
20 \r
21     static char accessTokenCharBuffer[ACCESS_TOKEN_LEN];\r
22     FixedBuffer accessTokenBuffer = { accessTokenCharBuffer, ACCESS_TOKEN_LEN, 0 };\r
23     MatrixClientGetAccessToken(&client, &accessTokenBuffer);\r
24     printf("Access Token: %.*s\n", accessTokenBuffer.len, (char *)accessTokenBuffer.ptr);\r
25 \r
26     return 0;\r
27 }