Rename MatrixAPIError to MatrixError
This commit is contained in:
parent
fbb24e3acc
commit
d3ac019188
@ -22,8 +22,8 @@ matrix_client_get_type
|
||||
<TITLE>Fundamental types for the Matrix GLib SDK</TITLE>
|
||||
|
||||
<SUBSECTION>
|
||||
MatrixAPIError
|
||||
MATRIX_API_ERROR
|
||||
MatrixError
|
||||
MATRIX_ERROR
|
||||
|
||||
<SUBSECTION>
|
||||
MatrixAPIEventFormat
|
||||
@ -296,8 +296,8 @@ matrix_api_abort_pending
|
||||
|
||||
<SUBSECTION Standard>
|
||||
MatrixAPI
|
||||
MATRIX_TYPE_API_ERROR
|
||||
matrix_api_error_get_type
|
||||
MATRIX_TYPE_ERROR
|
||||
matrix_error_get_type
|
||||
MATRIX_TYPE_API
|
||||
MATRIX_API
|
||||
MATRIX_IS_API
|
||||
@ -306,7 +306,7 @@ MatrixApiPrivate
|
||||
matrix_api_get_type
|
||||
|
||||
<SUBSECTION Private>
|
||||
matrix_api_error_quark
|
||||
matrix_error_quark
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
192
src/matrix-api.c
192
src/matrix-api.c
@ -331,7 +331,7 @@ matrix_api_get_homeserver(MatrixAPI *api)
|
||||
* Download content from the content repository.
|
||||
*
|
||||
* 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
|
||||
matrix_api_media_download(MatrixAPI *api,
|
||||
@ -345,7 +345,7 @@ matrix_api_media_download(MatrixAPI *api,
|
||||
|
||||
if (!server_name || !media_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"server_name and media_id must be specified.");
|
||||
|
||||
return;
|
||||
@ -379,7 +379,7 @@ matrix_api_media_download(MatrixAPI *api,
|
||||
* specified.
|
||||
*
|
||||
* 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
|
||||
matrix_api_media_thumbnail(MatrixAPI *api,
|
||||
@ -396,7 +396,7 @@ matrix_api_media_thumbnail(MatrixAPI *api,
|
||||
|
||||
if (!server_name || !media_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"server_name and media_id must be specified.");
|
||||
|
||||
return;
|
||||
@ -425,7 +425,7 @@ matrix_api_media_thumbnail(MatrixAPI *api,
|
||||
* Upload some content to the content repository.
|
||||
*
|
||||
* If @content is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_media_upload(MatrixAPI *api,
|
||||
@ -439,7 +439,7 @@ matrix_api_media_upload(MatrixAPI *api,
|
||||
|
||||
if (!content) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"content must be set.");
|
||||
|
||||
return;
|
||||
@ -464,7 +464,7 @@ matrix_api_media_upload(MatrixAPI *api,
|
||||
* Retrieve a list of presence events for every user on this list.
|
||||
*
|
||||
* If @user_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_get_presence_list(MatrixAPI *api,
|
||||
@ -477,7 +477,7 @@ matrix_api_get_presence_list(MatrixAPI *api,
|
||||
|
||||
if (!user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id must be set.");
|
||||
|
||||
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
|
||||
* function returns immediately, and fills @error with
|
||||
* %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
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)) {
|
||||
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");
|
||||
|
||||
return;
|
||||
@ -545,7 +545,7 @@ matrix_api_update_presence_list(MatrixAPI *api,
|
||||
* Get the given user's presence state.
|
||||
*
|
||||
* If @user_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_get_user_presence(MatrixAPI *api,
|
||||
@ -558,7 +558,7 @@ matrix_api_get_user_presence(MatrixAPI *api,
|
||||
|
||||
if (!user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -587,7 +587,7 @@ matrix_api_get_user_presence(MatrixAPI *api,
|
||||
* another user.
|
||||
*
|
||||
* If @user_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_set_user_presence(MatrixAPI *api,
|
||||
@ -602,7 +602,7 @@ matrix_api_set_user_presence(MatrixAPI *api,
|
||||
|
||||
if (!user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -631,7 +631,7 @@ matrix_api_set_user_presence(MatrixAPI *api,
|
||||
* homeserver.
|
||||
*
|
||||
* If @pusher is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_update_pusher(MatrixAPI *api,
|
||||
@ -644,7 +644,7 @@ matrix_api_update_pusher(MatrixAPI *api,
|
||||
|
||||
if (!pusher) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"pusher must be set.");
|
||||
|
||||
return;
|
||||
@ -696,7 +696,7 @@ matrix_api_get_pushers(MatrixAPI *api,
|
||||
* Delete a push rule.
|
||||
*
|
||||
* 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_delete_pusher(MatrixAPI *api,
|
||||
@ -711,7 +711,7 @@ matrix_api_delete_pusher(MatrixAPI *api,
|
||||
|
||||
if (!scope || !rule_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"scope and rule_id must be set.");
|
||||
|
||||
return;
|
||||
@ -740,7 +740,7 @@ matrix_api_delete_pusher(MatrixAPI *api,
|
||||
* Retrieve a specific push rule.
|
||||
*
|
||||
* 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_get_pusher(MatrixAPI *api,
|
||||
@ -755,7 +755,7 @@ matrix_api_get_pusher(MatrixAPI *api,
|
||||
|
||||
if (!scope || !rule_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"scope and rule_id must be set.");
|
||||
|
||||
return;
|
||||
@ -795,7 +795,7 @@ matrix_api_get_pusher(MatrixAPI *api,
|
||||
*
|
||||
* If either @scope, @rule_id or @actions are %NULL, this
|
||||
* function returns immediately, and fills @error with
|
||||
* %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_add_pusher(MatrixAPI *api,
|
||||
@ -814,7 +814,7 @@ matrix_api_add_pusher(MatrixAPI *api,
|
||||
|
||||
if (!scope || !rule_id || !actions) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"scope, rule_id and actions must be set.");
|
||||
|
||||
return;
|
||||
@ -847,7 +847,7 @@ matrix_api_add_pusher(MatrixAPI *api,
|
||||
* Enable or disable the specified push rule.
|
||||
*
|
||||
* 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,
|
||||
MatrixAPICallback callback,
|
||||
@ -862,7 +862,7 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
|
||||
|
||||
if (!scope || !rule_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"scope and rule_id must be set.");
|
||||
|
||||
return;
|
||||
@ -946,7 +946,7 @@ matrix_api_create_room(MatrixAPI *api,
|
||||
* creator or a server administrator.
|
||||
*
|
||||
* If @room_alias is %NULL, this function returns immediately, and
|
||||
* fills @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* fills @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_delete_room_alias(MatrixAPI *api,
|
||||
@ -959,7 +959,7 @@ matrix_api_delete_room_alias(MatrixAPI *api,
|
||||
|
||||
if (!room_alias) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_alias must be set.");
|
||||
|
||||
return;
|
||||
@ -982,7 +982,7 @@ matrix_api_delete_room_alias(MatrixAPI *api,
|
||||
* Get the room ID corresponding to this room alias.
|
||||
*
|
||||
* If @room_alias is %NULL, this function returns immediately, and
|
||||
* fills @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* fills @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_get_room_id(MatrixAPI *api,
|
||||
@ -995,7 +995,7 @@ matrix_api_get_room_id(MatrixAPI *api,
|
||||
|
||||
if (!room_alias) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_alias must be set.");
|
||||
|
||||
return;
|
||||
@ -1019,7 +1019,7 @@ matrix_api_get_room_id(MatrixAPI *api,
|
||||
* Create a new mapping from room alias to room ID.
|
||||
*
|
||||
* 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
|
||||
matrix_api_create_room_alias(MatrixAPI *api,
|
||||
@ -1033,7 +1033,7 @@ matrix_api_create_room_alias(MatrixAPI *api,
|
||||
|
||||
if (!room_alias || !room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_alias and room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1089,7 +1089,7 @@ matrix_api_list_public_rooms(MatrixAPI *api,
|
||||
* can be specified.
|
||||
*
|
||||
* 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
|
||||
matrix_api_ban_user(MatrixAPI *api,
|
||||
@ -1104,7 +1104,7 @@ matrix_api_ban_user(MatrixAPI *api,
|
||||
|
||||
if (!room_id || !user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id and user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1135,7 +1135,7 @@ matrix_api_ban_user(MatrixAPI *api,
|
||||
* leave the room as part of this API call.
|
||||
*
|
||||
* If @room_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_forget_room(MatrixAPI *api,
|
||||
@ -1148,7 +1148,7 @@ matrix_api_forget_room(MatrixAPI *api,
|
||||
|
||||
if (!room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1179,7 +1179,7 @@ matrix_api_forget_room(MatrixAPI *api,
|
||||
* of the third party identifier.
|
||||
*
|
||||
* 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,
|
||||
MatrixAPICallback callback,
|
||||
@ -1192,7 +1192,7 @@ void matrix_api_invite_user_3rdparty(MatrixAPI *api,
|
||||
|
||||
if (!credential) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"credential must be set.");
|
||||
|
||||
return;
|
||||
@ -1219,7 +1219,7 @@ void matrix_api_invite_user_3rdparty(MatrixAPI *api,
|
||||
* Invite a user to a room.
|
||||
*
|
||||
* 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
|
||||
matrix_api_invite_user(MatrixAPI *api,
|
||||
@ -1233,7 +1233,7 @@ matrix_api_invite_user(MatrixAPI *api,
|
||||
|
||||
if (!room_id || !user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id and user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1256,7 +1256,7 @@ matrix_api_invite_user(MatrixAPI *api,
|
||||
* Join a room.
|
||||
*
|
||||
* If @room_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_join_room(MatrixAPI *api,
|
||||
@ -1269,7 +1269,7 @@ matrix_api_join_room(MatrixAPI *api,
|
||||
|
||||
if (!room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1292,7 +1292,7 @@ matrix_api_join_room(MatrixAPI *api,
|
||||
* Leave a room.
|
||||
*
|
||||
* If @room_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_leave_room(MatrixAPI *api,
|
||||
@ -1305,7 +1305,7 @@ matrix_api_leave_room(MatrixAPI *api,
|
||||
|
||||
if (!room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1357,7 +1357,7 @@ matrix_api_event_stream(MatrixAPI *api,
|
||||
* Get a single event by event ID.
|
||||
*
|
||||
* If @event_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_get_event(MatrixAPI *api,
|
||||
@ -1370,7 +1370,7 @@ matrix_api_get_event(MatrixAPI *api,
|
||||
|
||||
if (!event_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"event_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1424,7 +1424,7 @@ matrix_api_initial_sync(MatrixAPI *api,
|
||||
* specified event.
|
||||
*
|
||||
* 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
|
||||
matrix_api_get_event_context(MatrixAPI *api,
|
||||
@ -1439,7 +1439,7 @@ matrix_api_get_event_context(MatrixAPI *api,
|
||||
|
||||
if (!room_id || !event_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id and event_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1465,7 +1465,7 @@ matrix_api_get_event_context(MatrixAPI *api,
|
||||
* room.
|
||||
*
|
||||
* If @room_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_initial_sync_room(MatrixAPI *api,
|
||||
@ -1478,7 +1478,7 @@ matrix_api_initial_sync_room(MatrixAPI *api,
|
||||
|
||||
if (!room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1501,7 +1501,7 @@ matrix_api_initial_sync_room(MatrixAPI *api,
|
||||
* Get the list of members for a room.
|
||||
*
|
||||
* If @room_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_list_room_members(MatrixAPI *api,
|
||||
@ -1514,7 +1514,7 @@ matrix_api_list_room_members(MatrixAPI *api,
|
||||
|
||||
if (!room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1543,7 +1543,7 @@ matrix_api_list_room_members(MatrixAPI *api,
|
||||
* Get a list of message and state events for a room.
|
||||
*
|
||||
* 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
|
||||
matrix_api_list_room_messages(MatrixAPI *api,
|
||||
@ -1559,7 +1559,7 @@ matrix_api_list_room_messages(MatrixAPI *api,
|
||||
|
||||
if (!room_id || !from_token) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"room_id and from_token must be set.");
|
||||
|
||||
return;
|
||||
@ -1590,7 +1590,7 @@ matrix_api_list_room_messages(MatrixAPI *api,
|
||||
* specified.
|
||||
*
|
||||
* 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
|
||||
matrix_api_send_event_receipt(MatrixAPI *api,
|
||||
@ -1606,7 +1606,7 @@ matrix_api_send_event_receipt(MatrixAPI *api,
|
||||
|
||||
if (!room_id || !event_id || !receipt) {
|
||||
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.");
|
||||
|
||||
return;
|
||||
@ -1643,7 +1643,7 @@ matrix_api_send_event_receipt(MatrixAPI *api,
|
||||
* room may redact events there.
|
||||
*
|
||||
* 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
|
||||
matrix_api_redact_event(MatrixAPI *api,
|
||||
@ -1659,7 +1659,7 @@ matrix_api_redact_event(MatrixAPI *api,
|
||||
|
||||
if (!room_id || !event_id || !txn_id) {
|
||||
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.");
|
||||
|
||||
return;
|
||||
@ -1691,7 +1691,7 @@ matrix_api_redact_event(MatrixAPI *api,
|
||||
*
|
||||
* If @room_id, @event_type, @txn_id or @content is %NULL, this
|
||||
* function returns immediately, and fills @error with
|
||||
* %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
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) {
|
||||
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.");
|
||||
|
||||
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
|
||||
* being %NULL, this function returns immediately, and fills @error
|
||||
* with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
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)) {
|
||||
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.");
|
||||
|
||||
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
|
||||
* @event_type being %NULL, this function returns immediately, and
|
||||
* fills @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* fills @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
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) {
|
||||
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.");
|
||||
|
||||
return;
|
||||
@ -1840,7 +1840,7 @@ matrix_api_send_room_event(MatrixAPI *api,
|
||||
* user stopped typing.
|
||||
*
|
||||
* 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
|
||||
matrix_api_notify_room_typing(MatrixAPI *api,
|
||||
@ -1856,7 +1856,7 @@ matrix_api_notify_room_typing(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id and room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -1938,7 +1938,7 @@ matrix_api_sync(MatrixAPI *api,
|
||||
* filter ID that may be used in future requests.
|
||||
*
|
||||
* 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
|
||||
matrix_api_create_filter(MatrixAPI *api,
|
||||
@ -1952,7 +1952,7 @@ matrix_api_create_filter(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !filter) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id and filter must be set.");
|
||||
|
||||
return;
|
||||
@ -1979,7 +1979,7 @@ matrix_api_create_filter(MatrixAPI *api,
|
||||
* Download a filter.
|
||||
*
|
||||
* 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
|
||||
matrix_api_download_filter(MatrixAPI *api,
|
||||
@ -1993,7 +1993,7 @@ matrix_api_download_filter(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !filter_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id and filter_id must be set.");
|
||||
|
||||
return;
|
||||
@ -2022,7 +2022,7 @@ matrix_api_download_filter(MatrixAPI *api,
|
||||
* Get information about a particular user.
|
||||
*
|
||||
* If @user_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_whois(MatrixAPI *api,
|
||||
@ -2035,7 +2035,7 @@ matrix_api_whois(MatrixAPI *api,
|
||||
|
||||
if (!user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -2085,7 +2085,7 @@ matrix_api_versions(MatrixAPI *api,
|
||||
* must set the token property on a successful login.
|
||||
*
|
||||
* 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
|
||||
matrix_api_login(MatrixAPI *api,
|
||||
@ -2099,7 +2099,7 @@ matrix_api_login(MatrixAPI *api,
|
||||
|
||||
if (!login_type || !content) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"login_type and content must be set.");
|
||||
|
||||
return;
|
||||
@ -2188,7 +2188,7 @@ matrix_api_get_3pids(MatrixAPI *api,
|
||||
* Add contact information to the user's account.
|
||||
*
|
||||
* If @threepid_creds is %NULL, this function returns immediately, and
|
||||
* fills @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* fills @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_add_3pid(MatrixAPI *api,
|
||||
@ -2202,7 +2202,7 @@ matrix_api_add_3pid(MatrixAPI *api,
|
||||
|
||||
if (!threepid_creds) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"threepid_creds must be set.");
|
||||
|
||||
return;
|
||||
@ -2225,7 +2225,7 @@ matrix_api_add_3pid(MatrixAPI *api,
|
||||
* Change the active user's password.
|
||||
*
|
||||
* If @new_password is %NULL, this function returns immediately, and
|
||||
* fills @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* fills @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_change_password(MatrixAPI *api,
|
||||
@ -2238,7 +2238,7 @@ matrix_api_change_password(MatrixAPI *api,
|
||||
|
||||
if (!new_password) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"new_password must be set.");
|
||||
|
||||
return;
|
||||
@ -2261,7 +2261,7 @@ matrix_api_change_password(MatrixAPI *api,
|
||||
* Get a user's profile.
|
||||
*
|
||||
* If @user_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_get_profile(MatrixAPI *api,
|
||||
@ -2274,7 +2274,7 @@ matrix_api_get_profile(MatrixAPI *api,
|
||||
|
||||
if (!user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -2297,7 +2297,7 @@ matrix_api_get_profile(MatrixAPI *api,
|
||||
* Get the URL of the specified user's avatar.
|
||||
*
|
||||
* If @user_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_get_avatar_url(MatrixAPI *api,
|
||||
@ -2310,7 +2310,7 @@ matrix_api_get_avatar_url(MatrixAPI *api,
|
||||
|
||||
if (!user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -2334,7 +2334,7 @@ matrix_api_get_avatar_url(MatrixAPI *api,
|
||||
* Set the user's avatar URL.
|
||||
*
|
||||
* 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
|
||||
matrix_api_set_avatar_url(MatrixAPI *api,
|
||||
@ -2348,7 +2348,7 @@ matrix_api_set_avatar_url(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !avatar_url) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id and avatar_url must be set.");
|
||||
|
||||
return;
|
||||
@ -2371,7 +2371,7 @@ matrix_api_set_avatar_url(MatrixAPI *api,
|
||||
* Get the user's display name.
|
||||
*
|
||||
* If @user_id is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_get_display_name(MatrixAPI *api,
|
||||
@ -2384,7 +2384,7 @@ matrix_api_get_display_name(MatrixAPI *api,
|
||||
|
||||
if (!user_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id must be set.");
|
||||
|
||||
return;
|
||||
@ -2408,7 +2408,7 @@ matrix_api_get_display_name(MatrixAPI *api,
|
||||
* Set the user's display name.
|
||||
*
|
||||
* 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
|
||||
matrix_api_set_display_name(MatrixAPI *api,
|
||||
@ -2422,7 +2422,7 @@ matrix_api_set_display_name(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !display_name) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id and display_name must be set.");
|
||||
|
||||
return;
|
||||
@ -2456,7 +2456,7 @@ matrix_api_set_display_name(MatrixAPI *api,
|
||||
* successful login.
|
||||
*
|
||||
* If @password is %NULL, this function returns immediately, and fills
|
||||
* @error with %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* @error with %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_register_account(MatrixAPI *api,
|
||||
@ -2472,7 +2472,7 @@ matrix_api_register_account(MatrixAPI *api,
|
||||
|
||||
if (!password) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"password must be set.");
|
||||
|
||||
return;
|
||||
@ -2506,7 +2506,7 @@ matrix_api_register_account(MatrixAPI *api,
|
||||
*
|
||||
* If @user_id, @event_type or @content is %NULL, this
|
||||
* function returns immediately, and fills @error with
|
||||
* %MATRIX_API_ERROR_INCOMPLETE.
|
||||
* %MATRIX_ERROR_INCOMPLETE.
|
||||
*/
|
||||
void
|
||||
matrix_api_set_account_data(MatrixAPI *api,
|
||||
@ -2522,7 +2522,7 @@ matrix_api_set_account_data(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !event_type || !content) {
|
||||
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.");
|
||||
|
||||
return;
|
||||
@ -2550,7 +2550,7 @@ matrix_api_set_account_data(MatrixAPI *api,
|
||||
* List the tags set by a user on a room.
|
||||
*
|
||||
* 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
|
||||
matrix_api_get_room_tags(MatrixAPI *api,
|
||||
@ -2564,7 +2564,7 @@ matrix_api_get_room_tags(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !room_id) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"user_id and room_id must be set.");
|
||||
|
||||
return;
|
||||
@ -2589,7 +2589,7 @@ matrix_api_get_room_tags(MatrixAPI *api,
|
||||
* Remove a tag from the room.
|
||||
*
|
||||
* 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
|
||||
matrix_api_delete_room_tag(MatrixAPI *api,
|
||||
@ -2604,7 +2604,7 @@ matrix_api_delete_room_tag(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !room_id || !tag) {
|
||||
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.");
|
||||
|
||||
return;
|
||||
@ -2633,7 +2633,7 @@ matrix_api_delete_room_tag(MatrixAPI *api,
|
||||
* Add a tag to the room.
|
||||
*
|
||||
* 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
|
||||
matrix_api_add_room_tag(MatrixAPI *api,
|
||||
@ -2649,7 +2649,7 @@ matrix_api_add_room_tag(MatrixAPI *api,
|
||||
|
||||
if (!user_id || !room_id || !tag) {
|
||||
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.");
|
||||
|
||||
return;
|
||||
|
@ -527,8 +527,7 @@ _response_callback(SoupSession *session,
|
||||
GByteArray *raw_content = NULL;
|
||||
|
||||
if (msg->status_code < SOUP_STATUS_CONTINUE) {
|
||||
err = g_error_new(MATRIX_API_ERROR,
|
||||
MATRIX_API_ERROR_COMMUNICATION_ERROR,
|
||||
err = g_error_new(MATRIX_ERROR, MATRIX_ERROR_COMMUNICATION_ERROR,
|
||||
"%s %d: %s",
|
||||
(msg->status_code < 100) ? "Network error" : "HTTP",
|
||||
msg->status_code, msg->reason_phrase);
|
||||
@ -629,7 +628,7 @@ _response_callback(SoupSession *session,
|
||||
gchar *message;
|
||||
const gchar *errcode = NULL;
|
||||
const gchar *error = NULL;
|
||||
MatrixAPIError error_code = MATRIX_API_ERROR_UNKNOWN_ERROR;
|
||||
MatrixError error_code = MATRIX_ERROR_UNKNOWN_ERROR;
|
||||
|
||||
if (errcode_node) {
|
||||
GEnumClass *error_class;
|
||||
@ -639,10 +638,10 @@ _response_callback(SoupSession *session,
|
||||
|
||||
if (strncmp("M_", errcode, 2) == 0) {
|
||||
gchar *matrix_error_code = g_strdup_printf(
|
||||
"MATRIX_API_ERROR_%s", errcode + 2);
|
||||
"MATRIX_ERROR_%s", errcode + 2);
|
||||
|
||||
error_class = g_type_class_ref(
|
||||
MATRIX_TYPE_API_ERROR);
|
||||
MATRIX_TYPE_ERROR);
|
||||
value = g_enum_get_value_by_name(
|
||||
error_class, matrix_error_code);
|
||||
g_free(matrix_error_code);
|
||||
@ -656,7 +655,7 @@ _response_callback(SoupSession *session,
|
||||
}
|
||||
} 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.");
|
||||
error_code = MATRIX_API_ERROR_UNSPECIFIED;
|
||||
error_code = MATRIX_ERROR_UNSPECIFIED;
|
||||
}
|
||||
|
||||
if (error_node) {
|
||||
@ -672,15 +671,13 @@ _response_callback(SoupSession *session,
|
||||
"(No errcode given) %s", error);
|
||||
}
|
||||
|
||||
err = g_error_new_literal(MATRIX_API_ERROR,
|
||||
error_code,
|
||||
err = g_error_new_literal(MATRIX_ERROR, error_code,
|
||||
message);
|
||||
}
|
||||
}
|
||||
} 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,
|
||||
err = g_error_new(MATRIX_ERROR, MATRIX_ERROR_BAD_RESPONSE,
|
||||
"Bad response (not a JSON object)");
|
||||
g_debug("Bad response: %s", data);
|
||||
}
|
||||
@ -692,8 +689,7 @@ _response_callback(SoupSession *session,
|
||||
request_url,
|
||||
datalen);
|
||||
} else {
|
||||
err = g_error_new(MATRIX_API_ERROR,
|
||||
MATRIX_API_ERROR_BAD_RESPONSE,
|
||||
err = g_error_new(MATRIX_ERROR, MATRIX_ERROR_BAD_RESPONSE,
|
||||
"Malformed response (invalid JSON)");
|
||||
g_debug("Malformed response (%s): %s", request_url, data);
|
||||
}
|
||||
@ -745,7 +741,7 @@ _send(MatrixHTTPAPI *api,
|
||||
|
||||
if (!priv->uri) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_COMMUNICATION_ERROR,
|
||||
MATRIX_ERROR, MATRIX_ERROR_COMMUNICATION_ERROR,
|
||||
"No valid base URL");
|
||||
|
||||
return;
|
||||
@ -1118,7 +1114,7 @@ i_join_room(MatrixAPI *api,
|
||||
// TODO: a more thorough check should be used here
|
||||
if (*room_id != '!') {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INVALID_ROOM_ID,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INVALID_ROOM_ID,
|
||||
"Invalid room ID");
|
||||
|
||||
return;
|
||||
@ -2194,7 +2190,7 @@ i_sync(MatrixAPI *api,
|
||||
|
||||
if (filter_id && filter) {
|
||||
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");
|
||||
|
||||
return;
|
||||
@ -2320,7 +2316,7 @@ i_token_refresh(MatrixAPI *api,
|
||||
|
||||
if (!refresh_token && !priv->refresh_token) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_MISSING_TOKEN,
|
||||
MATRIX_ERROR, MATRIX_ERROR_MISSING_TOKEN,
|
||||
"No token available");
|
||||
|
||||
return;
|
||||
@ -2388,7 +2384,7 @@ i_add_3pid(MatrixAPI *api,
|
||||
if ((id_node = matrix_api_3pid_credential_get_json_node(
|
||||
threepid_creds, error)) == NULL) {
|
||||
g_set_error(error,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"Incomplete credential");
|
||||
|
||||
return;
|
||||
|
@ -30,38 +30,36 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* MatrixAPIError:
|
||||
* @MATRIX_API_ERROR_NONE: no error
|
||||
* @MATRIX_API_ERROR_COMMUNICATION_ERROR: there was a problem in
|
||||
* communication
|
||||
* (e.g. connection error)
|
||||
* @MATRIX_API_ERROR_INCOMPLETE: the passed/generated data is
|
||||
* incomplete
|
||||
* @MATRIX_API_ERROR_BAD_REQUEST: the request is invalid
|
||||
* @MATRIX_API_ERROR_BAD_RESPONSE: malformed response, or the response
|
||||
* is not a JSON object
|
||||
* @MATRIX_API_ERROR_INVALID_ROOM_ID: the provided string doesn’t
|
||||
* contain a valid room ID
|
||||
* @MATRIX_API_ERROR_UNKNOWN_VALUE: the response from the Matrix.org
|
||||
* MatrixError:
|
||||
* @MATRIX_ERROR_NONE: no error
|
||||
* @MATRIX_ERROR_COMMUNICATION_ERROR: there was a problem in
|
||||
* communication (e.g. connection
|
||||
* error)
|
||||
* @MATRIX_ERROR_INCOMPLETE: the passed/generated data is incomplete
|
||||
* @MATRIX_ERROR_BAD_REQUEST: the request is invalid
|
||||
* @MATRIX_ERROR_BAD_RESPONSE: malformed response, or the response is
|
||||
* not a JSON object
|
||||
* @MATRIX_ERROR_INVALID_ROOM_ID: the provided string doesn’t contain
|
||||
* a valid room ID
|
||||
* @MATRIX_ERROR_UNKNOWN_VALUE: the response from the Matrix.org
|
||||
* server contains a value unknown to
|
||||
* this library. These should be
|
||||
* reported to the Matrix GLib SDK
|
||||
* developers
|
||||
* @MATRIX_API_ERROR_MISSING_TOKEN: authorization token is missing
|
||||
* from the request
|
||||
* @MATRIX_API_ERROR_FORBIDDEN: access was forbidden (e.g. due to a
|
||||
* this library. These should be reported
|
||||
* to the Matrix GLib SDK developers
|
||||
* @MATRIX_ERROR_MISSING_TOKEN: authorization token is missing from
|
||||
* the request
|
||||
* @MATRIX_ERROR_FORBIDDEN: access was forbidden (e.g. due to a
|
||||
* missing/invalid token, or using a bad
|
||||
* password during login)
|
||||
* @MATRIX_API_ERROR_UNKNOWN: an error unknown to the Matrix server
|
||||
* @MATRIX_API_ERROR_UNKNOWN_TOKEN: the token provided is not known
|
||||
* for the homeserver
|
||||
* @MATRIX_API_ERROR_NOT_JSON: illegal request, the content is not
|
||||
* valid JSON
|
||||
* @MATRIX_API_ERROR_UNRECOGNIZED: the homeserver didn't understand
|
||||
* the request
|
||||
* @MATRIX_API_ERROR_UNSPECIFIED: no error code was sent by the
|
||||
* @MATRIX_ERROR_UNKNOWN: an error unknown to the Matrix server the
|
||||
* homeserver
|
||||
* @MATRIX_API_ERROR_UNKNOWN_ERROR: an error unknown to this library
|
||||
* @MATRIX_ERROR_UNKNOWN_TOKEN: the token provided is not known for
|
||||
* the homeserver
|
||||
* @MATRIX_ERROR_NOT_JSON: illegal request, the content is not valid
|
||||
* JSON
|
||||
* @MATRIX_ERROR_UNRECOGNIZED: the homeserver didn't understand the
|
||||
* request
|
||||
* @MATRIX_ERROR_UNSPECIFIED: no error code was sent by the homeserver
|
||||
* @MATRIX_ERROR_UNKNOWN_ERROR: an error unknown to this library
|
||||
*
|
||||
* Value mappings from Matrix.org API error codes
|
||||
* (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
|
||||
* information on error domains.
|
||||
* Error domain for Matrix GLib SDK. See #GError for more information
|
||||
* 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:
|
||||
@ -1805,7 +1803,7 @@ matrix_api_3pid_credential_get_json_node(MatrixAPI3PidCredential *credential,
|
||||
|| !credential->session_id
|
||||
|| !credential->client_secret) {
|
||||
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!");
|
||||
|
||||
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
|
||||
* 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
|
||||
* @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
|
||||
* object. As in the pusher object all fields are mandatory, if any of
|
||||
* 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
|
||||
* data.
|
||||
@ -2301,7 +2299,7 @@ matrix_api_pusher_get_json_node(MatrixAPIPusher *pusher, GError **err)
|
||||
|| !pusher->profile_tag
|
||||
|| !pusher->pushkey) {
|
||||
g_set_error(err,
|
||||
MATRIX_API_ERROR, MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,
|
||||
"Pusher data incomplete");
|
||||
|
||||
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
|
||||
* the pusher object all fields are mandatory, if any of 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
|
||||
* data.
|
||||
|
@ -25,32 +25,32 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
MATRIX_API_ERROR_NONE,
|
||||
MATRIX_API_ERROR_COMMUNICATION_ERROR,
|
||||
MATRIX_API_ERROR_INCOMPLETE,
|
||||
MATRIX_API_ERROR_BAD_REQUEST,
|
||||
MATRIX_API_ERROR_BAD_RESPONSE,
|
||||
MATRIX_API_ERROR_INVALID_ROOM_ID,
|
||||
MATRIX_API_ERROR_UNKNOWN_VALUE,
|
||||
MATRIX_ERROR_NONE,
|
||||
MATRIX_ERROR_COMMUNICATION_ERROR,
|
||||
MATRIX_ERROR_INCOMPLETE,
|
||||
MATRIX_ERROR_BAD_REQUEST,
|
||||
MATRIX_ERROR_BAD_RESPONSE,
|
||||
MATRIX_ERROR_INVALID_ROOM_ID,
|
||||
MATRIX_ERROR_UNKNOWN_VALUE,
|
||||
|
||||
/* Add Matrix-defined error codes under here, changing `M_` to
|
||||
* `MATRIX_API_ERROR`, i.e. `M_FORBIDDEN` =>
|
||||
* `MATRIX_API_ERROR_FORBIDDEN` */
|
||||
MATRIX_API_ERROR_MISSING_TOKEN = 500,
|
||||
MATRIX_API_ERROR_FORBIDDEN,
|
||||
MATRIX_API_ERROR_UNKNOWN,
|
||||
MATRIX_API_ERROR_UNKNOWN_TOKEN,
|
||||
MATRIX_API_ERROR_NOT_JSON,
|
||||
MATRIX_API_ERROR_UNRECOGNIZED,
|
||||
* `MATRIX_ERROR`, i.e. `M_FORBIDDEN` =>
|
||||
* `MATRIX_ERROR_FORBIDDEN` */
|
||||
MATRIX_ERROR_MISSING_TOKEN = 500,
|
||||
MATRIX_ERROR_FORBIDDEN,
|
||||
MATRIX_ERROR_UNKNOWN,
|
||||
MATRIX_ERROR_UNKNOWN_TOKEN,
|
||||
MATRIX_ERROR_NOT_JSON,
|
||||
MATRIX_ERROR_UNRECOGNIZED,
|
||||
|
||||
/* Allow for a lot of Matrix.org defined codes
|
||||
Do not define error codes after this! */
|
||||
MATRIX_API_ERROR_UNSPECIFIED = 16383,
|
||||
MATRIX_API_ERROR_UNKNOWN_ERROR
|
||||
} MatrixAPIError;
|
||||
MATRIX_ERROR_UNSPECIFIED = 16383,
|
||||
MATRIX_ERROR_UNKNOWN_ERROR
|
||||
} MatrixError;
|
||||
|
||||
#define MATRIX_API_ERROR matrix_api_error_quark()
|
||||
GQuark matrix_api_error_quark(void);
|
||||
#define MATRIX_ERROR matrix_error_quark()
|
||||
GQuark matrix_error_quark(void);
|
||||
|
||||
typedef enum {
|
||||
MATRIX_API_EVENT_FORMAT_DEFAULT,
|
||||
|
Loading…
Reference in New Issue
Block a user