Rename MatrixAPI3PidCredential to Matrix3PidCredential

This commit is contained in:
Gergely Polonkai 2016-01-25 16:22:17 +01:00
parent e6ddc5193a
commit 45b071365d
6 changed files with 102 additions and 102 deletions

View File

@ -106,18 +106,18 @@ matrix_filter_get_json_node
matrix_filter_get_json_data matrix_filter_get_json_data
<SUBSECTION> <SUBSECTION>
MatrixAPI3PidCredential Matrix3PidCredential
matrix_api_3pid_credential_new matrix_3pid_credential_new
matrix_api_3pid_credential_ref matrix_3pid_credential_ref
matrix_api_3pid_credential_unref matrix_3pid_credential_unref
matrix_api_3pid_credential_set_id_server matrix_3pid_credential_set_id_server
matrix_api_3pid_credential_get_id_server matrix_3pid_credential_get_id_server
matrix_api_3pid_credential_set_session_id matrix_3pid_credential_set_session_id
matrix_api_3pid_credential_get_session_id matrix_3pid_credential_get_session_id
matrix_api_3pid_credential_set_client_secret matrix_3pid_credential_set_client_secret
matrix_api_3pid_credential_get_client_secret matrix_3pid_credential_get_client_secret
matrix_api_3pid_credential_get_json_node matrix_3pid_credential_get_json_node
matrix_api_3pid_credential_get_json_data matrix_3pid_credential_get_json_data
<SUBSECTION> <SUBSECTION>
MatrixAPIPusher MatrixAPIPusher
@ -187,8 +187,8 @@ MATRIX_TYPE_ROOM_FILTER
matrix_room_filter_get_type matrix_room_filter_get_type
MATRIX_TYPE_FILTER MATRIX_TYPE_FILTER
matrix_filter_get_type matrix_filter_get_type
MATRIX_TYPE_API_3PID_CREDENTIAL MATRIX_TYPE_3PID_CREDENTIAL
matrix_api_3pid_credential_get_type matrix_3pid_credential_get_type
MATRIX_TYPE_API_PUSHER MATRIX_TYPE_API_PUSHER
matrix_api_pusher_get_type matrix_api_pusher_get_type
MATRIX_TYPE_API_STATE_EVENT MATRIX_TYPE_API_STATE_EVENT

View File

