libQuotient
A Qt library for building matrix clients
|
Resolve the resource and invoke an action on it, via Qt signals. More...
#include <uriresolver.h>
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... | |
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.
|
inlineexplicit |
Definition at line 147 of file uriresolver.h.
|
signal |
A join action has been requested, with optional 'via' servers.
|
signal |
An action on a non-Matrix URL has been requested.
|
inline |
Definition at line 150 of file uriresolver.h.
|
signal |
An action on a room has been requested, with optional event id.
|
signal |
An action on a user has been requested.