diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/matrix.c | 27 | ||||
| -rw-r--r-- | src/matrix.h | 5 | ||||
| -rw-r--r-- | src/matrix_http_mongoose.c | 4 |
3 files changed, 32 insertions, 4 deletions
diff --git a/src/matrix.c b/src/matrix.c index 18b700a..147d919 100644 --- a/src/matrix.c +++ b/src/matrix.c @@ -842,11 +842,34 @@ MatrixClientSendEventEncrypted( bool
MatrixClientSync(
MatrixClient * client,
- char * outSyncBuffer, int outSyncCap)
+ char * outSyncBuffer, int outSyncCap,
+ const char * nextBatch)
{
+ // filter={\"event_fields\":[\"to_device\"]}
+ static char url[MAX_URL_LEN];
+ snprintf(url, MAX_URL_LEN,
+ "/_matrix/client/v3/sync%s",
+ strlen(nextBatch) > 0 ? "?since=" : "");
+
+ int index = strlen(url);
+
+ for (int i = 0; i < strlen(nextBatch); i++) {
+ char c = nextBatch[i];
+
+ if (c == '~') {
+ url[index++] = '%';
+ url[index++] = '7';
+ url[index++] = 'E';
+ }
+ else {
+ url[index++] = c;
+ }
+ }
+ url[index] = '\0';
+
return
MatrixHttpGet(client,
- "/_matrix/client/v3/sync",
+ url,
outSyncBuffer, outSyncCap,
true);
}
diff --git a/src/matrix.h b/src/matrix.h index 20cdc8c..da0e859 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -17,7 +17,7 @@ #define DEVICE_ID_SIZE 20
#define EXPIRE_MS_SIZE 20
#define REFRESH_TOKEN_SIZE 20
-#define MAX_URL_LEN 128
+#define MAX_URL_LEN 1024
#define OLM_IDENTITY_KEYS_JSON_SIZE 128
#define DEVICE_KEY_SIZE 44
@@ -275,7 +275,8 @@ MatrixClientSendEventEncrypted( bool
MatrixClientSync(
MatrixClient * client,
- char * outSync, int outSyncCap);
+ char * outSync, int outSyncCap,
+ const char * nextBatch);
bool
MatrixClientGetRoomEvent(
diff --git a/src/matrix_http_mongoose.c b/src/matrix_http_mongoose.c index b9b2ca3..452e26c 100644 --- a/src/matrix_http_mongoose.c +++ b/src/matrix_http_mongoose.c @@ -44,6 +44,10 @@ MatrixHttpCallback( conn->connection = c;
conn->connected = true;
}
+ if (ev == MG_EV_HTTP_CHUNK)
+ {
+
+ }
if (ev == MG_EV_HTTP_MSG)
{
// Response
|
