diff options
Diffstat (limited to 'src/matrix.h')
| -rw-r--r-- | src/matrix.h | 106 |
1 files changed, 64 insertions, 42 deletions
diff --git a/src/matrix.h b/src/matrix.h index 4037f09..d31a7f6 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -49,7 +49,54 @@ #define NUM_MEGOLM_SESSIONS 10
#define NUM_OLM_SESSIONS 10
-#define NUM_DEVICES 100
+#define NUM_DEVICES 10
+
+// HTTP
+
+typedef struct MatrixHttpConnection MatrixHttpConnection;
+
+bool
+MatrixHttpInit(
+ MatrixHttpConnection ** hc,
+ const char * host);
+
+// bool
+// MatrixHttpConnect(
+// MatrixHttpConnection * hc);
+
+bool
+MatrixHttpDeinit(
+ MatrixHttpConnection ** hc);
+
+bool
+MatrixHttpSetAccessToken(
+ MatrixHttpConnection * hc,
+ const char * accessToken);
+
+bool
+MatrixHttpGet(
+ MatrixHttpConnection * hc,
+ const char * url,
+ char * outResponseBuffer, int outResponseCap,
+ bool authenticated);
+
+bool
+MatrixHttpPost(
+ MatrixHttpConnection * hc,
+ const char * url,
+ const char * requestBuffer,
+ char * outResponseBuffer, int outResponseCap,
+ bool authenticated);
+
+bool
+MatrixHttpPut(
+ MatrixHttpConnection * hc,
+ const char * url,
+ const char * requestBuffer,
+ char * outResponseBuffer, int outResponseCap,
+ bool authenticated);
+
+
// Matrix Device
@@ -212,19 +259,17 @@ typedef struct MatrixClient { // char signingKey[DEVICE_KEY_SIZE];
char userId[USER_ID_SIZE];
- char server[SERVER_SIZE];
char accessToken[ACCESS_TOKEN_SIZE];
char deviceId[DEVICE_ID_SIZE];
char expireMs[EXPIRE_MS_SIZE];
char refreshToken[REFRESH_TOKEN_SIZE];
- void * httpUserData;
+ MatrixHttpConnection * hc;
} MatrixClient;
bool
MatrixClientInit(
- MatrixClient * client,
- const char * server);
+ MatrixClient * client);
bool
MatrixClientSave(
@@ -360,6 +405,13 @@ MatrixClientGetOlmSessionIn( MatrixClient * client,
const char * userId,
const char * deviceId,
+ MatrixOlmSession ** outSession);
+
+bool
+MatrixClientNewOlmSessionIn(
+ MatrixClient * client,
+ const char * userId,
+ const char * deviceId,
const char * encrypted,
MatrixOlmSession ** outSession);
@@ -369,6 +421,13 @@ MatrixClientGetOlmSessionOut( const char * userId,
const char * deviceId,
MatrixOlmSession ** outSession);
+
+bool
+MatrixClientNewOlmSessionOut(
+ MatrixClient * client,
+ const char * userId,
+ const char * deviceId,
+ MatrixOlmSession ** outSession);
bool
MatrixClientSendToDevice(
@@ -413,43 +472,6 @@ MatrixClientDeleteDevice( MatrixClient * client);
-
-
-bool
-MatrixHttpInit(
- MatrixClient * client);
-
-bool
-MatrixHttpConnect(
- MatrixClient * client);
-
-bool
-MatrixHttpDeinit(
- MatrixClient * client);
-
-bool
-MatrixHttpGet(
- MatrixClient * client,
- const char * url,
- char * outResponseBuffer, int outResponseCap,
- bool authenticated);
-
-bool
-MatrixHttpPost(
- MatrixClient * client,
- const char * url,
- const char * requestBuffer,
- char * outResponseBuffer, int outResponseCap,
- bool authenticated);
-
-bool
-MatrixHttpPut(
- MatrixClient * client,
- const char * url,
- const char * requestBuffer,
- char * outResponseBuffer, int outResponseCap,
- bool authenticated);
-
// util
void
|
