Rename MatrixAPIError to MatrixError

This commit is contained in:
Gergely Polonkai 2016-01-25 12:17:44 +01:00
parent fbb24e3acc
commit d3ac019188
5 changed files with 175 additions and 181 deletions

View File

@ -22,8 +22,8 @@ matrix_client_get_type
<TITLE>Fundamental types for the Matrix GLib SDK</TITLE> <TITLE>Fundamental types for the Matrix GLib SDK</TITLE>
<SUBSECTION> <SUBSECTION>
MatrixAPIError MatrixError
MATRIX_API_ERROR MATRIX_ERROR
<SUBSECTION> <SUBSECTION>
MatrixAPIEventFormat MatrixAPIEventFormat
@ -296,8 +296,8 @@ matrix_api_abort_pending
<SUBSECTION Standard> <SUBSECTION Standard>
MatrixAPI MatrixAPI
MATRIX_TYPE_API_ERROR MATRIX_TYPE_ERROR
matrix_api_error_get_type matrix_error_get_type
MATRIX_TYPE_API MATRIX_TYPE_API
MATRIX_API MATRIX_API
MATRIX_IS_API MATRIX_IS_API
@ -306,7 +306,7 @@ MatrixApiPrivate
matrix_api_get_type matrix_api_get_type
<SUBSECTION Private> <SUBSECTION Private>
matrix_api_error_quark matrix_error_quark
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -331,7 +331,7 @@ matrix_api_get_homeserver(MatrixAPI *api)
* Download content from the content repository. * Download content from the content repository.
* *
* If @server_name or @media_id is %NULL, this function returns * If @server_name or @media_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_media_download(MatrixAPI *api, matrix_api_media_download(MatrixAPI *api,
@ -345,7 +345,7 @@ matrix_api_media_download(MatrixAPI *api,
if (!server_name || !media_id) { if (!server_name || !media_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"server_name and media_id must be specified."); "server_name and media_id must be specified.");
return; return;
@ -379,7 +379,7 @@ matrix_api_media_download(MatrixAPI *api,
* specified. * specified.
* *
* If @server_name or @media_id is %NULL, this function returns * If @server_name or @media_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_media_thumbnail(MatrixAPI *api, matrix_api_media_thumbnail(MatrixAPI *api,
@ -396,7 +396,7 @@ matrix_api_media_thumbnail(MatrixAPI *api,
if (!server_name || !media_id) { if (!server_name || !media_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"server_name and media_id must be specified."); "server_name and media_id must be specified.");
return; return;
@ -425,7 +425,7 @@ matrix_api_media_thumbnail(MatrixAPI *api,
* Upload some content to the content repository. * Upload some content to the content repository.
* *
* If @content is %NULL, this function returns immediately, and fills * If @content is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_media_upload(MatrixAPI *api, matrix_api_media_upload(MatrixAPI *api,
@ -439,7 +439,7 @@ matrix_api_media_upload(MatrixAPI *api,
if (!content) { if (!content) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"content must be set."); "content must be set.");
return; return;
@ -464,7 +464,7 @@ matrix_api_media_upload(MatrixAPI *api,
* Retrieve a list of presence events for every user on this list. * Retrieve a list of presence events for every user on this list.
* *
* If @user_id is %NULL, this function returns immediately, and fills * If @user_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_presence_list(MatrixAPI *api, matrix_api_get_presence_list(MatrixAPI *api,
@ -477,7 +477,7 @@ matrix_api_get_presence_list(MatrixAPI *api,
if (!user_id) { if (!user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set."); "user_id must be set.");
return; return;
@ -505,7 +505,7 @@ matrix_api_get_presence_list(MatrixAPI *api,
* *
* If @user_id, or both @drop_ids and @invite_ids are %NULL, this * If @user_id, or both @drop_ids and @invite_ids are %NULL, this
* function returns immediately, and fills @error with * function returns immediately, and fills @error with
* %MATRIX_API_ERROR_INCOMPLETE. * %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_update_presence_list(MatrixAPI *api, matrix_api_update_presence_list(MatrixAPI *api,
@ -520,7 +520,7 @@ matrix_api_update_presence_list(MatrixAPI *api,
if (!user_id || (!drop_ids && !invite_ids)) { if (!user_id || (!drop_ids && !invite_ids)) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set, so as at least one of drop_ids or invite_ids"); "user_id must be set, so as at least one of drop_ids or invite_ids");
return; return;
@ -545,7 +545,7 @@ matrix_api_update_presence_list(MatrixAPI *api,
* Get the given user's presence state. * Get the given user's presence state.
* *
* If @user_id is %NULL, this function returns immediately, and fills * If @user_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_user_presence(MatrixAPI *api, matrix_api_get_user_presence(MatrixAPI *api,
@ -558,7 +558,7 @@ matrix_api_get_user_presence(MatrixAPI *api,
if (!user_id) { if (!user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set."); "user_id must be set.");
return; return;
@ -587,7 +587,7 @@ matrix_api_get_user_presence(MatrixAPI *api,
* another user. * another user.
* *
* If @user_id is %NULL, this function returns immediately, and fills * If @user_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_set_user_presence(MatrixAPI *api, matrix_api_set_user_presence(MatrixAPI *api,
@ -602,7 +602,7 @@ matrix_api_set_user_presence(MatrixAPI *api,
if (!user_id) { if (!user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set."); "user_id must be set.");
return; return;
@ -631,7 +631,7 @@ matrix_api_set_user_presence(MatrixAPI *api,
* homeserver. * homeserver.
* *
* If @pusher is %NULL, this function returns immediately, and fills * If @pusher is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_update_pusher(MatrixAPI *api, matrix_api_update_pusher(MatrixAPI *api,
@ -644,7 +644,7 @@ matrix_api_update_pusher(MatrixAPI *api,
if (!pusher) { if (!pusher) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"pusher must be set."); "pusher must be set.");
return; return;
@ -696,7 +696,7 @@ matrix_api_get_pushers(MatrixAPI *api,
* Delete a push rule. * Delete a push rule.
* *
* If @scope or @rule_id is %NULL, this function returns immediately, * If @scope or @rule_id is %NULL, this function returns immediately,
* and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_delete_pusher(MatrixAPI *api, matrix_api_delete_pusher(MatrixAPI *api,
@ -711,7 +711,7 @@ matrix_api_delete_pusher(MatrixAPI *api,
if (!scope || !rule_id) { if (!scope || !rule_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"scope and rule_id must be set."); "scope and rule_id must be set.");
return; return;
@ -740,7 +740,7 @@ matrix_api_delete_pusher(MatrixAPI *api,
* Retrieve a specific push rule. * Retrieve a specific push rule.
* *
* If @scope or @rule_id is %NULL, this function returns immediately, * If @scope or @rule_id is %NULL, this function returns immediately,
* and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_pusher(MatrixAPI *api, matrix_api_get_pusher(MatrixAPI *api,
@ -755,7 +755,7 @@ matrix_api_get_pusher(MatrixAPI *api,
if (!scope || !rule_id) { if (!scope || !rule_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"scope and rule_id must be set."); "scope and rule_id must be set.");
return; return;
@ -795,7 +795,7 @@ matrix_api_get_pusher(MatrixAPI *api,
* *
* If either @scope, @rule_id or @actions are %NULL, this * If either @scope, @rule_id or @actions are %NULL, this
* function returns immediately, and fills @error with * function returns immediately, and fills @error with
* %MATRIX_API_ERROR_INCOMPLETE. * %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_add_pusher(MatrixAPI *api, matrix_api_add_pusher(MatrixAPI *api,
@ -814,7 +814,7 @@ matrix_api_add_pusher(MatrixAPI *api,
if (!scope || !rule_id || !actions) { if (!scope || !rule_id || !actions) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"scope, rule_id and actions must be set."); "scope, rule_id and actions must be set.");
return; return;
@ -847,7 +847,7 @@ matrix_api_add_pusher(MatrixAPI *api,
* Enable or disable the specified push rule. * Enable or disable the specified push rule.
* *
* If @scope or @rule_id is %NULL, this function returns immediately, * If @scope or @rule_id is %NULL, this function returns immediately,
* and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void matrix_api_toggle_pusher(MatrixAPI *api, void matrix_api_toggle_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
@ -862,7 +862,7 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
if (!scope || !rule_id) { if (!scope || !rule_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"scope and rule_id must be set."); "scope and rule_id must be set.");
return; return;
@ -946,7 +946,7 @@ matrix_api_create_room(MatrixAPI *api,
* creator or a server administrator. * creator or a server administrator.
* *
* If @room_alias is %NULL, this function returns immediately, and * If @room_alias is %NULL, this function returns immediately, and
* fills @error with %MATRIX_API_ERROR_INCOMPLETE. * fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_delete_room_alias(MatrixAPI *api, matrix_api_delete_room_alias(MatrixAPI *api,
@ -959,7 +959,7 @@ matrix_api_delete_room_alias(MatrixAPI *api,
if (!room_alias) { if (!room_alias) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_alias must be set."); "room_alias must be set.");
return; return;
@ -982,7 +982,7 @@ matrix_api_delete_room_alias(MatrixAPI *api,
* Get the room ID corresponding to this room alias. * Get the room ID corresponding to this room alias.
* *
* If @room_alias is %NULL, this function returns immediately, and * If @room_alias is %NULL, this function returns immediately, and
* fills @error with %MATRIX_API_ERROR_INCOMPLETE. * fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_room_id(MatrixAPI *api, matrix_api_get_room_id(MatrixAPI *api,
@ -995,7 +995,7 @@ matrix_api_get_room_id(MatrixAPI *api,
if (!room_alias) { if (!room_alias) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_alias must be set."); "room_alias must be set.");
return; return;
@ -1019,7 +1019,7 @@ matrix_api_get_room_id(MatrixAPI *api,
* Create a new mapping from room alias to room ID. * Create a new mapping from room alias to room ID.
* *
* If @room_alias or @room_id is %NULL, this function returns * If @room_alias or @room_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_create_room_alias(MatrixAPI *api, matrix_api_create_room_alias(MatrixAPI *api,
@ -1033,7 +1033,7 @@ matrix_api_create_room_alias(MatrixAPI *api,
if (!room_alias || !room_id) { if (!room_alias || !room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_alias and room_id must be set."); "room_alias and room_id must be set.");
return; return;
@ -1089,7 +1089,7 @@ matrix_api_list_public_rooms(MatrixAPI *api,
* can be specified. * can be specified.
* *
* If @room_id or @user_id is %NULL, this function returns * If @room_id or @user_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_ban_user(MatrixAPI *api, matrix_api_ban_user(MatrixAPI *api,
@ -1104,7 +1104,7 @@ matrix_api_ban_user(MatrixAPI *api,
if (!room_id || !user_id) { if (!room_id || !user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id and user_id must be set."); "room_id and user_id must be set.");
return; return;
@ -1135,7 +1135,7 @@ matrix_api_ban_user(MatrixAPI *api,
* leave the room as part of this API call. * leave the room as part of this API call.
* *
* If @room_id is %NULL, this function returns immediately, and fills * If @room_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_forget_room(MatrixAPI *api, matrix_api_forget_room(MatrixAPI *api,
@ -1148,7 +1148,7 @@ matrix_api_forget_room(MatrixAPI *api,
if (!room_id) { if (!room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id must be set."); "room_id must be set.");
return; return;
@ -1179,7 +1179,7 @@ matrix_api_forget_room(MatrixAPI *api,
* of the third party identifier. * of the third party identifier.
* *
* If @credential is %NULL, this function immediately returns, and * If @credential is %NULL, this function immediately returns, and
* fills @error with %MATRIX_API_ERROR_INCOMPLETE. * fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void matrix_api_invite_user_3rdparty(MatrixAPI *api, void matrix_api_invite_user_3rdparty(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
@ -1192,7 +1192,7 @@ void matrix_api_invite_user_3rdparty(MatrixAPI *api,
if (!credential) { if (!credential) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"credential must be set."); "credential must be set.");
return; return;
@ -1219,7 +1219,7 @@ void matrix_api_invite_user_3rdparty(MatrixAPI *api,
* Invite a user to a room. * Invite a user to a room.
* *
* If @room_id or @user_id is %NULL, this function returns * If @room_id or @user_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_invite_user(MatrixAPI *api, matrix_api_invite_user(MatrixAPI *api,
@ -1233,7 +1233,7 @@ matrix_api_invite_user(MatrixAPI *api,
if (!room_id || !user_id) { if (!room_id || !user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id and user_id must be set."); "room_id and user_id must be set.");
return; return;
@ -1256,7 +1256,7 @@ matrix_api_invite_user(MatrixAPI *api,
* Join a room. * Join a room.
* *
* If @room_id is %NULL, this function returns immediately, and fills * If @room_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_join_room(MatrixAPI *api, matrix_api_join_room(MatrixAPI *api,
@ -1269,7 +1269,7 @@ matrix_api_join_room(MatrixAPI *api,
if (!room_id) { if (!room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id must be set."); "room_id must be set.");
return; return;
@ -1292,7 +1292,7 @@ matrix_api_join_room(MatrixAPI *api,
* Leave a room. * Leave a room.
* *
* If @room_id is %NULL, this function returns immediately, and fills * If @room_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_leave_room(MatrixAPI *api, matrix_api_leave_room(MatrixAPI *api,
@ -1305,7 +1305,7 @@ matrix_api_leave_room(MatrixAPI *api,
if (!room_id) { if (!room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id must be set."); "room_id must be set.");
return; return;
@ -1357,7 +1357,7 @@ matrix_api_event_stream(MatrixAPI *api,
* Get a single event by event ID. * Get a single event by event ID.
* *
* If @event_id is %NULL, this function returns immediately, and fills * If @event_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_event(MatrixAPI *api, matrix_api_get_event(MatrixAPI *api,
@ -1370,7 +1370,7 @@ matrix_api_get_event(MatrixAPI *api,
if (!event_id) { if (!event_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"event_id must be set."); "event_id must be set.");
return; return;
@ -1424,7 +1424,7 @@ matrix_api_initial_sync(MatrixAPI *api,
* specified event. * specified event.
* *
* If @room_id or @event_id is %NULL, this function returns * If @room_id or @event_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_event_context(MatrixAPI *api, matrix_api_get_event_context(MatrixAPI *api,
@ -1439,7 +1439,7 @@ matrix_api_get_event_context(MatrixAPI *api,
if (!room_id || !event_id) { if (!room_id || !event_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id and event_id must be set."); "room_id and event_id must be set.");
return; return;
@ -1465,7 +1465,7 @@ matrix_api_get_event_context(MatrixAPI *api,
* room. * room.
* *
* If @room_id is %NULL, this function returns immediately, and fills * If @room_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_initial_sync_room(MatrixAPI *api, matrix_api_initial_sync_room(MatrixAPI *api,
@ -1478,7 +1478,7 @@ matrix_api_initial_sync_room(MatrixAPI *api,
if (!room_id) { if (!room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id must be set."); "room_id must be set.");
return; return;
@ -1501,7 +1501,7 @@ matrix_api_initial_sync_room(MatrixAPI *api,
* Get the list of members for a room. * Get the list of members for a room.
* *
* If @room_id is %NULL, this function returns immediately, and fills * If @room_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_list_room_members(MatrixAPI *api, matrix_api_list_room_members(MatrixAPI *api,
@ -1514,7 +1514,7 @@ matrix_api_list_room_members(MatrixAPI *api,
if (!room_id) { if (!room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id must be set."); "room_id must be set.");
return; return;
@ -1543,7 +1543,7 @@ matrix_api_list_room_members(MatrixAPI *api,
* Get a list of message and state events for a room. * Get a list of message and state events for a room.
* *
* If @room_id or @from_token is %NULL, this function returns * If @room_id or @from_token is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_list_room_messages(MatrixAPI *api, matrix_api_list_room_messages(MatrixAPI *api,
@ -1559,7 +1559,7 @@ matrix_api_list_room_messages(MatrixAPI *api,
if (!room_id || !from_token) { if (!room_id || !from_token) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id and from_token must be set."); "room_id and from_token must be set.");
return; return;
@ -1590,7 +1590,7 @@ matrix_api_list_room_messages(MatrixAPI *api,
* specified. * specified.
* *
* If @room_id, @event_id or @receipt is %NULL, this function returns * If @room_id, @event_id or @receipt is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_send_event_receipt(MatrixAPI *api, matrix_api_send_event_receipt(MatrixAPI *api,
@ -1606,7 +1606,7 @@ matrix_api_send_event_receipt(MatrixAPI *api,
if (!room_id || !event_id || !receipt) { if (!room_id || !event_id || !receipt) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id, event_id and receipt must be set."); "room_id, event_id and receipt must be set.");
return; return;
@ -1643,7 +1643,7 @@ matrix_api_send_event_receipt(MatrixAPI *api,
* room may redact events there. * room may redact events there.
* *
* If @room_id, @event_id or @txn_id is %NULL, this function returns * If @room_id, @event_id or @txn_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_redact_event(MatrixAPI *api, matrix_api_redact_event(MatrixAPI *api,
@ -1659,7 +1659,7 @@ matrix_api_redact_event(MatrixAPI *api,
if (!room_id || !event_id || !txn_id) { if (!room_id || !event_id || !txn_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id, event_id and txn_id must be set."); "room_id, event_id and txn_id must be set.");
return; return;
@ -1691,7 +1691,7 @@ matrix_api_redact_event(MatrixAPI *api,
* *
* If @room_id, @event_type, @txn_id or @content is %NULL, this * If @room_id, @event_type, @txn_id or @content is %NULL, this
* function returns immediately, and fills @error with * function returns immediately, and fills @error with
* %MATRIX_API_ERROR_INCOMPLETE. * %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_send_message_event(MatrixAPI *api, matrix_api_send_message_event(MatrixAPI *api,
@ -1707,7 +1707,7 @@ matrix_api_send_message_event(MatrixAPI *api,
if (!room_id || !event_type || !txn_id || !content) { if (!room_id || !event_type || !txn_id || !content) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id, event_type, txn_id and content must be set."); "room_id, event_type, txn_id and content must be set.");
return; return;
@ -1740,7 +1740,7 @@ matrix_api_send_message_event(MatrixAPI *api,
* *
* If @room_id is %NULL, or if @state_key is set with @event_type * If @room_id is %NULL, or if @state_key is set with @event_type
* being %NULL, this function returns immediately, and fills @error * being %NULL, this function returns immediately, and fills @error
* with %MATRIX_API_ERROR_INCOMPLETE. * with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_room_state(MatrixAPI *api, matrix_api_get_room_state(MatrixAPI *api,
@ -1755,7 +1755,7 @@ matrix_api_get_room_state(MatrixAPI *api,
if (!room_id || (state_key && !event_type)) { if (!room_id || (state_key && !event_type)) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id must be set, and event_type must be set if state_key is set."); "room_id must be set, and event_type must be set if state_key is set.");
return; return;
@ -1791,7 +1791,7 @@ matrix_api_get_room_state(MatrixAPI *api,
* *
* If @room_id or @content is %NULL, or if @state_key is set with * If @room_id or @content is %NULL, or if @state_key is set with
* @event_type being %NULL, this function returns immediately, and * @event_type being %NULL, this function returns immediately, and
* fills @error with %MATRIX_API_ERROR_INCOMPLETE. * fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_send_room_event(MatrixAPI *api, matrix_api_send_room_event(MatrixAPI *api,
@ -1807,7 +1807,7 @@ matrix_api_send_room_event(MatrixAPI *api,
if (!room_id || (state_key && !event_type) || !content) { if (!room_id || (state_key && !event_type) || !content) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"room_id must be set, and event_type must be set if state_key is set."); "room_id must be set, and event_type must be set if state_key is set.");
return; return;
@ -1840,7 +1840,7 @@ matrix_api_send_room_event(MatrixAPI *api,
* user stopped typing. * user stopped typing.
* *
* If @user_id or @room_id is %NULL, this function returns * If @user_id or @room_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_notify_room_typing(MatrixAPI *api, matrix_api_notify_room_typing(MatrixAPI *api,
@ -1856,7 +1856,7 @@ matrix_api_notify_room_typing(MatrixAPI *api,
if (!user_id || !room_id) { if (!user_id || !room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id and room_id must be set."); "user_id and room_id must be set.");
return; return;
@ -1938,7 +1938,7 @@ matrix_api_sync(MatrixAPI *api,
* filter ID that may be used in future requests. * filter ID that may be used in future requests.
* *
* If @user_id or @filter is %NULL, this function returns immediately, * If @user_id or @filter is %NULL, this function returns immediately,
* and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_create_filter(MatrixAPI *api, matrix_api_create_filter(MatrixAPI *api,
@ -1952,7 +1952,7 @@ matrix_api_create_filter(MatrixAPI *api,
if (!user_id || !filter) { if (!user_id || !filter) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id and filter must be set."); "user_id and filter must be set.");
return; return;
@ -1979,7 +1979,7 @@ matrix_api_create_filter(MatrixAPI *api,
* Download a filter. * Download a filter.
* *
* If @user_id or @filter_id is %NULL, this function returns * If @user_id or @filter_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_download_filter(MatrixAPI *api, matrix_api_download_filter(MatrixAPI *api,
@ -1993,7 +1993,7 @@ matrix_api_download_filter(MatrixAPI *api,
if (!user_id || !filter_id) { if (!user_id || !filter_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id and filter_id must be set."); "user_id and filter_id must be set.");
return; return;
@ -2022,7 +2022,7 @@ matrix_api_download_filter(MatrixAPI *api,
* Get information about a particular user. * Get information about a particular user.
* *
* If @user_id is %NULL, this function returns immediately, and fills * If @user_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_whois(MatrixAPI *api, matrix_api_whois(MatrixAPI *api,
@ -2035,7 +2035,7 @@ matrix_api_whois(MatrixAPI *api,
if (!user_id) { if (!user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set."); "user_id must be set.");
return; return;
@ -2085,7 +2085,7 @@ matrix_api_versions(MatrixAPI *api,
* must set the token property on a successful login. * must set the token property on a successful login.
* *
* If @login_type or @content is %NULL, this function returns * If @login_type or @content is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_login(MatrixAPI *api, matrix_api_login(MatrixAPI *api,
@ -2099,7 +2099,7 @@ matrix_api_login(MatrixAPI *api,
if (!login_type || !content) { if (!login_type || !content) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"login_type and content must be set."); "login_type and content must be set.");
return; return;
@ -2188,7 +2188,7 @@ matrix_api_get_3pids(MatrixAPI *api,
* Add contact information to the user's account. * Add contact information to the user's account.
* *
* If @threepid_creds is %NULL, this function returns immediately, and * If @threepid_creds is %NULL, this function returns immediately, and
* fills @error with %MATRIX_API_ERROR_INCOMPLETE. * fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_add_3pid(MatrixAPI *api, matrix_api_add_3pid(MatrixAPI *api,
@ -2202,7 +2202,7 @@ matrix_api_add_3pid(MatrixAPI *api,
if (!threepid_creds) { if (!threepid_creds) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"threepid_creds must be set."); "threepid_creds must be set.");
return; return;
@ -2225,7 +2225,7 @@ matrix_api_add_3pid(MatrixAPI *api,
* Change the active user's password. * Change the active user's password.
* *
* If @new_password is %NULL, this function returns immediately, and * If @new_password is %NULL, this function returns immediately, and
* fills @error with %MATRIX_API_ERROR_INCOMPLETE. * fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_change_password(MatrixAPI *api, matrix_api_change_password(MatrixAPI *api,
@ -2238,7 +2238,7 @@ matrix_api_change_password(MatrixAPI *api,
if (!new_password) { if (!new_password) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"new_password must be set."); "new_password must be set.");
return; return;
@ -2261,7 +2261,7 @@ matrix_api_change_password(MatrixAPI *api,
* Get a user's profile. * Get a user's profile.
* *
* If @user_id is %NULL, this function returns immediately, and fills * If @user_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_profile(MatrixAPI *api, matrix_api_get_profile(MatrixAPI *api,
@ -2274,7 +2274,7 @@ matrix_api_get_profile(MatrixAPI *api,
if (!user_id) { if (!user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set."); "user_id must be set.");
return; return;
@ -2297,7 +2297,7 @@ matrix_api_get_profile(MatrixAPI *api,
* Get the URL of the specified user's avatar. * Get the URL of the specified user's avatar.
* *
* If @user_id is %NULL, this function returns immediately, and fills * If @user_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_avatar_url(MatrixAPI *api, matrix_api_get_avatar_url(MatrixAPI *api,
@ -2310,7 +2310,7 @@ matrix_api_get_avatar_url(MatrixAPI *api,
if (!user_id) { if (!user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set."); "user_id must be set.");
return; return;
@ -2334,7 +2334,7 @@ matrix_api_get_avatar_url(MatrixAPI *api,
* Set the user's avatar URL. * Set the user's avatar URL.
* *
* If @user_id or @avatar_url is %NULL, this function returns * If @user_id or @avatar_url is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_set_avatar_url(MatrixAPI *api, matrix_api_set_avatar_url(MatrixAPI *api,
@ -2348,7 +2348,7 @@ matrix_api_set_avatar_url(MatrixAPI *api,
if (!user_id || !avatar_url) { if (!user_id || !avatar_url) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id and avatar_url must be set."); "user_id and avatar_url must be set.");
return; return;
@ -2371,7 +2371,7 @@ matrix_api_set_avatar_url(MatrixAPI *api,
* Get the user's display name. * Get the user's display name.
* *
* If @user_id is %NULL, this function returns immediately, and fills * If @user_id is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_display_name(MatrixAPI *api, matrix_api_get_display_name(MatrixAPI *api,
@ -2384,7 +2384,7 @@ matrix_api_get_display_name(MatrixAPI *api,
if (!user_id) { if (!user_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id must be set."); "user_id must be set.");
return; return;
@ -2408,7 +2408,7 @@ matrix_api_get_display_name(MatrixAPI *api,
* Set the user's display name. * Set the user's display name.
* *
* If @user_id or @display_name is %NULL, this function returns * If @user_id or @display_name is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_set_display_name(MatrixAPI *api, matrix_api_set_display_name(MatrixAPI *api,
@ -2422,7 +2422,7 @@ matrix_api_set_display_name(MatrixAPI *api,
if (!user_id || !display_name) { if (!user_id || !display_name) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id and display_name must be set."); "user_id and display_name must be set.");
return; return;
@ -2456,7 +2456,7 @@ matrix_api_set_display_name(MatrixAPI *api,
* successful login. * successful login.
* *
* If @password is %NULL, this function returns immediately, and fills * If @password is %NULL, this function returns immediately, and fills
* @error with %MATRIX_API_ERROR_INCOMPLETE. * @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_register_account(MatrixAPI *api, matrix_api_register_account(MatrixAPI *api,
@ -2472,7 +2472,7 @@ matrix_api_register_account(MatrixAPI *api,
if (!password) { if (!password) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"password must be set."); "password must be set.");
return; return;
@ -2506,7 +2506,7 @@ matrix_api_register_account(MatrixAPI *api,
* *
* If @user_id, @event_type or @content is %NULL, this * If @user_id, @event_type or @content is %NULL, this
* function returns immediately, and fills @error with * function returns immediately, and fills @error with
* %MATRIX_API_ERROR_INCOMPLETE. * %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_set_account_data(MatrixAPI *api, matrix_api_set_account_data(MatrixAPI *api,
@ -2522,7 +2522,7 @@ matrix_api_set_account_data(MatrixAPI *api,
if (!user_id || !event_type || !content) { if (!user_id || !event_type || !content) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id2 event_type and content must be set."); "user_id2 event_type and content must be set.");
return; return;
@ -2550,7 +2550,7 @@ matrix_api_set_account_data(MatrixAPI *api,
* List the tags set by a user on a room. * List the tags set by a user on a room.
* *
* If @user_id or @room_id is %NULL, this function returns * If @user_id or @room_id is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_get_room_tags(MatrixAPI *api, matrix_api_get_room_tags(MatrixAPI *api,
@ -2564,7 +2564,7 @@ matrix_api_get_room_tags(MatrixAPI *api,
if (!user_id || !room_id) { if (!user_id || !room_id) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id and room_id must be set."); "user_id and room_id must be set.");
return; return;
@ -2589,7 +2589,7 @@ matrix_api_get_room_tags(MatrixAPI *api,
* Remove a tag from the room. * Remove a tag from the room.
* *
* If @user_id, @room_id or @tag is %NULL, this function returns * If @user_id, @room_id or @tag is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_delete_room_tag(MatrixAPI *api, matrix_api_delete_room_tag(MatrixAPI *api,
@ -2604,7 +2604,7 @@ matrix_api_delete_room_tag(MatrixAPI *api,
if (!user_id || !room_id || !tag) { if (!user_id || !room_id || !tag) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id, room_id and tag must be set."); "user_id, room_id and tag must be set.");
return; return;
@ -2633,7 +2633,7 @@ matrix_api_delete_room_tag(MatrixAPI *api,
* Add a tag to the room. * Add a tag to the room.
* *
* If @user_id, @room_id or @tag is %NULL, this function returns * If @user_id, @room_id or @tag is %NULL, this function returns
* immediately, and fills @error with %MATRIX_API_ERROR_INCOMPLETE. * immediately, and fills @error with %MATRIX_ERROR_INCOMPLETE.
*/ */
void void
matrix_api_add_room_tag(MatrixAPI *api, matrix_api_add_room_tag(MatrixAPI *api,
@ -2649,7 +2649,7 @@ matrix_api_add_room_tag(MatrixAPI *api,
if (!user_id || !room_id || !tag) { if (!user_id || !room_id || !tag) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"user_id, room_id and tag must be set."); "user_id, room_id and tag must be set.");
return; return;

View File

@ -527,8 +527,7 @@ _response_callback(SoupSession *session,
GByteArray *raw_content = NULL; GByteArray *raw_content = NULL;
if (msg->status_code < SOUP_STATUS_CONTINUE) { if (msg->status_code < SOUP_STATUS_CONTINUE) {
err = g_error_new(MATRIX_API_ERROR, err = g_error_new(MATRIX_ERROR, MATRIX_ERROR_COMMUNICATION_ERROR,
MATRIX_API_ERROR_COMMUNICATION_ERROR,
"%s %d: %s", "%s %d: %s",
(msg->status_code < 100) ? "Network error" : "HTTP", (msg->status_code < 100) ? "Network error" : "HTTP",
msg->status_code, msg->reason_phrase); msg->status_code, msg->reason_phrase);
@ -629,7 +628,7 @@ _response_callback(SoupSession *session,
gchar *message; gchar *message;
const gchar *errcode = NULL; const gchar *errcode = NULL;
const gchar *error = NULL; const gchar *error = NULL;
MatrixAPIError error_code = MATRIX_API_ERROR_UNKNOWN_ERROR; MatrixError error_code = MATRIX_ERROR_UNKNOWN_ERROR;
if (errcode_node) { if (errcode_node) {
GEnumClass *error_class; GEnumClass *error_class;
@ -639,10 +638,10 @@ _response_callback(SoupSession *session,
if (strncmp("M_", errcode, 2) == 0) { if (strncmp("M_", errcode, 2) == 0) {
gchar *matrix_error_code = g_strdup_printf( gchar *matrix_error_code = g_strdup_printf(
"MATRIX_API_ERROR_%s", errcode + 2); "MATRIX_ERROR_%s", errcode + 2);
error_class = g_type_class_ref( error_class = g_type_class_ref(
MATRIX_TYPE_API_ERROR); MATRIX_TYPE_ERROR);
value = g_enum_get_value_by_name( value = g_enum_get_value_by_name(
error_class, matrix_error_code); error_class, matrix_error_code);
g_free(matrix_error_code); g_free(matrix_error_code);
@ -656,7 +655,7 @@ _response_callback(SoupSession *session,
} }
} else { } else {
g_info("An error was sent by the homeserver, but no error code was specified. You may want to report this to the homeserver administrators."); g_info("An error was sent by the homeserver, but no error code was specified. You may want to report this to the homeserver administrators.");
error_code = MATRIX_API_ERROR_UNSPECIFIED; error_code = MATRIX_ERROR_UNSPECIFIED;
} }
if (error_node) { if (error_node) {
@ -672,15 +671,13 @@ _response_callback(SoupSession *session,
"(No errcode given) %s", error); "(No errcode given) %s", error);
} }
err = g_error_new_literal(MATRIX_API_ERROR, err = g_error_new_literal(MATRIX_ERROR, error_code,
error_code,
message); message);
} }
} }
} else if (!JSON_NODE_HOLDS_ARRAY(content)) { } else if (!JSON_NODE_HOLDS_ARRAY(content)) {
// Not a JSON object, neither an array // Not a JSON object, neither an array
err = g_error_new(MATRIX_API_ERROR, err = g_error_new(MATRIX_ERROR, MATRIX_ERROR_BAD_RESPONSE,
MATRIX_API_ERROR_BAD_RESPONSE,
"Bad response (not a JSON object)"); "Bad response (not a JSON object)");
g_debug("Bad response: %s", data); g_debug("Bad response: %s", data);
} }
@ -692,8 +689,7 @@ _response_callback(SoupSession *session,
request_url, request_url,
datalen); datalen);
} else { } else {
err = g_error_new(MATRIX_API_ERROR, err = g_error_new(MATRIX_ERROR, MATRIX_ERROR_BAD_RESPONSE,
MATRIX_API_ERROR_BAD_RESPONSE,
"Malformed response (invalid JSON)"); "Malformed response (invalid JSON)");
g_debug("Malformed response (%s): %s", request_url, data); g_debug("Malformed response (%s): %s", request_url, data);
} }
@ -745,7 +741,7 @@ _send(MatrixHTTPAPI *api,
if (!priv->uri) { if (!priv->uri) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_COMMUNICATION_ERROR, MATRIX_ERROR, MATRIX_ERROR_COMMUNICATION_ERROR,
"No valid base URL"); "No valid base URL");
return; return;
@ -1118,7 +1114,7 @@ i_join_room(MatrixAPI *api,
// TODO: a more thorough check should be used here // TODO: a more thorough check should be used here
if (*room_id != '!') { if (*room_id != '!') {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INVALID_ROOM_ID, MATRIX_ERROR, MATRIX_ERROR_INVALID_ROOM_ID,
"Invalid room ID"); "Invalid room ID");
return; return;
@ -2194,7 +2190,7 @@ i_sync(MatrixAPI *api,
if (filter_id && filter) { if (filter_id && filter) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_BAD_REQUEST, MATRIX_ERROR, MATRIX_ERROR_BAD_REQUEST,
"Cannot set both filter_id and filter"); "Cannot set both filter_id and filter");
return; return;
@ -2320,7 +2316,7 @@ i_token_refresh(MatrixAPI *api,
if (!refresh_token && !priv->refresh_token) { if (!refresh_token && !priv->refresh_token) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_MISSING_TOKEN, MATRIX_ERROR, MATRIX_ERROR_MISSING_TOKEN,
"No token available"); "No token available");
return; return;
@ -2388,7 +2384,7 @@ i_add_3pid(MatrixAPI *api,
if ((id_node = matrix_api_3pid_credential_get_json_node( if ((id_node = matrix_api_3pid_credential_get_json_node(
threepid_creds, error)) == NULL) { threepid_creds, error)) == NULL) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"Incomplete credential"); "Incomplete credential");
return; return;

View File

@ -30,38 +30,36 @@
*/ */
/** /**
* MatrixAPIError: * MatrixError:
* @MATRIX_API_ERROR_NONE: no error * @MATRIX_ERROR_NONE: no error
* @MATRIX_API_ERROR_COMMUNICATION_ERROR: there was a problem in * @MATRIX_ERROR_COMMUNICATION_ERROR: there was a problem in
* communication * communication (e.g. connection
* (e.g. connection error) * error)
* @MATRIX_API_ERROR_INCOMPLETE: the passed/generated data is * @MATRIX_ERROR_INCOMPLETE: the passed/generated data is incomplete
* incomplete * @MATRIX_ERROR_BAD_REQUEST: the request is invalid
* @MATRIX_API_ERROR_BAD_REQUEST: the request is invalid * @MATRIX_ERROR_BAD_RESPONSE: malformed response, or the response is
* @MATRIX_API_ERROR_BAD_RESPONSE: malformed response, or the response * not a JSON object
* is not a JSON object * @MATRIX_ERROR_INVALID_ROOM_ID: the provided string doesnt contain
* @MATRIX_API_ERROR_INVALID_ROOM_ID: the provided string doesnt * a valid room ID
* contain a valid room ID * @MATRIX_ERROR_UNKNOWN_VALUE: the response from the Matrix.org
* @MATRIX_API_ERROR_UNKNOWN_VALUE: the response from the Matrix.org * server contains a value unknown to
* server contains a value unknown to * this library. These should be reported
* this library. These should be * to the Matrix GLib SDK developers
* reported to the Matrix GLib SDK * @MATRIX_ERROR_MISSING_TOKEN: authorization token is missing from
* developers * the request
* @MATRIX_API_ERROR_MISSING_TOKEN: authorization token is missing * @MATRIX_ERROR_FORBIDDEN: access was forbidden (e.g. due to a
* from the request * missing/invalid token, or using a bad
* @MATRIX_API_ERROR_FORBIDDEN: access was forbidden (e.g. due to a * password during login)
* missing/invalid token, or using a bad * @MATRIX_ERROR_UNKNOWN: an error unknown to the Matrix server the
* password during login) * homeserver
* @MATRIX_API_ERROR_UNKNOWN: an error unknown to the Matrix server * @MATRIX_ERROR_UNKNOWN_TOKEN: the token provided is not known for
* @MATRIX_API_ERROR_UNKNOWN_TOKEN: the token provided is not known * the homeserver
* for the homeserver * @MATRIX_ERROR_NOT_JSON: illegal request, the content is not valid
* @MATRIX_API_ERROR_NOT_JSON: illegal request, the content is not * JSON
* valid JSON * @MATRIX_ERROR_UNRECOGNIZED: the homeserver didn't understand the
* @MATRIX_API_ERROR_UNRECOGNIZED: the homeserver didn't understand * request
* the request * @MATRIX_ERROR_UNSPECIFIED: no error code was sent by the homeserver
* @MATRIX_API_ERROR_UNSPECIFIED: no error code was sent by the * @MATRIX_ERROR_UNKNOWN_ERROR: an error unknown to this library
* homeserver
* @MATRIX_API_ERROR_UNKNOWN_ERROR: an error unknown to this library
* *
* Value mappings from Matrix.org API error codes * Value mappings from Matrix.org API error codes
* (e.g. <code>M_MISSING_TOKEN</code>). They should be set * (e.g. <code>M_MISSING_TOKEN</code>). They should be set
@ -69,18 +67,18 @@
*/ */
/** /**
* MATRIX_API_ERROR: * MATRIX_ERROR:
* *
* Error domain for Matrix GLib SDK API. See #GError for more * Error domain for Matrix GLib SDK. See #GError for more information
* information on error domains. * on error domains.
*/ */
/** /**
* matrix_api_error_quark: * matrix_error_quark:
* *
* Gets the Matrix API error #GQuark * Gets the Matrix error #GQuark
*/ */
G_DEFINE_QUARK(matrix-api-error-quark, matrix_api_error); G_DEFINE_QUARK(matrix-error-quark, matrix_error);
/** /**
* MatrixAPIEventFormat: * MatrixAPIEventFormat:
@ -1805,7 +1803,7 @@ matrix_api_3pid_credential_get_json_node(MatrixAPI3PidCredential *credential,
|| !credential->session_id || !credential->session_id
|| !credential->client_secret) { || !credential->client_secret) {
g_set_error(error, g_set_error(error,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"All fields of the 3PID credential must be filled!"); "All fields of the 3PID credential must be filled!");
return NULL; return NULL;
@ -1839,7 +1837,7 @@ matrix_api_3pid_credential_get_json_node(MatrixAPI3PidCredential *credential,
* *
* Get the JSON representation of @credential as a string. If any * Get the JSON representation of @credential as a string. If any
* fields of @credential is %NULL, this function returns %NULL and * fields of @credential is %NULL, this function returns %NULL and
* fills @error wich %MATRIX_API_ERROR_INCOMPLETE. * fills @error wich %MATRIX_ERROR_INCOMPLETE.
* *
* Returns: (transfer full) (allow-none): the JSON representation of * Returns: (transfer full) (allow-none): the JSON representation of
* @credential, or %NULL * @credential, or %NULL
@ -2281,7 +2279,7 @@ matrix_api_pusher_get_data(MatrixAPIPusher *pusher)
* Get the JSON representation of the pusher data as a #JsonNode * Get the JSON representation of the pusher data as a #JsonNode
* object. As in the pusher object all fields are mandatory, if any of * object. As in the pusher object all fields are mandatory, if any of
* them is %NULL, this function returns %NULL, and fills @err with * them is %NULL, this function returns %NULL, and fills @err with
* %MATRIX_API_ERROR_INCOMPLETE. * %MATRIX_ERROR_INCOMPLETE.
* *
* Returns: (transfer full): the JSON representation of the pusher * Returns: (transfer full): the JSON representation of the pusher
* data. * data.
@ -2301,7 +2299,7 @@ matrix_api_pusher_get_json_node(MatrixAPIPusher *pusher, GError **err)
|| !pusher->profile_tag || !pusher->profile_tag
|| !pusher->pushkey) { || !pusher->pushkey) {
g_set_error(err, g_set_error(err,
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
"Pusher data incomplete"); "Pusher data incomplete");
return NULL; return NULL;
@ -2355,7 +2353,7 @@ matrix_api_pusher_get_json_node(MatrixAPIPusher *pusher, GError **err)
* Get the JSON representation of the pusher data as a string. As in * Get the JSON representation of the pusher data as a string. As in
* the pusher object all fields are mandatory, if any of them is * the pusher object all fields are mandatory, if any of them is
* %NULL, this function returns %NULL, and fills @err with * %NULL, this function returns %NULL, and fills @err with
* %MATRIX_API_ERROR_INCOMPLETE. * %MATRIX_ERROR_INCOMPLETE.
* *
* Returns: (transfer full): the JSON representation of the pusher * Returns: (transfer full): the JSON representation of the pusher
* data. * data.

View File

@ -25,32 +25,32 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef enum { typedef enum {
MATRIX_API_ERROR_NONE, MATRIX_ERROR_NONE,
MATRIX_API_ERROR_COMMUNICATION_ERROR, MATRIX_ERROR_COMMUNICATION_ERROR,
MATRIX_API_ERROR_INCOMPLETE, MATRIX_ERROR_INCOMPLETE,
MATRIX_API_ERROR_BAD_REQUEST, MATRIX_ERROR_BAD_REQUEST,
MATRIX_API_ERROR_BAD_RESPONSE, MATRIX_ERROR_BAD_RESPONSE,
MATRIX_API_ERROR_INVALID_ROOM_ID, MATRIX_ERROR_INVALID_ROOM_ID,
MATRIX_API_ERROR_UNKNOWN_VALUE, MATRIX_ERROR_UNKNOWN_VALUE,
/* Add Matrix-defined error codes under here, changing `M_` to /* Add Matrix-defined error codes under here, changing `M_` to
* `MATRIX_API_ERROR`, i.e. `M_FORBIDDEN` => * `MATRIX_ERROR`, i.e. `M_FORBIDDEN` =>
* `MATRIX_API_ERROR_FORBIDDEN` */ * `MATRIX_ERROR_FORBIDDEN` */
MATRIX_API_ERROR_MISSING_TOKEN = 500, MATRIX_ERROR_MISSING_TOKEN = 500,
MATRIX_API_ERROR_FORBIDDEN, MATRIX_ERROR_FORBIDDEN,
MATRIX_API_ERROR_UNKNOWN, MATRIX_ERROR_UNKNOWN,
MATRIX_API_ERROR_UNKNOWN_TOKEN, MATRIX_ERROR_UNKNOWN_TOKEN,
MATRIX_API_ERROR_NOT_JSON, MATRIX_ERROR_NOT_JSON,
MATRIX_API_ERROR_UNRECOGNIZED, MATRIX_ERROR_UNRECOGNIZED,
/* Allow for a lot of Matrix.org defined codes /* Allow for a lot of Matrix.org defined codes
Do not define error codes after this! */ Do not define error codes after this! */
MATRIX_API_ERROR_UNSPECIFIED = 16383, MATRIX_ERROR_UNSPECIFIED = 16383,
MATRIX_API_ERROR_UNKNOWN_ERROR MATRIX_ERROR_UNKNOWN_ERROR
} MatrixAPIError; } MatrixError;
#define MATRIX_API_ERROR matrix_api_error_quark() #define MATRIX_ERROR matrix_error_quark()
GQuark matrix_api_error_quark(void); GQuark matrix_error_quark(void);
typedef enum { typedef enum {
MATRIX_API_EVENT_FORMAT_DEFAULT, MATRIX_API_EVENT_FORMAT_DEFAULT,