+ // filter={\"event_fields\":[\"to_device\"]}\r
+ static char url[MAX_URL_LEN];\r
+ snprintf(url, MAX_URL_LEN,\r
+ "/_matrix/client/v3/sync%s",\r
+ strlen(nextBatch) > 0 ? "?since=" : "");\r
+ \r
+ int index = strlen(url);\r
+\r
+ for (int i = 0; i < strlen(nextBatch); i++) {\r
+ char c = nextBatch[i];\r
+\r
+ if (c == '~') {\r
+ url[index++] = '%';\r
+ url[index++] = '7';\r
+ url[index++] = 'E';\r
+ }\r
+ else {\r
+ url[index++] = c;\r
+ }\r
+ }\r
+ url[index] = '\0';\r
+\r