Skip to content

Commit

Permalink
Merge #669(kitsune): Update to Matrix v1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
KitsuneRal authored Jun 6, 2023
2 parents 49b24a0 + ccec05b commit 896f250
Show file tree
Hide file tree
Showing 54 changed files with 785 additions and 490 deletions.
10 changes: 5 additions & 5 deletions Quotient/application-service/definitions/location.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ struct ThirdPartyLocation {
/// An alias for a matrix room.
QString alias;

/// The protocol ID that the third party location is a part of.
/// The protocol ID that the third-party location is a part of.
QString protocol;

/// Information used to identify this third party location.
/// Information used to identify this third-party location.
QJsonObject fields;
};

Expand All @@ -29,9 +29,9 @@ struct JsonObjectConverter<ThirdPartyLocation> {
}
static void fillFrom(const QJsonObject& jo, ThirdPartyLocation& pod)
{
fromJson(jo.value("alias"_ls), pod.alias);
fromJson(jo.value("protocol"_ls), pod.protocol);
fromJson(jo.value("fields"_ls), pod.fields);
fillFromJson(jo.value("alias"_ls), pod.alias);
fillFromJson(jo.value("protocol"_ls), pod.protocol);
fillFromJson(jo.value("fields"_ls), pod.fields);
}
};

Expand Down
38 changes: 19 additions & 19 deletions Quotient/application-service/definitions/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,58 +27,58 @@ struct JsonObjectConverter<FieldType> {
}
static void fillFrom(const QJsonObject& jo, FieldType& pod)
{
fromJson(jo.value("regexp"_ls), pod.regexp);
fromJson(jo.value("placeholder"_ls), pod.placeholder);
fillFromJson(jo.value("regexp"_ls), pod.regexp);
fillFromJson(jo.value("placeholder"_ls), pod.placeholder);
}
};

struct ProtocolInstance {
/// A human-readable description for the protocol, such as the name.
QString desc;

/// An optional content URI representing the protocol. Overrides the one
/// provided at the higher level Protocol object.
QString icon;

/// Preset values for `fields` the client may use to search by.
QJsonObject fields;

/// A unique identifier across all instances.
QString networkId;

/// An optional content URI representing the protocol. Overrides the one
/// provided at the higher level Protocol object.
QString icon{};
};

template <>
struct JsonObjectConverter<ProtocolInstance> {
static void dumpTo(QJsonObject& jo, const ProtocolInstance& pod)
{
addParam<>(jo, QStringLiteral("desc"), pod.desc);
addParam<IfNotEmpty>(jo, QStringLiteral("icon"), pod.icon);
addParam<>(jo, QStringLiteral("fields"), pod.fields);
addParam<>(jo, QStringLiteral("network_id"), pod.networkId);
addParam<IfNotEmpty>(jo, QStringLiteral("icon"), pod.icon);
}
static void fillFrom(const QJsonObject& jo, ProtocolInstance& pod)
{
fromJson(jo.value("desc"_ls), pod.desc);
fromJson(jo.value("icon"_ls), pod.icon);
fromJson(jo.value("fields"_ls), pod.fields);
fromJson(jo.value("network_id"_ls), pod.networkId);
fillFromJson(jo.value("desc"_ls), pod.desc);
fillFromJson(jo.value("fields"_ls), pod.fields);
fillFromJson(jo.value("network_id"_ls), pod.networkId);
fillFromJson(jo.value("icon"_ls), pod.icon);
}
};

struct ThirdPartyProtocol {
/// Fields which may be used to identify a third party user. These should be
/// Fields which may be used to identify a third-party user. These should be
/// ordered to suggest the way that entities may be grouped, where higher
/// groupings are ordered first. For example, the name of a network should
/// be searched before the nickname of a user.
QStringList userFields;

/// Fields which may be used to identify a third party location. These
/// Fields which may be used to identify a third-party location. These
/// should be ordered to suggest the way that entities may be grouped, where
/// higher groupings are ordered first. For example, the name of a network
/// should be searched before the name of a channel.
QStringList locationFields;

/// A content URI representing an icon for the third party protocol.
/// A content URI representing an icon for the third-party protocol.
QString icon;

/// The type definitions for the fields defined in the `user_fields` and
Expand Down Expand Up @@ -106,11 +106,11 @@ struct JsonObjectConverter<ThirdPartyProtocol> {
}
static void fillFrom(const QJsonObject& jo, ThirdPartyProtocol& pod)
{
fromJson(jo.value("user_fields"_ls), pod.userFields);
fromJson(jo.value("location_fields"_ls), pod.locationFields);
fromJson(jo.value("icon"_ls), pod.icon);
fromJson(jo.value("field_types"_ls), pod.fieldTypes);
fromJson(jo.value("instances"_ls), pod.instances);
fillFromJson(jo.value("user_fields"_ls), pod.userFields);
fillFromJson(jo.value("location_fields"_ls), pod.locationFields);
fillFromJson(jo.value("icon"_ls), pod.icon);
fillFromJson(jo.value("field_types"_ls), pod.fieldTypes);
fillFromJson(jo.value("instances"_ls), pod.instances);
}
};

