]> gitweb.ps.run Git - matrix_esp_thesis/blob - src/matrix.h
d61c59ba61756be1797241acbcc3d8fb61b5fa17
[matrix_esp_thesis] / src / matrix.h
1 #ifndef MATRIX__H\r
2 #define MATRIX__H\r
3 \r
4 #include <stdbool.h>\r
5 #include <string.h>\r
6 \r
7 #include <olm/olm.h>\r
8 \r
9 \r
10 \r
11 \r
12 \r
13 typedef struct FixedBuffer {\r
14     void * ptr;\r
15     int size;\r
16     int len;\r
17 } FixedBuffer;\r
18 \r
19 FixedBuffer\r
20 FixedBuf(const char * str);\r
21 \r
22 \r
23 \r
24 #define ACCESS_TOKEN_LEN 20 // TODO: fix\r
25 \r
26 typedef struct MatrixClient {\r
27     OlmAccount * olmAcc;\r
28     char accessToken[ACCESS_TOKEN_LEN];\r
29 } MatrixClient;\r
30 \r
31 bool\r
32 MatrixClientInit(\r
33     MatrixClient * client,\r
34     FixedBuffer server\r
35 );\r
36 \r
37 bool\r
38 MatrixClientLoginPassword(\r
39     MatrixClient * client,\r
40     FixedBuffer username,\r
41     FixedBuffer password\r
42 );\r
43 \r
44 bool\r
45 MatrixClientGetAccessToken(\r
46     MatrixClient * client,\r
47     FixedBuffer * outBuffer\r
48 );\r
49 \r
50 #endif\r