Implement update_presence_list
This commit is contained in:
parent
74ec6100c9
commit
22ad1b30d6
@ -1229,6 +1229,53 @@ i_media_upload(MatrixAPI *api,
|
||||
FALSE, error);
|
||||
}
|
||||
|
||||
static void
|
||||
i_update_presence_list(MatrixAPI *api,
|
||||
MatrixAPICallback callback,
|
||||
gpointer user_data,
|
||||
const gchar *user_id,
|
||||
GList *drop_ids,
|
||||
GList *invite_ids,
|
||||
GError **error)
|
||||
{
|
||||
gchar *encoded_user_id;
|
||||
gchar *path;
|
||||
JsonBuilder *builder;
|
||||
JsonNode *body;
|
||||
|
||||
encoded_user_id = soup_uri_encode(user_id, NULL);
|
||||
path = g_strdup_printf("presence/%s/status", encoded_user_id);
|
||||
g_free(encoded_user_id);
|
||||
|
||||
builder = json_builder_new();
|
||||
json_builder_begin_object(builder);
|
||||
|
||||
if (drop_ids) {
|
||||
json_builder_set_member_name(builder, "drop");
|
||||
json_builder_begin_array(builder);
|
||||
g_list_foreach(drop_ids, (GFunc)add_string, builder);
|
||||
json_builder_end_array(builder);
|
||||
}
|
||||
|
||||
if (invite_ids) {
|
||||
json_builder_set_member_name(builder, "invide");
|
||||
json_builder_begin_array(builder);
|
||||
g_list_foreach(invite_ids, (GFunc)add_string, builder);
|
||||
json_builder_end_array(builder);
|
||||
}
|
||||
|
||||
json_builder_end_object(builder);
|
||||
body = json_builder_get_root(builder);
|
||||
g_object_unref(builder);
|
||||
|
||||
_send(MATRIX_HTTP_API(api),
|
||||
callback, user_data,
|
||||
CALL_API,
|
||||
"POST", path, NULL, NULL, body, NULL,
|
||||
FALSE, error);
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
static void
|
||||
matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
|
||||
{
|
||||
@ -1246,7 +1293,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
|
||||
|
||||
/* Presence */
|
||||
iface->get_presence_list = i_get_presence_list;
|
||||
iface->update_presence_list = NULL;
|
||||
iface->update_presence_list = i_update_presence_list;
|
||||
iface->get_user_presence = i_get_user_presence;
|
||||
iface->set_user_presence = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user