Implement get_presence_list
This commit is contained in:
parent
a037cb7aad
commit
0b003dd612
@ -583,7 +583,8 @@ _response_callback(SoupSession *session,
|
||||
message);
|
||||
}
|
||||
}
|
||||
} else { // Not a JSON object
|
||||
} else if (!JSON_NODE_HOLDS_ARRAY(content)) {
|
||||
// Not a JSON object, neither an array
|
||||
err = g_error_new(MATRIX_API_ERROR,
|
||||
MATRIX_API_ERROR_BAD_RESPONSE,
|
||||
"Bad response (not a JSON object)");
|
||||
@ -991,6 +992,27 @@ i_join_room(MatrixAPI *api,
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
static void
|
||||
i_get_presence_list(MatrixAPI *api,
|
||||
MatrixAPICallback callback,
|
||||
gpointer user_data,
|
||||
const gchar *user_id,
|
||||
GError **error)
|
||||
{
|
||||
gchar *encoded_user_id;
|
||||
gchar *path;
|
||||
|
||||
encoded_user_id = soup_uri_encode(user_id, NULL);
|
||||
path = g_strdup_printf("presence/list/%s", encoded_user_id);
|
||||
g_free(encoded_user_id);
|
||||
|
||||
_send(MATRIX_HTTP_API(api),
|
||||
callback, user_data,
|
||||
"GET", path, NULL, NULL,
|
||||
error);
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
static void
|
||||
matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
|
||||
{
|
||||
@ -1007,7 +1029,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
|
||||
iface->media_upload = NULL;
|
||||
|
||||
/* Presence */
|
||||
iface->get_presence_list = NULL;
|
||||
iface->get_presence_list = i_get_presence_list;
|
||||
iface->update_presence_list = NULL;
|
||||
iface->get_user_presence = NULL;
|
||||
iface->set_user_presence = NULL;
|
||||
|
@ -102,6 +102,7 @@ login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError *err)
|
||||
"GLib SDK test room",
|
||||
MATRIX_API_ROOM_VISIBILITY_DEFAULT,
|
||||
NULL, NULL, NULL, NULL);
|
||||
matrix_api_get_presence_list(api, NULL, NULL, user_id, NULL);
|
||||
} else {
|
||||
g_printf("Login unsuccessful!\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user