Implement MatrixClient.register_with_password

This commit is contained in:
Gergely Polonkai 2016-01-22 15:16:05 +01:00
parent 61132c5ab5
commit 65213319d3
1 changed files with 26 additions and 1 deletions

View File

@ -93,11 +93,36 @@ i_login_with_password(MatrixClient *client,
error);
}
static void
cb_register_account(MatrixAPI *api,
const gchar *content_type,
JsonNode *json_content,
GByteArray *raw_content,
gpointer user_data,
GError *error)
{
matrix_client_login_finished(MATRIX_CLIENT(api), (error == NULL));
}
static void
i_register_with_password(MatrixClient *client,
const gchar *username,
const gchar *password,
GError **error)
{
matrix_api_register_account(MATRIX_API(client),
cb_register_account, NULL,
MATRIX_ACCOUNT_KIND_USER,
FALSE,
username, password,
error);
}
static void
matrix_http_client_matrix_client_init(MatrixClientInterface *iface)
{
iface->login_with_password = i_login_with_password;
iface->register_with_password = NULL;
iface->register_with_password = i_register_with_password;
iface->logout = NULL;
iface->begin_polling = NULL;
iface->stop_polling = NULL;