2016-01-06 13:12:57 +00:00
|
|
|
/*
|
|
|
|
* This file is part of matrix-glib-sdk
|
|
|
|
*
|
|
|
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation, either
|
|
|
|
* version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* matrix-glib-sdk is distributed in the hope that it will be
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with matrix-glib-sdk. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-01-25 10:39:49 +00:00
|
|
|
#ifndef __MATRIX_TYPES_H__
|
|
|
|
#define __MATRIX_TYPES_H__
|
2016-01-06 13:12:57 +00:00
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <json-glib/json-glib.h>
|
|
|
|
|
2016-01-07 11:26:24 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2016-01-11 09:41:28 +00:00
|
|
|
typedef enum {
|
2016-01-25 11:17:44 +00:00
|
|
|
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,
|
2016-02-02 12:03:17 +00:00
|
|
|
MATRIX_ERROR_INVALID_TYPE,
|
|
|
|
MATRIX_ERROR_UNSUPPORTED,
|
|
|
|
MATRIX_ERROR_INVALID_FORMAT,
|
2016-01-11 14:23:45 +00:00
|
|
|
|
2016-02-03 17:19:10 +00:00
|
|
|
/* Add Matrix-defined error codes under here, prefixing them with
|
|
|
|
* `MATRIX_ERROR_`, i.e. `M_FORBIDDEN` =>
|
|
|
|
* `MATRIX_ERROR_M_FORBIDDEN` */
|
|
|
|
MATRIX_ERROR_M_MISSING_TOKEN = 500,
|
|
|
|
MATRIX_ERROR_M_FORBIDDEN,
|
|
|
|
MATRIX_ERROR_M_UNKNOWN,
|
|
|
|
MATRIX_ERROR_M_UNKNOWN_TOKEN,
|
|
|
|
MATRIX_ERROR_M_NOT_JSON,
|
|
|
|
MATRIX_ERROR_M_UNRECOGNIZED,
|
2016-02-02 12:03:17 +00:00
|
|
|
MATRIX_ERROR_M_UNAUTHORIZED,
|
|
|
|
MATRIX_ERROR_M_BAD_JSON,
|
|
|
|
MATRIX_ERROR_M_USER_IN_USE,
|
|
|
|
MATRIX_ERROR_M_ROOM_IN_USE,
|
|
|
|
MATRIX_ERROR_M_BAD_PAGINATION,
|
|
|
|
MATRIX_ERROR_M_BAD_STATE,
|
|
|
|
MATRIX_ERROR_M_NOT_FOUND,
|
|
|
|
MATRIX_ERROR_M_GUEST_ACCESS_FORBIDDEN,
|
|
|
|
MATRIX_ERROR_M_LIMIT_EXCEEDED,
|
|
|
|
MATRIX_ERROR_M_CAPTCHA_NEEDED,
|
|
|
|
MATRIX_ERROR_M_CAPTCHA_INVALID,
|
|
|
|
MATRIX_ERROR_M_MISSING_PARAM,
|
|
|
|
MATRIX_ERROR_M_TOO_LARGE,
|
|
|
|
MATRIX_ERROR_M_EXCLUSIVE,
|
|
|
|
MATRIX_ERROR_M_THREEPID_AUTH_FAILED,
|
|
|
|
MATRIX_ERROR_M_THREEPID_IN_USE,
|
|
|
|
MATRIX_ERROR_M_INVALID_USERNAME,
|
2016-01-11 14:23:45 +00:00
|
|
|
|
2016-01-11 09:41:28 +00:00
|
|
|
/* Allow for a lot of Matrix.org defined codes
|
|
|
|
Do not define error codes after this! */
|
2016-01-25 11:17:44 +00:00
|
|
|
MATRIX_ERROR_UNSPECIFIED = 16383,
|
|
|
|
MATRIX_ERROR_UNKNOWN_ERROR
|
|
|
|
} MatrixError;
|
2016-01-11 09:41:28 +00:00
|
|
|
|
2016-01-25 11:17:44 +00:00
|
|
|
#define MATRIX_ERROR matrix_error_quark()
|
|
|
|
GQuark matrix_error_quark(void);
|
2016-01-11 09:41:28 +00:00
|
|
|
|
2016-01-11 13:07:27 +00:00
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_RESIZE_METHOD_DEFAULT,
|
|
|
|
MATRIX_RESIZE_METHOD_CROP,
|
|
|
|
MATRIX_RESIZE_METHOD_SCALE
|
|
|
|
} MatrixResizeMethod;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-01-24 20:25:48 +00:00
|
|
|
MATRIX_PRESENCE_UNKNOWN,
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_PRESENCE_ONLINE,
|
|
|
|
MATRIX_PRESENCE_OFFLINE,
|
|
|
|
MATRIX_PRESENCE_UNAVAILABLE,
|
|
|
|
MATRIX_PRESENCE_FREE_FOR_CHAT
|
|
|
|
} MatrixPresence;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_ROOM_PRESET_NONE,
|
|
|
|
MATRIX_ROOM_PRESET_PRIVATE,
|
|
|
|
MATRIX_ROOM_PRESET_TRUSTED_PRIVATE,
|
|
|
|
MATRIX_ROOM_PRESET_PUBLIC
|
|
|
|
} MatrixRoomPreset;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_ROOM_VISIBILITY_DEFAULT,
|
|
|
|
MATRIX_ROOM_VISIBILITY_PUBLIC,
|
|
|
|
MATRIX_ROOM_VISIBILITY_PRIVATE
|
|
|
|
} MatrixRoomVisibility;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_EVENT_DIRECTION_FORWARD,
|
|
|
|
MATRIX_EVENT_DIRECTION_BACKWARD
|
|
|
|
} MatrixEventDirection;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_RECEIPT_TYPE_READ
|
|
|
|
} MatrixReceiptType;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_PUSHER_KIND_OVERRIDE,
|
|
|
|
MATRIX_PUSHER_KIND_SENDER,
|
|
|
|
MATRIX_PUSHER_KIND_ROOM,
|
|
|
|
MATRIX_PUSHER_KIND_CONTENT,
|
|
|
|
MATRIX_PUSHER_KIND_UNDERRIDE
|
|
|
|
} MatrixPusherKind;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_PUSHER_CONDITION_KIND_EVENT_MATCH,
|
|
|
|
MATRIX_PUSHER_CONDITION_KIND_PROFILE_TAG,
|
|
|
|
MATRIX_PUSHER_CONDITION_KIND_CONTAINS_DISPLAY_NAME,
|
|
|
|
MATRIX_PUSHER_CONDITION_KIND_ROOM_MEMBER_COUNT
|
|
|
|
} MatrixPusherConditionKind;
|
2016-01-11 13:07:27 +00:00
|
|
|
|
2016-01-16 13:17:31 +00:00
|
|
|
typedef enum {
|
2016-01-25 11:42:26 +00:00
|
|
|
MATRIX_ACCOUNT_KIND_DEFAULT,
|
|
|
|
MATRIX_ACCOUNT_KIND_USER,
|
|
|
|
MATRIX_ACCOUNT_KIND_GUEST
|
|
|
|
} MatrixAccountKind;
|
2016-01-16 13:17:31 +00:00
|
|
|
|
2016-01-25 15:36:18 +00:00
|
|
|
typedef struct _MatrixStateEvent MatrixStateEvent;
|
|
|
|
|
|
|
|
GType matrix_state_event_get_type(void);
|
|
|
|
#define MATRIX_TYPE_STATE_EVENT (matrix_state_event_get_type())
|
|
|
|
|
|
|
|
MatrixStateEvent *matrix_state_event_new(void);
|
|
|
|
MatrixStateEvent *matrix_state_event_ref(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_unref(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_set_event_type(MatrixStateEvent *event,
|
|
|
|
const gchar *event_type);
|
|
|
|
const gchar *matrix_state_event_get_event_type(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_set_state_key(MatrixStateEvent *event,
|
|
|
|
const gchar *state_key);
|
|
|
|
const gchar *matrix_state_event_get_state_key(MatrixStateEvent *event);
|
|
|
|
void matrix_state_event_set_content(MatrixStateEvent *event,
|
|
|
|
const JsonNode *content);
|
|
|
|
const JsonNode *matrix_state_event_get_content(MatrixStateEvent *event);
|
|
|
|
JsonNode *matrix_state_event_get_json_node(MatrixStateEvent *event);
|
|
|
|
gchar *matrix_state_event_get_json_data(MatrixStateEvent *event,
|
|
|
|
gsize *datalen);
|
2016-01-11 12:45:51 +00:00
|
|
|
|
2016-01-27 07:05:33 +00:00
|
|
|
typedef struct _MatrixPresenceEvent MatrixPresenceEvent;
|
|
|
|
|
|
|
|
GType matrix_presence_event_get_type(void);
|
|
|
|
#define MATRIX_TYPE_PRESENCE_EVENT (matrix_presence_event_get_type())
|
|
|
|
|
|
|
|
MatrixPresenceEvent *matrix_presence_event_new(void);
|
|
|
|
MatrixPresenceEvent *matrix_presence_event_new_from_json(JsonNode *json_data);
|
|
|
|
MatrixPresenceEvent *matrix_presence_event_ref(MatrixPresenceEvent *event);
|
|
|
|
void matrix_presence_event_unref(MatrixPresenceEvent *event);
|
|
|
|
void matrix_presence_event_set_user_id(MatrixPresenceEvent *event,
|
|
|
|
const gchar *user_id);
|
|
|
|
const gchar *matrix_presence_event_get_user_id(MatrixPresenceEvent *event);
|
|
|
|
void matrix_presence_event_set_display_name(MatrixPresenceEvent *event,
|
|
|
|
const gchar *display_name);
|
|
|
|
const gchar *matrix_presence_event_get_display_name(MatrixPresenceEvent *event);
|
|
|
|
void matrix_presence_event_set_avatar_url(MatrixPresenceEvent *event,
|
|
|
|
const gchar *avatar_url);
|
|
|
|
const gchar *matrix_presence_event_get_avatar_url(MatrixPresenceEvent *event);
|
|
|
|
void matrix_presence_event_set_last_active_ago(MatrixPresenceEvent *event,
|
|
|
|
gulong last_active_ago);
|
|
|
|
gulong matrix_presence_event_get_last_active_ago(MatrixPresenceEvent *event);
|
|
|
|
void matrix_presence_event_set_presence(MatrixPresenceEvent *event,
|
|
|
|
MatrixPresence presence);
|
|
|
|
MatrixPresence matrix_presence_event_get_presence(MatrixPresenceEvent *event);
|
|
|
|
|
2016-01-07 11:26:24 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2016-01-25 10:39:49 +00:00
|
|
|
#endif /* __MATRIX_TYPES_H__ */
|