libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
connection.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2016 Kitsune Ral <Kitsune-Ral@users.sf.net>
2// SPDX-FileCopyrightText: 2017 Roman Plášil <me@rplasil.name>
3// SPDX-FileCopyrightText: 2019 Alexey Andreyev <aa13q@ya.ru>
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#pragma once
7
10#include "ssosession.h"
11#include "util.h"
12#include "keyimport.h"
13
14#include "csapi/create_room.h"
15#include "csapi/login.h"
16#include "csapi/content-repo.h"
17
18#include "events/accountdataevents.h"
19#include "jobs/jobhandle.h"
20#include "jobs/syncjob.h"
21
22#include <QtCore/QDir>
23#include <QtCore/QObject>
24#include <QtCore/QSize>
25#include <QtCore/QUrl>
26#include <QtQmlIntegration/qqmlintegration.h>
27
28#include <functional>
29
30Q_DECLARE_METATYPE(Quotient::GetLoginFlowsJob::LoginFlow)
31
32class TestCrossSigning;
33
34namespace Quotient {
35
36class Avatar;
37class Room;
38class User;
39class ConnectionData;
40class RoomEvent;
41
42class GetVersionsJob;
43class GetCapabilitiesJob;
44class RoomMessagesJob;
45class PostReceiptJob;
46class ForgetRoomJob;
47class MediaThumbnailJob;
48class JoinRoomJob;
49class DownloadFileJob;
50class SendToDeviceJob;
51class SendMessageJob;
52class LeaveRoomJob;
53struct EncryptedFileMetadata;
54
56
59
60//! Predefined login flow types
61namespace LoginFlowTypes {
62 inline constexpr auto Password = "m.login.password"_L1, SSO = "m.login.sso"_L1,
63 Token = "m.login.token"_L1;
64}
65
66class Connection;
67
68using room_factory_t =
69 std::function<Room*(Connection*, const QString&, JoinState)>;
70using user_factory_t = std::function<User*(Connection*, const QString&)>;
71
72//! \brief The default factory to create room objects
73//!
74//! Just a wrapper around operator new.
75//! \sa Connection::setRoomFactory, Connection::setRoomType
76template <typename T = Room>
77auto defaultRoomFactory(Connection* c, const QString& id, JoinState js)
78{
79 return new T(c, id, js);
80}
81
82//! \brief The default factory to create user objects
83//!
84//! Just a wrapper around operator new.
85//! \sa Connection::setUserFactory, Connection::setUserType
86template <typename T = User>
87auto defaultUserFactory(Connection* c, const QString& id)
88{
89 return new T(id, c);
90}
91
92// Room ids, rather than room pointers, are used in the direct chat
93// map types because the library keeps Invite rooms separate from
94// rooms in Join and Leave state; and direct chats in account data
95// are stored with no regard to their state.
98
99//! \internal
100class Dispatcher : public QObject
101{
103
104public:
106 {
107 static Dispatcher dispatcher;
108 return dispatcher;
109 }
110
113 const QString &verificationId);
114
115private:
116 using QObject::QObject;
117};
118
123
144
145public:
147
151 }; // FIXME: Should go inside CreateRoomJob
152
157 };
159
160 explicit Connection(QObject* parent = nullptr);
161 explicit Connection(const QUrl& server, QObject* parent = nullptr);
163
164 //! \brief Get all rooms known within this Connection
165 //!
166 //! This includes Invite, Join and Leave rooms, in no particular order.
167 //! \note Leave rooms will only show up in the list if they have been left
168 //! in the same running session. The library doesn't cache left rooms
169 //! between runs and it doesn't retrieve the full list of left rooms
170 //! from the server.
171 //! \sa rooms, room, roomsWithTag
173
174 //! \brief Get rooms that have either of the given join state(s)
175 //!
176 //! This method returns, in no particular order, rooms which join state
177 //! matches the mask passed in \p joinStates.
178 //! \note Similar to allRooms(), this won't retrieve the full list of
179 //! Leave rooms from the server.
180 //! \sa allRooms, room, roomsWithTag
183
184 //! Get the total number of rooms in the given join state(s)
186
187 //! \brief Check whether the account has data of the given type
188 //!
189 //! Direct chats map is not supported by this method _yet_.
190 bool hasAccountData(const QString& type) const;
191
192 //! \brief Get a generic account data event of the given type
193 //!
194 //! \return an account data event of the given type stored on the server,
195 //! or nullptr if there's none of that type.
196 //! \note Direct chats map cannot be retrieved using this method _yet_;
197 //! use directChats() instead.
198 const EventPtr& accountData(const QString& type) const;
199
200 //! \brief Get an account data event of the given type
201 //!
202 //! \return the account data content for the given event type stored
203 //! on the server, or a default-constructed object if there's none
204 //! of that type.
205 //! \note Direct chats map cannot be retrieved using this method _yet_;
206 //! use directChats() instead.
207 template <EventClass EventT>
208 const EventT* accountData() const
209 {
210 // 0.9: use the default argument and fold into the next overload
212 }
213
214 template <EventClass EventT>
215 const EventT* accountData(const QString& keyName) const
216 {
218 }
219
220 //! \brief Get account data as a JSON object
221 //!
222 //! This returns the content part of the account data event
223 //! of the given type. Direct chats map cannot be retrieved using
224 //! this method _yet_; use directChats() instead.
226
227 //! Set a generic account data event of the given type
229
231 const QJsonObject& content);
232
233 //! Lists the types of account data that exist for this connection;
235
236 //! \brief Get all Invited and Joined rooms grouped by tag
237 //! \return a hashmap from tag name to a vector of room pointers,
238 //! sorted by their order in the tag - details are at
239 //! https://spec.matrix.org/v1.5/client-server-api/#room-tagging
241
242 //! Get all room tags known on this connection
244
245 //! Get the list of rooms with the specified tag
247
248 //! \brief Mark the room as a direct chat with the user
249 //!
250 //! This function marks \p room as a direct chat with \p userId.
251 //! Emits the signal synchronously, without waiting to complete
252 //! synchronisation with the server.
253 //! \sa directChatsListChanged
255
256 //! \brief Unmark the room from direct chats
257 //!
258 //! This function removes the room id from direct chats either for
259 //! a specific \p user or for all users if \p userId is empty.
260 //! The room id is used to allow removal of, e.g., ids of forgotten
261 //! rooms; a Room object need not exist. Emits the signal
262 //! immediately, without waiting to complete synchronisation with
263 //! the server.
264 //! \sa directChatsListChanged
266
267 //! Check whether the room id corresponds to a direct chat
268 bool isDirectChat(const QString& roomId) const;
269
270 //! Get the whole map from users to direct chat rooms
272
273 //! \brief Retrieve the list of member IDs the room is a direct chat with
274 //!
275 //! \return The list of member IDs for which this room is marked as
276 //! a direct chat; an empty list if the room is not a direct chat
278
279 //! Check whether a particular user id is in the ignore list
281
282 //! Get the whole list of ignored users
284
285 //! \brief Add the user to the ignore list
286 //! The change signal is emitted synchronously, without waiting
287 //! to complete synchronisation with the server.
288 //!
289 //! \sa ignoredUsersListChanged
291
292 //! \brief Remove the user from the ignore list
293 //!
294 //! Similar to adding, the change signal is emitted synchronously.
295 //! \sa ignoredUsersListChanged
297
298 //! \brief Get the entire list of users known to the current user on this homeserver
299 //! \note Be mindful that this can easily count thousands or tens of thousands, and use
300 //! sparingly; when in a room context, always use Room::members() instead
302
303 //! Get the base URL of the homeserver to connect to
305 //! Get the domain name used for ids/aliases on the server
307 //! Get the list of supported login flows
309 //! Get the login flow of a given type
311 //! Check whether the current homeserver supports password auth
313 //! Check whether the current homeserver supports SSO
314 bool supportsSso() const;
315 //! Find a room by its id and a mask of applicable states
317 const QString& roomId,
319 //! Find a room by its alias and a mask of applicable states
321 const QString& roomAlias,
323 //! \brief Update the internal map of room aliases to IDs
324 //!
325 //! This is used to maintain the internal index of room aliases.
326 //! It does NOT change aliases on the server,
327 //! \sa Room::setLocalAliases
330 const QStringList& roomAliases);
333 const User* user() const;
336
337 //! \brief Get an avatar object for the given user ID and media ID
339
340 //! \brief Get an avatar object for the given user ID and media ID
342
345 bool isLoggedIn() const;
346
347 //! \brief Whether the connection is successfully syncing with the server.
348 //!
349 //! \return true, if the last sync was successful, false otherwise.
350 bool isOnline() const;
351
352 //! \brief Returns whether this event comes from a verified device
354
355 // //! Returns whether the device is verified
356 bool isVerifiedDevice(const QString& userId, const QString& deviceId) const;
357
358 //! \brief Returns whether the device is known and supports end-to-end encryption.
359 //!
360 //! This might give unexpected results for users we're not tracking,
361 //! i.e., users that we don't share an encrypted room with
363
366
367
370
374
376
380
381 static constexpr QStringView StableTag = u"stable";
382 bool isStable() const { return status == StableTag; }
383
385 {
387 return dbg.nospace() << v.id << '/' << v.status;
388 }
389 };
390
391 //! Find out if homeserver capabilites have been loaded
393
394 //! Get the list of Matrix CS API spec versions supported by the homeserver
396
397 //! \brief Get the room version recommended by the server
398 //!
399 //! Only works after server capabilities have been loaded.
400 //! \sa loadingCapabilities
402 //! \brief Get the room version considered stable by the server
403 //!
404 //! Only works after server capabilities have been loaded.
405 //! \sa loadingCapabilities
407 //! \brief Get all room versions supported by the server
408 //! Only works after server capabilities have been loaded.
409 //! \sa loadingCapabilities
411
412 //! Indicate if the user can change its password from the client.
413 //! This is often not the case when SSO is enabled.
414 //! \sa loadingCapabilities
415 bool canChangePassword() const;
416
417 //! \brief Check whether encryption is enabled on this connection
418 //! \sa enableEncryption
419 bool encryptionEnabled() const;
420
421 //! \brief Enable or disable encryption on this connection
422 //!
423 //! \note This has no effect if the library is compiled without E2EE support
424 //!
425 //! \sa encryptionEnabled
427
428 //! \brief Check whether encryption is enabled for new direct chats on this connection
429 //!
430 //! \note This has no effect if the library is compiled without E2EE support
431 //!
432 //! \sa enableDirectChatEncryption
434
435 //! \brief Enable or disable whether new direct chats are encrypted on this connection
436 //!
437 //! \note This has no effect if the library is compiled without E2EE support
438 //!
439 //! \sa directChatEncryptionEnabled
441
442 //! \brief Load room state from a previously saved file
443 //!
444 //! Call this before first sync.
445 //! \sa saveState
447
448 //! \brief Save the current state for all rooms to a file
449 //!
450 //! This method saves the current state of rooms (but not messages
451 //! in them) to a local cache file, so that it could be loaded by
452 //! loadState() on a next run of the client.
453 //! \sa loadState
454 Q_INVOKABLE void saveState() const;
455
456 //! This method saves the current state of a single room.
457 void saveRoomState(Room* r) const;
458
459 //! \brief Get the default directory path to save the room state to
460 //! \sa stateCacheDir
462
463 //! \brief Get the default directory to save the room state to
464 //!
465 //! This function returns the default directory to store the cached
466 //! room state, defined as follows:
467 //! \code
468 //! QStandardPaths::writeableLocation(QStandardPaths::CacheLocation) +
469 //! _safeUserId + "_state.json" \endcode where `_safeUserId` is userId() with
470 //! `:` (colon) replaced by
471 //! `_` (underscore), as colons are reserved characters on Windows.
472 //! \sa loadState, saveState, stateCachePath
474
475 //! \brief Whether or not the rooms state should be cached locally
476 //! \sa loadState, saveState
477 bool cacheState() const;
479
480 bool lazyLoading() const;
482
483 //! \brief Start a pre-made job object on this connection
484 //!
485 //! Use this overload in case when you don't want to, or cannot, use JobHandle. Internally,
486 //! this is also the function all other template wrappers ultimately call to do the real work.
489
490 //! \brief Start a pre-created job on this connection
491 //!
492 //! Use this overload if you have a job object pre-made with JobHandle<>::createFrom() when
493 //! you need to actually start (or rather, queue) the network request. It is strongly
494 //! recommended to use the job handle returned by run() instead of the original, as run() may
495 //! (in the future) attach continuations to the future interface of the handle.
496 //! \sa JobHandle::createFrom
497 template <std::derived_from<BaseJob> JobT>
500 {
502 return std::move(job);
503 }
504
505 //! \brief Start a job of a given type with specified arguments and policy
506 //!
507 //! This is a universal method to create and start a job of a type passed
508 //! as a template parameter. The policy allows to fine-tune the way
509 //! the job is executed - as of this writing it means a choice
510 //! between "foreground" and "background".
511 //!
512 //! \param runningPolicy controls how the job is executed
513 //! \param jobArgs arguments to the job constructor
514 //!
515 //! \sa BaseJob::isBackground. QNetworkRequest::BackgroundRequestAttribute
516 template <typename JobT, typename... JobArgTs>
518 {
520 }
521
522 //! \brief Start a job of a specified type with specified arguments
523 //!
524 //! This is an overload that runs the job with "foreground" policy.
525 template <typename JobT, typename... JobArgTs>
527 {
529 }
530
531 //! \brief Get a request URL for a job with specified type and arguments
532 //!
533 //! This calls JobT::makeRequestUrl() prepending the connection's homeserver
534 //! to the list of arguments.
535 template <typename JobT, typename... JobArgTs>
537 {
539 }
540
541 //! \brief Start a local HTTP server and generate a single sign-on URL
542 //!
543 //! This call does the preparatory steps to carry out single sign-on
544 //! sequence
545 //! \sa https://matrix.org/docs/guides/sso-for-client-developers
546 //! \return A proxy object holding two URLs: one for SSO on the chosen
547 //! homeserver and another for the local callback address. Normally
548 //! you won't need the callback URL unless you proxy the response
549 //! with a custom UI. You do not need to delete the SsoSession
550 //! object; the Connection that issued it will dispose of it once
551 //! the login sequence completes (with any outcome).
553 const QString& deviceId = {});
554
555 //! \brief Generate a new transaction id
556 //!
557 //! Transaction id's are unique within a single Connection object
559
560 //! Convert an mxc: URL into a CS API URL
562
564 const QString& maybeSuccessorId) const;
565
566 //! Set the E2EE default state for any Connection created further
568
569 //! Set the direct chat E2EE default state for any Connection created further
571
572 //! Set a room factory function
574
575 //! Set a user factory function
577
578 //! Get a room factory function
580
581 //! Get a user factory function
583
584 //! Set the room factory to default with the overriden room type
585 template <typename T>
586 static void setRoomType()
587 {
589 }
590
591 //! Set the user factory to default with the overriden user type
592 template <typename T>
593 static void setUserType()
594 {
596 }
597
598 //! \brief Determine and set the homeserver from MXID
599 //!
600 //! This attempts to resolve the homeserver by requesting
601 //! .well-known/matrix/client record from the server taken from the MXID
602 //! serverpart. If there is no record found, the serverpart itself is
603 //! attempted as the homeserver base URL; if the record is there but
604 //! is malformed (e.g., the homeserver base URL cannot be found in it)
605 //! resolveError() is emitted and further processing stops. Otherwise,
606 //! setHomeserver is called, preparing the Connection object for the login
607 //! attempt.
608 //! \param mxid user Matrix ID, such as @someone:example.org
609 //! \sa setHomeserver, homeserverChanged, loginFlowsChanged, resolveError
611
612 //! \brief Set the homeserver base URL and retrieve its login flows
613 //!
614 //! \sa LoginFlowsJob, loginFlows, loginFlowsChanged, homeserverChanged
616
617 //! \brief Get a future to a direct chat with the user
619
620 //! Create a direct chat with a single user, optional name and topic
621 //!
622 //! A room will always be created, unlike in requestDirectChat.
623 //! It is advised to use requestDirectChat as a default way of getting
624 //! one-on-one with a person, and only use createDirectChat when
625 //! a new creation is explicitly desired.
627 const QString& topic = {},
628 const QString& name = {});
629
631 const QStringList& serverNames = {});
632
634 const QStringList& serverNames = {});
635
637
638public Q_SLOTS:
639 //! \brief Log in using a username and password pair
640 //!
641 //! Before logging in, this method checks if the homeserver is valid and
642 //! supports the password login flow. If the homeserver is invalid but
643 //! a full user MXID is provided, this method calls resolveServer() using
644 //! this MXID.
645 //! \sa resolveServer, resolveError, loginError
648 const QString& deviceId = {});
649
650 //! \brief Log in using a login token
651 //!
652 //! One usual case for this method is the final stage of logging in via SSO.
653 //! Unlike loginWithPassword() and assumeIdentity(), this method cannot
654 //! resolve the server from the user name because the full user MXID is
655 //! encoded in the login token. Callers should ensure the homeserver
656 //! sanity in advance.
659 const QString& deviceId = {});
660
661 //! \brief Use an existing access token to connect to the homeserver
662 //!
663 //! Similar to loginWithPassword(), this method checks that the homeserver
664 //! URL is valid and tries to resolve it from the MXID in case it is not.
665 //! \since 0.7.2
667
668 //! \brief Request supported spec versions from the homeserver
669 //!
670 //! This call does not obtain room versions - use loadCapabilities() for that.
672
673 //! Request capabilities and room versions from the server
675
677
678 void sync(int timeout = -1);
680
681 void stopSync();
682
688 int requestedHeight,
690
691 // QIODevice* should already be open
693 const QString& overrideContentType = {});
695 const QString& overrideContentType = {});
696
697 // If localFilename is empty, a temporary file will be created
699
702 const QString& localFilename = {});
703
704 //! \brief Create a room (generic method)
705 //!
706 //! This method allows to customize room entirely to your liking,
707 //! providing all the attributes the original CS API provides.
710 const QString& presetName = {}, const QString& roomVersion = {},
711 bool isDirect = false,
714 const QJsonObject& creationContent = {});
715
716 //! \brief Create a room with additional creators
717 //!
718 //! This is a temporary (until post-0.10) overload that accepts \p additionalCreators.
719 //! After 0.10 both overloads will merge into one again.
721 const QString &name, const QString &topic,
723 const QString &roomVersion, bool isDirect,
726 const QVector<Invite3pid> &invite3pids = {},
728
729 //! \brief Get a direct chat with a single user
730 //!
731 //! This method may return synchronously or asynchoronously depending
732 //! on whether a direct chat room with the respective person exists
733 //! already.
734 //! \sa directChatAvailable
736
737 //! \brief Send /forget to the server and delete room locally
738 //!
739 //! This method is in Connection, not in Room, since it's a
740 //! room lifecycle operation, and Connection is an acting room manager.
741 //! It ensures that the local user is not a member of a room (running /leave,
742 //! if necessary) then issues a /forget request and if that one doesn't fail
743 //! deletion of the local Room object is ensured.
744 //! \param id the room id to forget
745 //! \return the ongoing /forget request to the server; note that the
746 //! success() signal of this request is connected to deleteLater()
747 //! of a respective room so by the moment this finishes, there
748 //! might be no Room object anymore.
750
751 [[deprecated("This method is experimental and may be removed any time")]] //
753
754 //! \deprecated Do not use this directly, use Room::leaveRoom() instead
756
758 const QString& deviceId);
759
761
763
765 bool enableEncryption = true);
766
767 //! \internal
771
772 //! \internal
774
779
782
784
786 //! \brief Initial server resolution has failed
787 //!
788 //! This signal is emitted when resolveServer() did not manage to resolve
789 //! the homeserver using its .well-known/client record or otherwise.
790 //! \sa resolveServer
792
796
797 void connected();
798 void loggedOut();
799
800 //! \brief Login data or state have changed
801 //!
802 //! This is a common change signal for userId, deviceId and
803 //! accessToken - these properties normally only change at
804 //! a successful login and logout and are constant at other times.
806
807 //! The online state has changed.
809
811
812 //! \brief A network request (job) started by callApi() has failed
813 //! \param request the pointer to the failed job
814 //! \sa callApi
816
817 //! \brief A network request (job) failed due to network problems
818 //!
819 //! This is _only_ emitted when the job will retry on its own;
820 //! once it gives up, requestFailed() will be emitted.
821 //!
822 //! \param message message about the network problem
823 //! \param details raw error details, if any available
824 //! \param retriesTaken how many retries have already been taken
825 //! \param nextRetryInMilliseconds when the job will retry again
826 //! (-1 if no next retry is scheduled)
829
830 void syncDone();
832
834
835 //! \group Signals emitted on room transitions
836 //!
837 //! Note: Rooms in Invite state are always stored separately from
838 //! rooms in Join/Leave state, because of special treatment of
839 //! invite_state in Matrix CS API (see The Spec on /sync for details).
840 //! Therefore, objects below are: r - room in Join/Leave state;
841 //! i - room in Invite state
842 //!
843 //! 1. none -> Invite: newRoom(r), invitedRoom(r,nullptr)
844 //! 2. none -> Join: newRoom(r), joinedRoom(r,nullptr)
845 //! 3. none -> Leave: newRoom(r), leftRoom(r,nullptr)
846 //! 4. Invite -> Join:
847 //! newRoom(r), joinedRoom(r,i), aboutToDeleteRoom(i)
848 //! 4a. Leave and Invite -> Join:
849 //! joinedRoom(r,i), aboutToDeleteRoom(i)
850 //! 5. Invite -> Leave:
851 //! newRoom(r), leftRoom(r,i), aboutToDeleteRoom(i)
852 //! 5a. Leave and Invite -> Leave:
853 //! leftRoom(r,i), aboutToDeleteRoom(i)
854 //! 6. Join -> Leave: leftRoom(r)
855 //! 7. Leave -> Invite: newRoom(i), invitedRoom(i,r)
856 //! 8. Leave -> Join: joinedRoom(r)
857 //! The following transitions are only possible via forgetRoom()
858 //! so far; if a room gets forgotten externally, sync won't tell
859 //! about it:
860 //! 9. any -> none: as any -> Leave, then aboutToDeleteRoom(r)
861
862 //! A new room object has been created
864
865 //! \brief A room invitation is seen for the first time
866 //!
867 //! If the same room is in Left state, it's passed in prev. Beware
868 //! that initial sync will trigger this signal for all rooms in
869 //! Invite state.
871
872 //! \brief A joined room is seen for the first time
873 //!
874 //! It's not the same as receiving a room in "join" section of sync
875 //! response (rooms will be there even after joining); it's also
876 //! not (exactly) the same as actual joining action of a user (all
877 //! rooms coming in initial sync will trigger this signal too). If
878 //! this room was in Invite state before, the respective object is
879 //! passed in prev (and it will be deleted shortly afterwards).
881
882 //! \brief A room has just been left
883 //!
884 //! If this room has been in Invite state (as in case of rejecting
885 //! an invitation), the respective object will be passed in prev
886 //! (and will be deleted shortly afterwards). Note that, similar
887 //! to invitedRoom and joinedRoom, this signal is triggered for all
888 //! Left rooms upon initial sync (not only those that were left
889 //! right before the sync).
891
892 //! The room object is about to be deleted
894
895 //! \brief The room has just been created by createRoom or requestDirectChat
896 //!
897 //! This signal is not emitted in usual room state transitions,
898 //! only as an outcome of room creation operations invoked by
899 //! the client.
900 //! \note requestDirectChat doesn't necessarily create a new chat;
901 //! directChatAvailable() is more appropriate if you need to obtain
902 //! a direct chat room after requestDirectChat().
904
905 //! \brief The first sync for the room has been completed
906 //!
907 //! This signal is emitted after the room has been synced the first
908 //! time. This is the right signal to connect to if you need to
909 //! access the room state (name, aliases, members); state transition
910 //! signals (newRoom, joinedRoom etc.) come earlier, when the room
911 //! has just been created.
913
914 //! Account data (except direct chats) have changed
916
917 //! \brief The direct chat room is ready for using
918 //!
919 //! This signal is emitted upon any successful outcome from
920 //! requestDirectChat.
922
923 //! \brief The list of direct chats has changed
924 //!
925 //! This signal is emitted every time when the mapping of users
926 //! to direct chat rooms is changed (because of either local updates
927 //! or a different list arrived from the server).
930
933
937
938 //! Encryption has been enabled or disabled
941
942 //! Connect to this signal to get notified when a key verification session starts,
943 //! both for incoming and outgoing sessions
945
948
949 //! The account does not yet have cross-signing keys. The client should ask the user
950 //! whether to create them now and then set them up, if desired.
952
953 //! The connection is ready to be used. Most notably, the fundamental e2ee data is loaded.
954 //! This does not mean that the server was reached, a sync was performed, or the state cache was loaded.
955 void ready();
956
957 //! \brief Emitted after the crypto machine has processed the verification events for a sync.
958 //! Usually not relevant to clients.
960
962
964
965 //! \internal
967
972
973 friend class ::TestCrossSigning;
975protected:
976 //! Access the underlying ConnectionData class
978
979 //! Get the homeserver data necessary to construct network requests
981
982 //! \brief Get a Room object for the given id in the given state
983 //!
984 //! Use this method when you need a Room object in the local list
985 //! of rooms, with the given state. Note that this does not interact
986 //! with the server; in particular, does not automatically create
987 //! rooms on the server. This call performs necessary join state
988 //! transitions; e.g., if it finds a room in Invite but
989 //! `joinState == JoinState::Join` then the Invite room object
990 //! will be deleted and a new room object with Join state created.
991 //! In contrast, switching between Join and Leave happens within
992 //! the same object.
993 //! \param id room id (not alias!)
994 //! \param joinState desired (target) join state of the room; if
995 //! omitted, any state will be found and return unchanged, or a
996 //! new Join room created.
997 //! \return a pointer to a Room object with the specified id and the
998 //! specified state; nullptr if roomId is empty or if roomFactory()
999 //! failed to create a Room object.
1001
1002 //! Process sync data from a successful sync request
1004
1005protected Q_SLOTS:
1007
1008private:
1009 class Private;
1010 ImplPtr<Private> d;
1011
1013
1016};
1017} // namespace Quotient
1018Q_DECLARE_METATYPE(Quotient::DirectChatsMap)
1019Q_DECLARE_METATYPE(Quotient::IgnoredUsersList)
Predefined login flow types.
Definition connection.h:61
constexpr auto Token
Definition connection.h:63
constexpr auto Password
Definition connection.h:62
auto defaultRoomFactory(Connection *c, const QString &id, JoinState js)
The default factory to create room objects.
Definition connection.h:77
auto defaultUserFactory(Connection *c, const QString &id)
The default factory to create user objects.
Definition connection.h:87
#define QUOTIENT_API