libQuotient
A Qt library for building matrix clients
Quotient::UriDispatcher Class Reference

Resolve the resource and invoke an action on it, via Qt signals. More...

#include <uriresolver.h>

Inheritance diagram for Quotient::UriDispatcher:
Collaboration diagram for Quotient::UriDispatcher:

Signals

void userAction (Quotient::User *user, QString action)
 An action on a user has been requested. More...
 
void roomAction (Quotient::Room *room, QString eventId)
 An action on a room has been requested, with optional event id. More...
 
void joinAction (Quotient::Connection *account, QString roomAliasOrId, QStringList viaServers)
 A join action has been requested, with optional 'via' servers. More...
 
void nonMatrixAction (QUrl url)
 An action on a non-Matrix URL has been requested. More...
 

Public Member Functions

 UriDispatcher (QObject *parent=nullptr)
 
Q_INVOKABLE UriResolveResult resolveResource (Connection *account, const Uri &uri)
 
- Public Member Functions inherited from Quotient::UriResolverBase
UriResolveResult visitResource (Connection *account, const Uri &uri)
 Resolve the resource and dispatch an action depending on its type. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Quotient::UriResolverBase
virtual ~UriResolverBase ()=0
 
virtual UriResolveResult visitUser (User *user[[maybe_unused]], const QString &action[[maybe_unused]])
 Called by visitResource() when the passed URI identifies a Matrix user. More...
 
virtual void visitRoom (Room *room[[maybe_unused]], const QString &eventId[[maybe_unused]])
 
virtual void joinRoom (Connection *account[[maybe_unused]], const QString &roomAliasOrId[[maybe_unused]], const QStringList &viaServers[[maybe_unused]]={})
 
virtual bool visitNonMatrix (const QUrl &url[[maybe_unused]])
 Called by visitResource() when the passed URI has type() == NonMatrix More...
 

Detailed Description

Resolve the resource and invoke an action on it, via Qt signals.

This is an implementation of UriResolverBase that is based on QObject and uses Qt signals instead of virtual functions to provide an open-ended interface for visitors.

This class is aimed primarily at clients where invoking the resolving/action and handling the action are happening in decoupled parts of the code; it's also useful to operate on Matrix identifiers and URIs from QML/JS code that cannot call resolveResource() due to QML/C++ interface limitations.

This class does not restrain the client code to a certain type of connections: both direct and queued (or a mix) will work fine. One limitation caused by that is there's no way to indicate if a non-Matrix URI has been successfully resolved - a signal always returns void.

Note that in case of using (non-blocking) queued connections the code that calls resolveResource() should not expect the action to be performed synchronously - the returned value is the result of resolving the URI, not acting on it.

Definition at line 144 of file uriresolver.h.

Constructor & Destructor Documentation

◆ UriDispatcher()

Quotient::UriDispatcher::UriDispatcher ( QObject *  parent = nullptr)
inlineexplicit

Definition at line 147 of file uriresolver.h.

Member Function Documentation

◆ joinAction

void Quotient::UriDispatcher::joinAction ( Quotient::Connection account,
QString  roomAliasOrId,
QStringList  viaServers 
)
signal

A join action has been requested, with optional 'via' servers.

◆ nonMatrixAction

void Quotient::UriDispatcher::nonMatrixAction ( QUrl  url)
signal

An action on a non-Matrix URL has been requested.

◆ resolveResource()

Q_INVOKABLE UriResolveResult Quotient::UriDispatcher::resolveResource ( Connection account,
const Uri uri 
)
inline

Definition at line 150 of file uriresolver.h.

◆ roomAction

void Quotient::UriDispatcher::roomAction ( Quotient::Room room,
QString  eventId 
)
signal

An action on a room has been requested, with optional event id.

◆ userAction

void Quotient::UriDispatcher::userAction ( Quotient::User user,
QString  action 
)
signal

An action on a user has been requested.


The documentation for this class was generated from the following file: