abouttreesummaryrefslogcommitdiff
path: root/src/matrix.c
diff options
context:
space:
mode:
authorPatrick2023-09-05 17:08:25 +0200
committerPatrick2023-09-05 17:08:25 +0200
commit504241758d7b832af61939beaf61b0e0574174c4 (patch)
treee0956d4a52c1f9504896f93d92d57d9693d613e2 /src/matrix.c
parent30bde47d1d5d9b6f0b59c318ff16caed6268d1a8 (diff)
downloadmatrix_esp_thesis-504241758d7b832af61939beaf61b0e0574174c4.tar.gz
matrix_esp_thesis-504241758d7b832af61939beaf61b0e0574174c4.zip
start working on Sync example (reply to to_device messages)
Diffstat (limited to 'src/matrix.c')
-rw-r--r--src/matrix.c27
1 files changed, 25 insertions, 2 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);
}