libQuotient
A Qt library for building matrix clients
|
Abstract class to resolve the resource and act on it. More...
#include <uriresolver.h>
Public Member Functions | |
UriResolveResult | visitResource (Connection *account, const Uri &uri) |
Resolve the resource and dispatch an action depending on its type. More... | |
Protected Member Functions | |
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... | |
Abstract class to resolve the resource and act on it.
This class encapsulates the logic of resolving a Matrix identifier or URI into a Quotient object (or objects) and calling an appropriate handler on it. It is a type-safe way of handling a URI with no prior context on its type in cases like, e.g., when a user clicks on a URI in the application.
This class provides empty "handlers" for each type of URI to facilitate gradual implementation. Derived classes are encouraged to override as many of them as possible.
Definition at line 28 of file uriresolver.h.
|
protectedpure virtual |
|
inlineprotectedvirtual |
Called by visitResource() when the passed URI has action() == "join"
and identifies a room that the user defined by the Connection argument is not a member of
Definition at line 65 of file uriresolver.h.
|
inlineprotectedvirtual |
Called by visitResource() when the passed URI has type() == NonMatrix
Should return true if the URI is considered resolved, false otherwise. A basic implementation in a graphical client can look like return QDesktopServices::openUrl(url);
but it's strongly advised to ask for a user confirmation beforehand.
Definition at line 76 of file uriresolver.h.
UriResolveResult Quotient::UriResolverBase::visitResource | ( | Connection * | account, |
const Uri & | uri | ||
) |
Resolve the resource and dispatch an action depending on its type.
This method:
uri
into an actual object (e.g., Room or User), with possible additional data such as event id, in the context of account
.
|
inlineprotectedvirtual |
Called by visitResource() when the passed URI identifies a room or an event in a room
Definition at line 59 of file uriresolver.h.
|
inlineprotectedvirtual |
Called by visitResource() when the passed URI identifies a Matrix user.
Definition at line 52 of file uriresolver.h.