Expand Down
12 changes: 6 additions & 6 deletions Quotient/application-service/definitions/user.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
namespace Quotient {

struct ThirdPartyUser {
/// A Matrix User ID represting a third party user.
/// A Matrix User ID represting a third-party user.
QString userid;

/// The protocol ID that the third party location is a part of.
/// The protocol ID that the third-party location is a part of.
QString protocol;

/// Information used to identify this third party location.
/// Information used to identify this third-party location.
QJsonObject fields;
};

Expand All @@ -29,9 +29,9 @@ struct JsonObjectConverter<ThirdPartyUser> {
}
static void fillFrom(const QJsonObject& jo, ThirdPartyUser& pod)
{
fromJson(jo.value("userid"_ls), pod.userid);
fromJson(jo.value("protocol"_ls), pod.protocol);
fromJson(jo.value("fields"_ls), pod.fields);
fillFromJson(jo.value("userid"_ls), pod.userid);
fillFromJson(jo.value("protocol"_ls), pod.protocol);
fillFromJson(jo.value("fields"_ls), pod.fields);
}
};

Expand Down
20 changes: 10 additions & 10 deletions Quotient/csapi/admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class QUOTIENT_API GetWhoIsJob : public BaseJob {
/// specified in this document.
struct ConnectionInfo {
/// Most recently seen IP address of the session.
QString ip;
QString ip{};
/// Unix timestamp that the session was last active.
Omittable<qint64> lastSeen;
Omittable<qint64> lastSeen{};
/// User agent string last seen in the session.
QString userAgent;
QString userAgent{};
};

/// Gets information about a particular user.
Expand All @@ -41,7 +41,7 @@ class QUOTIENT_API GetWhoIsJob : public BaseJob {
/// specified in this document.
struct SessionInfo {
/// Information particular connections in the session.
QVector<ConnectionInfo> connections;
QVector<ConnectionInfo> connections{};
};

/// Gets information about a particular user.
Expand All @@ -52,7 +52,7 @@ class QUOTIENT_API GetWhoIsJob : public BaseJob {
struct DeviceInfo {
/// A user's sessions (i.e. what they did with an access token from one
/// login).
QVector<SessionInfo> sessions;
QVector<SessionInfo> sessions{};
};

// Construction/destruction
Expand Down Expand Up @@ -88,25 +88,25 @@ struct JsonObjectConverter<GetWhoIsJob::ConnectionInfo> {
static void fillFrom(const QJsonObject& jo,
GetWhoIsJob::ConnectionInfo& result)
{
fromJson(jo.value("ip"_ls), result.ip);
fromJson(jo.value("last_seen"_ls), result.lastSeen);
fromJson(jo.value("user_agent"_ls), result.userAgent);
fillFromJson(jo.value("ip"_ls), result.ip);
fillFromJson(jo.value("last_seen"_ls), result.lastSeen);
fillFromJson(jo.value("user_agent"_ls), result.userAgent);
}
};

template <>
struct JsonObjectConverter<GetWhoIsJob::SessionInfo> {
static void fillFrom(const QJsonObject& jo, GetWhoIsJob::SessionInfo& result)
{
fromJson(jo.value("connections"_ls), result.connections);
fillFromJson(jo.value("connections"_ls), result.connections);
}
};

template <>
struct JsonObjectConverter<GetWhoIsJob::DeviceInfo> {
static void fillFrom(const QJsonObject& jo, GetWhoIsJob::DeviceInfo& result)
{
fromJson(jo.value("sessions"_ls), result.sessions);
fillFromJson(jo.value("sessions"_ls), result.sessions);
}
};

Expand Down
54 changes: 27 additions & 27 deletions Quotient/csapi/administrative_contact.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

namespace Quotient {

/*! \brief Gets a list of a user's third party identifiers.
/*! \brief Gets a list of a user's third-party identifiers.
*
* Gets a list of the third party identifiers that the homeserver has
* Gets a list of the third-party identifiers that the homeserver has
* associated with the user's account.
*
* This is *not* the same as the list of third party identifiers bound to
* This is *not* the same as the list of third-party identifiers bound to
* the user's Matrix ID in identity servers.
*
* Identifiers in this list may be used by the homeserver as, for example,
Expand All @@ -27,30 +27,30 @@ class QUOTIENT_API GetAccount3PIDsJob : public BaseJob {
public:
// Inner data structures

/// Gets a list of the third party identifiers that the homeserver has
/// Gets a list of the third-party identifiers that the homeserver has
/// associated with the user's account.
///
/// This is *not* the same as the list of third party identifiers bound to
/// This is *not* the same as the list of third-party identifiers bound to
/// the user's Matrix ID in identity servers.
///
/// Identifiers in this list may be used by the homeserver as, for example,
/// identifiers that it will accept to reset the user's account password.
struct ThirdPartyIdentifier {
/// The medium of the third party identifier.
/// The medium of the third-party identifier.
QString medium;
/// The third party identifier address.
/// The third-party identifier address.
QString address;
/// The timestamp, in milliseconds, when the identifier was
/// validated by the identity server.
qint64 validatedAt;
/// The timestamp, in milliseconds, when the homeserver associated the
/// third party identifier with the user.
/// third-party identifier with the user.
qint64 addedAt;
};

// Construction/destruction

/// Gets a list of a user's third party identifiers.
/// Gets a list of a user's third-party identifiers.
explicit GetAccount3PIDsJob();

/*! \brief Construct a URL without creating a full-fledged job object
Expand All @@ -62,10 +62,10 @@ class QUOTIENT_API GetAccount3PIDsJob : public BaseJob {

// Result properties

/// Gets a list of the third party identifiers that the homeserver has
/// Gets a list of the third-party identifiers that the homeserver has
/// associated with the user's account.
///
/// This is *not* the same as the list of third party identifiers bound to
/// This is *not* the same as the list of third-party identifiers bound to
/// the user's Matrix ID in identity servers.
///
/// Identifiers in this list may be used by the homeserver as, for example,
Expand All @@ -81,10 +81,10 @@ struct JsonObjectConverter<GetAccount3PIDsJob::ThirdPartyIdentifier> {
static void fillFrom(const QJsonObject& jo,
GetAccount3PIDsJob::ThirdPartyIdentifier& result)
{
fromJson(jo.value("medium"_ls), result.medium);
fromJson(jo.value("address"_ls), result.address);
fromJson(jo.value("validated_at"_ls), result.validatedAt);
fromJson(jo.value("added_at"_ls), result.addedAt);
fillFromJson(jo.value("medium"_ls), result.medium);
fillFromJson(jo.value("address"_ls), result.address);
fillFromJson(jo.value("validated_at"_ls), result.validatedAt);
fillFromJson(jo.value("added_at"_ls), result.addedAt);
}
};

Expand All @@ -105,7 +105,7 @@ class QUOTIENT_API Post3PIDsJob : public BaseJob {
public:
// Inner data structures

/// The third party credentials to associate with the account.
/// The third-party credentials to associate with the account.
struct ThreePidCredentials {
/// The client secret used in the session with the identity server.
QString clientSecret;
Expand All @@ -124,7 +124,7 @@ class QUOTIENT_API Post3PIDsJob : public BaseJob {
/*! \brief Adds contact information to the user's account.
*
* \param threePidCreds
* The third party credentials to associate with the account.
* The third-party credentials to associate with the account.
*/
explicit Post3PIDsJob(const ThreePidCredentials& threePidCreds);

Expand Down Expand Up @@ -217,9 +217,9 @@ class QUOTIENT_API Bind3PIDJob : public BaseJob {
const QString& idAccessToken, const QString& sid);
};

/*! \brief Deletes a third party identifier from the user's account
/*! \brief Deletes a third-party identifier from the user's account
*
* Removes a third party identifier from the user's account. This might not
* Removes a third-party identifier from the user's account. This might not
* cause an unbind of the identifier from the identity server.
*
* Unlike other endpoints, this endpoint does not take an `id_access_token`
Expand All @@ -228,13 +228,13 @@ class QUOTIENT_API Bind3PIDJob : public BaseJob {
*/
class QUOTIENT_API Delete3pidFromAccountJob : public BaseJob {
public:
/*! \brief Deletes a third party identifier from the user's account
/*! \brief Deletes a third-party identifier from the user's account
*
* \param medium
* The medium of the third party identifier being removed.
* The medium of the third-party identifier being removed.
*
* \param address
* The third party address being removed.
* The third-party address being removed.
*
* \param idServer
* The identity server to unbind from. If not provided, the homeserver
Expand All @@ -260,9 +260,9 @@ class QUOTIENT_API Delete3pidFromAccountJob : public BaseJob {
}
};

/*! \brief Removes a user's third party identifier from an identity server.
/*! \brief Removes a user's third-party identifier from an identity server.
*
* Removes a user's third party identifier from the provided identity server
* Removes a user's third-party identifier from the provided identity server
* without removing it from the homeserver.
*
* Unlike other endpoints, this endpoint does not take an `id_access_token`
Expand All @@ -271,13 +271,13 @@ class QUOTIENT_API Delete3pidFromAccountJob : public BaseJob {
*/
class QUOTIENT_API Unbind3pidFromAccountJob : public BaseJob {
public:
/*! \brief Removes a user's third party identifier from an identity server.
/*! \brief Removes a user's third-party identifier from an identity server.
*
* \param medium
* The medium of the third party identifier being removed.
* The medium of the third-party identifier being removed.
*
* \param address
* The third party address being removed.
* The third-party address being removed.
*
* \param idServer
* The identity server to unbind from. If not provided, the homeserver
Expand Down
Loading

0 comments on commit 896f250

Please sign in to comment.