diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-06-29 00:14:39 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-06-29 00:14:39 +0800 |
commit | b065c82627d83d1b207985d78276eb80f0b7b266 (patch) | |
tree | 9b86751008a4dc875e917a9cb9f143991296ea7c /device.c | |
parent | 1dd9eb4d4d22c5559646ee0bf4d243107bf4154a (diff) | |
download | matrix-curl-b065c82627d83d1b207985d78276eb80f0b7b266.tar.xz |
device
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/device.c b/device.c new file mode 100644 index 0000000..f5b9942 --- /dev/null +++ b/device.c @@ -0,0 +1,34 @@ +/* implements 11.9 Device Management + +GET /_matrix/client/r0/devices/{deviceId} +PUT /_matrix/client/r0/devices/{deviceId} +DELETE /_matrix/client/r0/devices/{deviceId} + +*/ + +#include <stdio.h> +#include "session.h" +#include "util.h" +#include "curl_util.h" + +void get_devices(matrix_session *sess) +{ + /* GET /_matrix/client/r0/devices */ + const char *u[] = { sess->url, + "/_matrix/client/r0/devices?access_token=", sess->token , NULL }; + const char *requrl = alloc_build_string(u); + json_object *resp; + _curl_get(sess->curl, requrl, &resp); + if (resp) { + printf("%s\n", json_object_to_json_string(resp)); + /* + const char *roomid = json_gets(resp, "room_id"); + if (roomid) { + const char *r = copy_str(roomid); + json_object_put(resp); + return r; + } + */ + } + json_object_put(resp); +} |