diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-06-28 22:09:39 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-06-28 22:09:39 +0800 |
commit | 1dd9eb4d4d22c5559646ee0bf4d243107bf4154a (patch) | |
tree | b8612d89e0079fce09016fab28ad88da3f0af27c | |
parent | b0e376b6ba1891fcf749d22095c4f79a843a5d0f (diff) | |
download | matrix-curl-1dd9eb4d4d22c5559646ee0bf4d243107bf4154a.tar.xz |
sync api
-rw-r--r-- | api.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -79,6 +79,19 @@ const char * matrix_resolv_alias(matrix_session *sess, const char *alias) return NULL; } +void matrix_sync(matrix_session *sess) +{ + char *_req[] = { sess->url, "/_matrix/client/r0/sync?access_token=", sess->token , NULL }; + char *requrl = alloc_build_string(_req); + json_object *resp; + + _curl_get(sess->curl, requrl, &resp); + if (resp) { + printf("%s\n", json_object_to_json_string(resp)); + } + json_object_put(resp); +} + int main() { curl_global_init(CURL_GLOBAL_ALL); @@ -111,6 +124,7 @@ int main() json_object *joined_rooms = matrix_joined_rooms(sess); printf("%s\n", json_object_to_json_string(joined_rooms)); + matrix_sync(sess); const char *roomid = matrix_resolv_alias(sess, "#hello:my.domain.name"); if (roomid == NULL) |