@ -894,7 +894,7 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
* list of state events to set in the new room * list of state events to set in the new room
* @invitees: (element-type utf8) (allow-none): list of user IDs to * @invitees: (element-type utf8) (allow-none): list of user IDs to
* invite to the new room * invite to the new room
* @invite_3pids: (element-type MatrixAPI3PidCredential) (allow-none): * @invite_3pids: (element-type Matrix3PidCredential) (allow-none):
* a list of 3rd party credentials to invite to the * a list of 3rd party credentials to invite to the
* new room * new room
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
@ -1166,7 +1166,7 @@ matrix_api_forget_room(MatrixAPI *api,
* @user_data: (closure): user data to pass to the callback function * @user_data: (closure): user data to pass to the callback function
* @callback * @callback
* @room_id: the room ID to which to invite the user * @room_id: the room ID to which to invite the user
* @credential: (transfer none): a #MatrixAPI3PidCredential that * @credential: (transfer none): a #Matrix3PidCredential that
* identifies a user to invite * identifies a user to invite
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
@ -1185,7 +1185,7 @@ void matrix_api_invite_user_3rdparty(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPI3PidCredential *credential, Matrix3PidCredential *credential,
GError **error) GError **error)
{ {
g_return_if_fail(MATRIX_IS_API(api)); g_return_if_fail(MATRIX_IS_API(api));
@ -2195,7 +2195,7 @@ matrix_api_add_3pid(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
gboolean bind_creds, gboolean bind_creds,
MatrixAPI3PidCredential *threepid_creds, Matrix3PidCredential *threepid_creds,
GError **error) GError **error)
{ {
g_return_if_fail(MATRIX_IS_API(api)); g_return_if_fail(MATRIX_IS_API(api));

View File

@ -212,7 +212,7 @@ struct _MatrixAPIInterface {
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPI3PidCredential *credential, Matrix3PidCredential *credential,
GError **error); GError **error);
void (*invite_user)(MatrixAPI *api, void (*invite_user)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
@ -386,7 +386,7 @@ struct _MatrixAPIInterface {
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
gboolean bind_creds, gboolean bind_creds,
MatrixAPI3PidCredential *threepid_creds, Matrix3PidCredential *threepid_creds,
GError **error); GError **error);
void (*change_password)(MatrixAPI *api, void (*change_password)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
@ -637,7 +637,7 @@ void matrix_api_invite_user_3rdparty(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPI3PidCredential *credential, Matrix3PidCredential *credential,
GError **error); GError **error);
void matrix_api_invite_user(MatrixAPI *api, void matrix_api_invite_user(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
@ -810,7 +810,7 @@ void matrix_api_add_3pid(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
gboolean bind_creds, gboolean bind_creds,
MatrixAPI3PidCredential *threepid_creds, Matrix3PidCredential *threepid_creds,
GError **error); GError **error);
void matrix_api_change_password(MatrixAPI *api, void matrix_api_change_password(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,

View File

@ -883,7 +883,7 @@ typedef struct {
} Add3PidCredData; } Add3PidCredData;
static void static void
add_3pidcred(MatrixAPI3PidCredential *credential, Add3PidCredData *data) add_3pidcred(Matrix3PidCredential *credential, Add3PidCredData *data)
{ {
JsonNode *node; JsonNode *node;
@ -893,7 +893,7 @@ add_3pidcred(MatrixAPI3PidCredential *credential, Add3PidCredData *data)
} }
// Get the credentials JSON representation // Get the credentials JSON representation
node = matrix_api_3pid_credential_get_json_node(credential, &(data->error)); node = matrix_3pid_credential_get_json_node(credential, &(data->error));
// Add it to the builder // Add it to the builder
json_builder_add_value(data->builder, node); json_builder_add_value(data->builder, node);
@ -1738,7 +1738,7 @@ i_invite_user_3rdparty(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPI3PidCredential *credential, Matrix3PidCredential *credential,
GError **error) GError **error)
{ {
gchar *encoded_room_id, *path; gchar *encoded_room_id, *path;
@ -1749,8 +1749,8 @@ i_invite_user_3rdparty(MatrixAPI *api,
path = g_strdup_printf("rooms/%s/invite", encoded_room_id); path = g_strdup_printf("rooms/%s/invite", encoded_room_id);
g_free(encoded_room_id); g_free(encoded_room_id);
if ((body = matrix_api_3pid_credential_get_json_node(credential, if ((body = matrix_3pid_credential_get_json_node(credential,
error)) == NULL) { error)) == NULL) {
return; return;
} }
@ -2375,13 +2375,13 @@ i_add_3pid(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
gboolean bind_creds, gboolean bind_creds,
MatrixAPI3PidCredential *threepid_creds, Matrix3PidCredential *threepid_creds,
GError **error) GError **error)
{ {
JsonBuilder *builder; JsonBuilder *builder;
JsonNode *body, *id_node; JsonNode *body, *id_node;
if ((id_node = matrix_api_3pid_credential_get_json_node( if ((id_node = matrix_3pid_credential_get_json_node(
threepid_creds, error)) == NULL) { threepid_creds, error)) == NULL) {
g_set_error(error, g_set_error(error,
MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE, MATRIX_ERROR, MATRIX_ERROR_INCOMPLETE,

View File

@ -1584,43 +1584,43 @@ matrix_filter_get_json_data(MatrixFilter *filter, gsize *datalen)
} }
/** /**
* MatrixAPI3PidCredential: * Matrix3PidCredential:
* *
* An opaque structure to store credentials to use with Identity * An opaque structure to store credentials to use with Identity
* Server communication. * Server communication.
*/ */
struct _MatrixAPI3PidCredential { struct _Matrix3PidCredential {
gchar *id_server; gchar *id_server;
gchar *session_id; gchar *session_id;
gchar *client_secret; gchar *client_secret;
guint refcount; guint refcount;
}; };
G_DEFINE_BOXED_TYPE(MatrixAPI3PidCredential, matrix_api_3pid_credential, G_DEFINE_BOXED_TYPE(Matrix3PidCredential, matrix_3pid_credential,
(GBoxedCopyFunc)matrix_api_3pid_credential_ref, (GBoxedCopyFunc)matrix_3pid_credential_ref,
(GBoxedFreeFunc)matrix_api_3pid_credential_unref); (GBoxedFreeFunc)matrix_3pid_credential_unref);
/** /**
* matrix_api_3pid_credential_new: * matrix_3pid_credential_new:
* *
* Create a new #MatrixAPI3PidCredential object with reference count * Create a new #Matrix3PidCredential object with reference count
* of 1. * of 1.
* *
* Returns: (transfer full): a new #MatrixAPI3PidCredential * Returns: (transfer full): a new #Matrix3PidCredential
*/ */
MatrixAPI3PidCredential * Matrix3PidCredential *
matrix_api_3pid_credential_new(void) matrix_3pid_credential_new(void)
{ {
MatrixAPI3PidCredential *credential; Matrix3PidCredential *credential;
credential = g_new0(MatrixAPI3PidCredential, 1); credential = g_new0(Matrix3PidCredential, 1);
credential->refcount = 1; credential->refcount = 1;
return credential; return credential;
} }
static void static void
matrix_api_3pid_credential_free(MatrixAPI3PidCredential *credential) matrix_3pid_credential_free(Matrix3PidCredential *credential)
{ {
g_free(credential->id_server); g_free(credential->id_server);
g_free(credential->session_id); g_free(credential->session_id);
@ -1629,15 +1629,15 @@ matrix_api_3pid_credential_free(MatrixAPI3PidCredential *credential)
} }
/** /**
* matrix_api_3pid_credential_ref: * matrix_3pid_credential_ref:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* *
* Increase reference count of @credential by one. * Increase reference count of @credential by one.
* *
* Returns: (transfer none): the same #MatrixAPI3PidCredential * Returns: (transfer none): the same #Matrix3PidCredential
*/ */
MatrixAPI3PidCredential * Matrix3PidCredential *
matrix_api_3pid_credential_ref(MatrixAPI3PidCredential *credential) matrix_3pid_credential_ref(Matrix3PidCredential *credential)
{ {
credential->refcount++; credential->refcount++;
@ -1645,38 +1645,38 @@ matrix_api_3pid_credential_ref(MatrixAPI3PidCredential *credential)
} }
/** /**
* matrix_api_3pid_credential_unref: * matrix_3pid_credential_unref:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* *
* Decrease reference count of @credential by one. If reference count * Decrease reference count of @credential by one. If reference count
* reaches zero, @credential gets freed. * reaches zero, @credential gets freed.
*/ */
void void
matrix_api_3pid_credential_unref(MatrixAPI3PidCredential *credential) matrix_3pid_credential_unref(Matrix3PidCredential *credential)
{ {
if (--credential->refcount == 0) { if (--credential->refcount == 0) {
matrix_api_3pid_credential_free(credential); matrix_3pid_credential_free(credential);
} }
} }
/** /**
* matrix_api_3pid_credential_set_id_server: * matrix_3pid_credential_set_id_server:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* @id_server: the Identity Server to use * @id_server: the Identity Server to use
* *
* Set the Identity Server to use for this credential. * Set the Identity Server to use for this credential.
*/ */
void void
matrix_api_3pid_credential_set_id_server(MatrixAPI3PidCredential *credential, matrix_3pid_credential_set_id_server(Matrix3PidCredential *credential,
const gchar *id_server) const gchar *id_server)
{ {
g_free(credential->id_server); g_free(credential->id_server);
credential->id_server = g_strdup(id_server); credential->id_server = g_strdup(id_server);
} }
/** /**
* matrix_api_3pid_credential_get_id_server: * matrix_3pid_credential_get_id_server:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* *
* Get the Identity Server used for this credential. * Get the Identity Server used for this credential.
* *
@ -1684,29 +1684,29 @@ matrix_api_3pid_credential_set_id_server(MatrixAPI3PidCredential *credential,
* @credential and should not be freed nor modified * @credential and should not be freed nor modified
*/ */
const gchar * const gchar *
matrix_api_3pid_credential_get_id_server(MatrixAPI3PidCredential *credential) matrix_3pid_credential_get_id_server(Matrix3PidCredential *credential)
{ {
return credential->id_server; return credential->id_server;
} }
/** /**
* matrix_api_3pid_credential_set_session_id: * matrix_3pid_credential_set_session_id:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* @session_id: the session identifier given by the Identity Server * @session_id: the session identifier given by the Identity Server
* *
* Set the session identifier got from the Identity Server. * Set the session identifier got from the Identity Server.
*/ */
void void
matrix_api_3pid_credential_set_session_id(MatrixAPI3PidCredential *credential, matrix_3pid_credential_set_session_id(Matrix3PidCredential *credential,
const gchar *session_id) const gchar *session_id)
{ {
g_free(credential->session_id); g_free(credential->session_id);
credential->session_id = g_strdup(session_id); credential->session_id = g_strdup(session_id);
} }
/** /**
* matrix_api_3pid_credential_get_session_id: * matrix_3pid_credential_get_session_id:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* *
* Get the session identifier for this credential. * Get the session identifier for this credential.
* *
@ -1714,14 +1714,14 @@ matrix_api_3pid_credential_set_session_id(MatrixAPI3PidCredential *credential,
* @credential and should not be freed nor modified. * @credential and should not be freed nor modified.
*/ */
const gchar * const gchar *
matrix_api_3pid_credential_get_session_id(MatrixAPI3PidCredential *credential) matrix_3pid_credential_get_session_id(Matrix3PidCredential *credential)
{ {
return credential->session_id; return credential->session_id;
} }
/** /**
* matrix_api_3pid_credential_set_client_secret: * matrix_3pid_credential_set_client_secret:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* @client_secret: the client secret used in the session with the * @client_secret: the client secret used in the session with the
* Identity Server * Identity Server
* *
@ -1729,16 +1729,16 @@ matrix_api_3pid_credential_get_session_id(MatrixAPI3PidCredential *credential)
* Identity Server. * Identity Server.
*/ */
void void
matrix_api_3pid_credential_set_client_secret(MatrixAPI3PidCredential *credential, matrix_3pid_credential_set_client_secret(Matrix3PidCredential *credential,
const gchar *client_secret) const gchar *client_secret)
{ {
g_free(credential->client_secret); g_free(credential->client_secret);
credential->client_secret = g_strdup(client_secret); credential->client_secret = g_strdup(client_secret);
} }
/** /**
* matrix_api_3pid_credential_get_client_secret: * matrix_3pid_credential_get_client_secret:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* *
* Get the client secret that was used in the session with the * Get the client secret that was used in the session with the
* Identity Server. * Identity Server.
@ -1747,14 +1747,14 @@ matrix_api_3pid_credential_set_client_secret(MatrixAPI3PidCredential *credential
* @credential and should not be freed nor modified. * @credential and should not be freed nor modified.
*/ */
const gchar * const gchar *
matrix_api_3pid_credential_get_client_secret(MatrixAPI3PidCredential *credential) matrix_3pid_credential_get_client_secret(Matrix3PidCredential *credential)
{ {
return credential->client_secret; return credential->client_secret;
} }
/** /**
* matrix_api_3pid_credential_get_json_node: * matrix_3pid_credential_get_json_node:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Get the JSON representation of @credential as a #JsonNode. If any * Get the JSON representation of @credential as a #JsonNode. If any
@ -1765,8 +1765,8 @@ matrix_api_3pid_credential_get_client_secret(MatrixAPI3PidCredential *credential
* of @credential * of @credential
*/ */
JsonNode * JsonNode *
matrix_api_3pid_credential_get_json_node(MatrixAPI3PidCredential *credential, matrix_3pid_credential_get_json_node(Matrix3PidCredential *credential,
GError **error) GError **error)
{ {
JsonBuilder *builder; JsonBuilder *builder;
JsonNode *node; JsonNode *node;
@ -1801,8 +1801,8 @@ matrix_api_3pid_credential_get_json_node(MatrixAPI3PidCredential *credential,
} }
/** /**
* matrix_api_3pid_credential_get_json_data: * matrix_3pid_credential_get_json_data:
* @credential: a #MatrixAPI3PidCredential * @credential: a #Matrix3PidCredential
* @datalen: (out): storage location for the length of the JSON data, * @datalen: (out): storage location for the length of the JSON data,
* or %NULL * or %NULL
* @error: a #GError * @error: a #GError
@ -1815,15 +1815,15 @@ matrix_api_3pid_credential_get_json_node(MatrixAPI3PidCredential *credential,
* @credential, or %NULL * @credential, or %NULL
*/ */
gchar * gchar *
matrix_api_3pid_credential_get_json_data(MatrixAPI3PidCredential *credential, matrix_3pid_credential_get_json_data(Matrix3PidCredential *credential,
gsize *datalen, gsize *datalen,
GError **error) GError **error)
{ {
JsonGenerator *generator; JsonGenerator *generator;
JsonNode *node; JsonNode *node;
gchar *data; gchar *data;
if ((node = matrix_api_3pid_credential_get_json_node( if ((node = matrix_3pid_credential_get_json_node(
credential, error)) == NULL) { credential, error)) == NULL) {
return NULL; return NULL;
} }

View File

@ -215,28 +215,28 @@ MatrixRoomFilter *matrix_filter_get_room_filter(MatrixFilter *filter);
JsonNode *matrix_filter_get_json_node(MatrixFilter *filter); JsonNode *matrix_filter_get_json_node(MatrixFilter *filter);
gchar *matrix_filter_get_json_data(MatrixFilter *filter, gsize *datalen); gchar *matrix_filter_get_json_data(MatrixFilter *filter, gsize *datalen);
typedef struct _MatrixAPI3PidCredential MatrixAPI3PidCredential; typedef struct _Matrix3PidCredential Matrix3PidCredential;
GType matrix_api_3pid_credential_get_type(void); GType matrix_3pid_credential_get_type(void);
#define MATRIX_TYPE_API_3PID_CREDENTIAL (matrix_api_3pid_credential_get_type()) #define MATRIX_TYPE_3PID_CREDENTIAL (matrix_3pid_credential_get_type())
MatrixAPI3PidCredential *matrix_api_3pid_credential_new(void); Matrix3PidCredential *matrix_3pid_credential_new(void);
MatrixAPI3PidCredential *matrix_api_3pid_credential_ref(MatrixAPI3PidCredential *credential); Matrix3PidCredential *matrix_3pid_credential_ref(Matrix3PidCredential *credential);
void matrix_api_3pid_credential_unref(MatrixAPI3PidCredential *credential); void matrix_3pid_credential_unref(Matrix3PidCredential *credential);
void matrix_api_3pid_credential_set_id_server(MatrixAPI3PidCredential *credential, void matrix_3pid_credential_set_id_server(Matrix3PidCredential *credential,
const gchar *id_server); const gchar *id_server);
const gchar *matrix_api_3pid_credential_get_id_server(MatrixAPI3PidCredential *credential); const gchar *matrix_3pid_credential_get_id_server(Matrix3PidCredential *credential);
void matrix_api_3pid_credential_set_session_id(MatrixAPI3PidCredential *credential, void matrix_3pid_credential_set_session_id(Matrix3PidCredential *credential,
const gchar *session_id); const gchar *session_id);
const gchar *matrix_api_3pid_credential_get_session_id(MatrixAPI3PidCredential *credential); const gchar *matrix_3pid_credential_get_session_id(Matrix3PidCredential *credential);
void matrix_api_3pid_credential_set_client_secret(MatrixAPI3PidCredential *credential, void matrix_3pid_credential_set_client_secret(Matrix3PidCredential *credential,
const gchar *client_secret); const gchar *client_secret);
const gchar *matrix_api_3pid_credential_get_client_secret(MatrixAPI3PidCredential *credential); const gchar *matrix_3pid_credential_get_client_secret(Matrix3PidCredential *credential);
JsonNode *matrix_api_3pid_credential_get_json_node(MatrixAPI3PidCredential *credential, JsonNode *matrix_3pid_credential_get_json_node(Matrix3PidCredential *credential,
GError **error); GError **error);
gchar *matrix_api_3pid_credential_get_json_data(MatrixAPI3PidCredential *credential, gchar *matrix_3pid_credential_get_json_data(Matrix3PidCredential *credential,
gsize *datalen, gsize *datalen,
GError **error); GError **error);
typedef struct _MatrixAPIPusher MatrixAPIPusher; typedef struct _MatrixAPIPusher MatrixAPIPusher;