Add error parameter to MatrixClient prototypes
This commit is contained in:
parent
15ebaa3974
commit
258d7bec86
@ -61,6 +61,7 @@ matrix_client_default_init(MatrixClientInterface *iface)
|
|||||||
* @client: a #MatrixClient
|
* @client: a #MatrixClient
|
||||||
* @username: the username to login with
|
* @username: the username to login with
|
||||||
* @password: the password to use
|
* @password: the password to use
|
||||||
|
* @error: a location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Authenticate with the Matrix.org server with a username and
|
* Authenticate with the Matrix.org server with a username and
|
||||||
* password.
|
* password.
|
||||||
@ -68,12 +69,13 @@ matrix_client_default_init(MatrixClientInterface *iface)
|
|||||||
void
|
void
|
||||||
matrix_client_login_with_password(MatrixClient *client,
|
matrix_client_login_with_password(MatrixClient *client,
|
||||||
const gchar *username,
|
const gchar *username,
|
||||||
const gchar *password)
|
const gchar *password,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
||||||
|
|
||||||
MATRIX_CLIENT_GET_IFACE(client)
|
MATRIX_CLIENT_GET_IFACE(client)
|
||||||
->login_with_password(client, username, password);
|
->login_with_password(client, username, password, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,80 +84,88 @@ matrix_client_login_with_password(MatrixClient *client,
|
|||||||
* @username: (allow-none): the username to register. If omitted, the
|
* @username: (allow-none): the username to register. If omitted, the
|
||||||
* server will generate one
|
* server will generate one
|
||||||
* @password: the password to use with the registration
|
* @password: the password to use with the registration
|
||||||
|
* @error: a location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Register @username with the homeserver.
|
* Register @username with the homeserver.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
matrix_client_register_with_password(MatrixClient *client,
|
matrix_client_register_with_password(MatrixClient *client,
|
||||||
const gchar *username,
|
const gchar *username,
|
||||||
const gchar *password)
|
const gchar *password,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
||||||
|
|
||||||
MATRIX_CLIENT_GET_IFACE(client)
|
MATRIX_CLIENT_GET_IFACE(client)
|
||||||
->register_with_password(client, username, password);
|
->register_with_password(client, username, password, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* matrix_client_logout:
|
* matrix_client_logout:
|
||||||
* @client: a #MatrixClient
|
* @client: a #MatrixClient
|
||||||
|
* @error: a location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Logout from the homeserver. As Matrix.org doesn’t have such an
|
* Logout from the homeserver. As Matrix.org doesn’t have such an
|
||||||
* option, this cancels all ongoing requests and clears the
|
* option, this cancels all ongoing requests and clears the
|
||||||
* authentication data (e.g. tokens).
|
* authentication data (e.g. tokens).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
matrix_client_logout(MatrixClient *client)
|
matrix_client_logout(MatrixClient *client, GError **error)
|
||||||
{
|
{
|
||||||
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
||||||
|
|
||||||
MATRIX_CLIENT_GET_IFACE(client)
|
MATRIX_CLIENT_GET_IFACE(client)
|
||||||
->logout(client);
|
->logout(client, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* matrix_client_refresh_token:
|
* matrix_client_refresh_token:
|
||||||
* @client: a #MatrixClient
|
* @client: a #MatrixClient
|
||||||
|
* @error: a location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Request a new authentication token from the server.
|
* Request a new authentication token from the server.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
matrix_client_refresh_token(MatrixClient *client)
|
matrix_client_refresh_token(MatrixClient *client, GError **error)
|
||||||
{
|
{
|
||||||
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
||||||
|
|
||||||
MATRIX_CLIENT_GET_IFACE(client)
|
MATRIX_CLIENT_GET_IFACE(client)
|
||||||
->refresh_token(client);
|
->refresh_token(client, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* matrix_client_begin_polling:
|
* matrix_client_begin_polling:
|
||||||
* @client: a #MatrixClient
|
* @client: a #MatrixClient
|
||||||
|
* @error: a location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Begin polling the event stream.
|
* Begin polling the event stream.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
matrix_client_begin_polling(MatrixClient *client)
|
matrix_client_begin_polling(MatrixClient *client, GError **error)
|
||||||
{
|
{
|
||||||
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
||||||
|
|
||||||
MATRIX_CLIENT_GET_IFACE(client)
|
MATRIX_CLIENT_GET_IFACE(client)
|
||||||
->begin_polling(client);
|
->begin_polling(client, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* matrix_client_stop_polling:
|
* matrix_client_stop_polling:
|
||||||
* @client: a #MatrixClient
|
* @client: a #MatrixClient
|
||||||
* @cancel_ongoing: if %TRUE, ongoing requests will be cancelled, too
|
* @cancel_ongoing: if %TRUE, ongoing requests will be cancelled, too
|
||||||
|
* @error: a location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Stop polling the event stream. If @cancel_ongoing is %TRUE, ongoing
|
* Stop polling the event stream. If @cancel_ongoing is %TRUE, ongoing
|
||||||
* requests will be cancelled, too.
|
* requests will be cancelled, too.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
matrix_client_stop_polling(MatrixClient *client, gboolean cancel_ongoing)
|
matrix_client_stop_polling(MatrixClient *client,
|
||||||
|
gboolean cancel_ongoing,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
g_return_if_fail(MATRIX_IS_CLIENT(client));
|
||||||
|
|
||||||
MATRIX_CLIENT_GET_IFACE(client)
|
MATRIX_CLIENT_GET_IFACE(client)
|
||||||
->stop_polling(client, cancel_ongoing);
|
->stop_polling(client, cancel_ongoing, error);
|
||||||
}
|
}
|
||||||
|
@ -42,18 +42,19 @@ struct _MatrixClientInterface {
|
|||||||
/* Virtual table */
|
/* Virtual table */
|
||||||
void (*login_with_password)(MatrixClient *client,
|
void (*login_with_password)(MatrixClient *client,
|
||||||
const gchar *username,
|
const gchar *username,
|
||||||
const gchar *password);
|
const gchar *password,
|
||||||
|
GError **error);
|
||||||
void (*register_with_password)(MatrixClient *client,
|
void (*register_with_password)(MatrixClient *client,
|
||||||
const gchar *username,
|
const gchar *username,
|
||||||
const gchar *password);
|
const gchar *password,
|
||||||
void (*logout)(MatrixClient *client);
|
GError **error);
|
||||||
void (*refresh_token)(MatrixClient *client);
|
void (*logout)(MatrixClient *client, GError **error);
|
||||||
|
void (*refresh_token)(MatrixClient *client, GError **error);
|
||||||
|
|
||||||
void (*begin_polling)(MatrixClient *client);
|
void (*begin_polling)(MatrixClient *client, GError **error);
|
||||||
void (*stop_polling)(MatrixClient *client, gboolean cancel_ongoing);
|
void (*stop_polling)(MatrixClient *client,
|
||||||
|
gboolean cancel_ongoing,
|
||||||
void (*get_room)(MatrixClient *client, const gchar *room_id_or_alias);
|
GError **error);
|
||||||
void (*get_user)(MatrixClient *client, const gchar *user_id);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MatrixClientClass {
|
struct _MatrixClientClass {
|
||||||
@ -65,15 +66,19 @@ GType matrix_client_get_type(void) G_GNUC_CONST;
|
|||||||
|
|
||||||
void matrix_client_login_with_password(MatrixClient *client,
|
void matrix_client_login_with_password(MatrixClient *client,
|
||||||
const gchar *username,
|
const gchar *username,
|
||||||
const gchar *password);
|
const gchar *password,
|
||||||
|
GError **error);
|
||||||
void matrix_client_register_with_password(MatrixClient *client,
|
void matrix_client_register_with_password(MatrixClient *client,
|
||||||
const gchar *username,
|
const gchar *username,
|
||||||
const gchar *password);
|
const gchar *password,
|
||||||
void matrix_client_logout(MatrixClient *client);
|
GError **error);
|
||||||
void matrix_client_refresh_token(MatrixClient *client);
|
void matrix_client_logout(MatrixClient *client, GError **error);
|
||||||
|
void matrix_client_refresh_token(MatrixClient *client, GError **error);
|
||||||
|
|
||||||
void matrix_client_begin_polling(MatrixClient *client);
|
void matrix_client_begin_polling(MatrixClient *client, GError **error);
|
||||||
void matrix_client_stop_polling(MatrixClient *client, gboolean cancel_ongoing);
|
void matrix_client_stop_polling(MatrixClient *client,
|
||||||
|
gboolean cancel_ongoing,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user