]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - examples/Login.c
update Makefile
[matrix_esp_thesis] / examples / Login.c
index 5f07e87c0ff737fc5b02437f05d730a2337dfd68..08f981af0d582c66b4c2150e11e55044e60c61a6 100644 (file)
@@ -1,27 +1,31 @@
 #include <stdio.h>\r
 #include <matrix.h>\r
 \r
-#define SERVER FixedBuf("matrix.org")\r
-#define USERNAME FixedBuf("@pscho:matrix.org")\r
-#define PASSWORD FixedBuf("abcde")\r
+#define SERVER      "https://matrix.org"\r
+#define USERNAME    "pscho"\r
+#define PASSWORD    "Wc23EbmB9G3faMq"\r
+#define DISPLAYNAME "MatrixClient"\r
 \r
 \r
 int\r
-main(\r
-    int argc,\r
-    char **argv)\r
+main(void)\r
 {\r
     MatrixClient client;\r
-    MatrixClientInit(&client, SERVER);\r
+    MatrixClientInit(&client);\r
+    \r
+    MatrixHttpInit(&client.hc, SERVER);\r
 \r
     MatrixClientLoginPassword(&client,\r
         USERNAME,\r
-        PASSWORD);\r
+        PASSWORD,\r
+        DISPLAYNAME);\r
 \r
-    static char accessTokenCharBuffer[ACCESS_TOKEN_LEN];\r
-    FixedBuffer accessTokenBuffer = { accessTokenCharBuffer, ACCESS_TOKEN_LEN, 0 };\r
-    MatrixClientGetAccessToken(&client, &accessTokenBuffer);\r
-    printf("Access Token: %.*s\n", accessTokenBuffer.len, (char *)accessTokenBuffer.ptr);\r
+    printf("Access Token: %s\n", client.accessToken);\r
+    printf("Device ID: %s\n", client.deviceId);\r
+    printf("Expires in (ms): %s\n", client.expireMs);\r
+    printf("Refresh Token: %s\n", client.refreshToken);\r
+    \r
+    MatrixHttpDeinit(&client.hc);\r
 \r
     return 0;\r
-}
\ No newline at end of file
+}\r