Add create room to test client

This commit is contained in:
Gergely Polonkai 2015-12-15 13:31:08 +01:00
parent 1834d8ada9
commit ded4fc04bd

View File

@ -30,6 +30,15 @@ static GOptionEntry entries[] = {
{"password", 'p', 0, G_OPTION_ARG_STRING, &password}, {"password", 'p', 0, G_OPTION_ARG_STRING, &password},
}; };
static void
create_room_finished(MatrixAPI *api,
JsonNode *content,
gpointer data,
GError *err)
{
g_printf("Room registered\n");
}
static void static void
login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError *err) login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError *err)
{ {
@ -58,6 +67,11 @@ login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError *err)
user_id = json_array_get_string_element(array, 0); user_id = json_array_get_string_element(array, 0);
g_printf("Logged in as %s\n", user_id); g_printf("Logged in as %s\n", user_id);
matrix_http_api_create_room(api,
create_room_finished, NULL,
"matrix-glib-sdk-test", TRUE,
NULL);
} else { } else {
g_printf("Login unsuccessful!\n"); g_printf("Login unsuccessful!\n");
} }
@ -98,7 +112,7 @@ main(int argc, char *argv[])
/* /*
* [ ] register * [ ] register
* [X] login * [X] login
* [ ] create_room * [X] create_room
* [ ] join_room * [ ] join_room
*/ */
api = matrix_http_api_new(url, NULL); api = matrix_http_api_new(url, NULL);