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
142
143public:
145
149 }; // FIXME: Should go inside CreateRoomJob
150
155 };
157
158 explicit Connection(QObject* parent = nullptr);
159 explicit Connection(const QUrl& server, QObject* parent = nullptr);
161
162 //! \brief Get all rooms known within this Connection
163 //!
164 //! This includes Invite, Join and Leave rooms, in no particular order.
165 //! \note Leave rooms will only show up in the list if they have been left
166 //! in the same running session. The library doesn't cache left rooms
167 //! between runs and it doesn't retrieve the full list of left rooms
168 //! from the server.
169 //! \sa rooms, room, roomsWithTag
171
172 //! \brief Get rooms that have either of the given join state(s)
173 //!
174 //! This method returns, in no particular order, rooms which join state
175 //! matches the mask passed in \p joinStates.
176 //! \note Similar to allRooms(), this won't retrieve the full list of
177 //! Leave rooms from the server.
178 //! \sa allRooms, room, roomsWithTag
181
182 //! Get the total number of rooms in the given join state(s)
184
185 //! \brief Check whether the account has data of the given type
186 //!
187 //! Direct chats map is not supported by this method _yet_.
188 bool hasAccountData(const QString& type) const;
189
190 //! \brief Get a generic account data event of the given type
191 //!
192 //! \return an account data event of the given type stored on the server,
193 //! or nullptr if there's none of that type.
194 //! \note Direct chats map cannot be retrieved using this method _yet_;
195 //! use directChats() instead.
196 const EventPtr& accountData(const QString& type) const;
197
198 //! \brief Get an account data event of the given type
199 //!
200 //! \return the account data content for the given event type stored
201 //! on the server, or a default-constructed object if there's none
202 //! of that type.
203 //! \note Direct chats map cannot be retrieved using this method _yet_;
204 //! use directChats() instead.
205 template <EventClass EventT>
206 const EventT* accountData() const
207 {
208 // 0.9: use the default argument and fold into the next overload
210 }
211
212 template <EventClass EventT>
213 const EventT* accountData(const QString& keyName) const
214 {
216 }
217
218 //! \brief Get account data as a JSON object
219 //!
220 //! This returns the content part of the account data event
221 //! of the given type. Direct chats map cannot be retrieved using
222 //! this method _yet_; use directChats() instead.
224
225 //! Set a generic account data event of the given type
227
229 const QJsonObject& content);
230
231 //! Lists the types of account data that exist for this connection;
233
234 //! \brief Get all Invited and Joined rooms grouped by tag
235 //! \return a hashmap from tag name to a vector of room pointers,
236 //! sorted by their order in the tag - details are at
237 //! https://spec.matrix.org/v1.5/client-server-api/#room-tagging
239
240 //! Get all room tags known on this connection
242
243 //! Get the list of rooms with the specified tag
245
246 //! \brief Mark the room as a direct chat with the user
247 //!
248 //! This function marks \p room as a direct chat with \p userId.
249 //! Emits the signal synchronously, without waiting to complete
250 //! synchronisation with the server.
251 //! \sa directChatsListChanged
253
254 //! \brief Unmark the room from direct chats
255 //!
256 //! This function removes the room id from direct chats either for
257 //! a specific \p user or for all users if \p userId is empty.
258 //! The room id is used to allow removal of, e.g., ids of forgotten
259 //! rooms; a Room object need not exist. Emits the signal
260 //! immediately, without waiting to complete synchronisation with
261 //! the server.
262 //! \sa directChatsListChanged
264
265 //! Check whether the room id corresponds to a direct chat
266 bool isDirectChat(const QString& roomId) const;
267
268 //! Get the whole map from users to direct chat rooms
270
271 //! \brief Retrieve the list of member IDs the room is a direct chat with
272 //!
273 //! \return The list of member IDs for which this room is marked as
274 //! a direct chat; an empty list if the room is not a direct chat
276
277 //! Check whether a particular user id is in the ignore list
279
280 //! Get the whole list of ignored users
282
283 //! \brief Add the user to the ignore list
284 //! The change signal is emitted synchronously, without waiting
285 //! to complete synchronisation with the server.
286 //!
287 //! \sa ignoredUsersListChanged
289
290 //! \brief Remove the user from the ignore list
291 //!
292 //! Similar to adding, the change signal is emitted synchronously.
293 //! \sa ignoredUsersListChanged
295
296 //! \brief Get the entire list of users known to the current user on this homeserver
297 //! \note Be mindful that this can easily count thousands or tens of thousands, and use
298 //! sparingly; when in a room context, always use Room::members() instead
300
301 //! Get the base URL of the homeserver to connect to
303 //! Get the domain name used for ids/aliases on the server
305 //! Get the list of supported login flows
307 //! Get the login flow of a given type
309 //! Check whether the current homeserver supports password auth
311 //! Check whether the current homeserver supports SSO
312 bool supportsSso() const;
313 //! Find a room by its id and a mask of applicable states
315 const QString& roomId,
317 //! Find a room by its alias and a mask of applicable states
319 const QString& roomAlias,
321 //! \brief Update the internal map of room aliases to IDs
322 //!
323 //! This is used to maintain the internal index of room aliases.
324 //! It does NOT change aliases on the server,
325 //! \sa Room::setLocalAliases
328 const QStringList& roomAliases);
331 const User* user() const;
334
335 //! \brief Get an avatar object for the given user ID and media ID
337
338 //! \brief Get an avatar object for the given user ID and media ID
340
343 bool isLoggedIn() const;
344
345 //! \brief Whether the connection is successfully syncing with the server.
346 //!
347 //! \return true, if the last sync was successful, false otherwise.
348 bool isOnline() const;
349
350 //! \brief Returns whether this event comes from a verified device
352
353 // //! Returns whether the device is verified
354 bool isVerifiedDevice(const QString& userId, const QString& deviceId) const;
355
356 //! \brief Returns whether the device is known and supports end-to-end encryption.
357 //!
358 //! This might give unexpected results for users we're not tracking,
359 //! i.e., users that we don't share an encrypted room with
361
364
365
368
372
374
378
379 static constexpr QStringView StableTag = u"stable";
380 bool isStable() const { return status == StableTag; }
381
383 {
385 return dbg.nospace() << v.id << '/' << v.status;
386 }
387 };
388
389 //! Find out if homeserver capabilites have been loaded
391
392 //! Get the list of Matrix CS API spec versions supported by the homeserver
394
395 //! \brief Get the room version recommended by the server
396 //!
397 //! Only works after server capabilities have been loaded.
398 //! \sa loadingCapabilities
400 //! \brief Get the room version considered stable by the server
401 //!
402 //! Only works after server capabilities have been loaded.
403 //! \sa loadingCapabilities
405 //! \brief Get all room versions supported by the server
406 //! Only works after server capabilities have been loaded.
407 //! \sa loadingCapabilities
409
410 //! Indicate if the user can change its password from the client.
411 //! This is often not the case when SSO is enabled.
412 //! \sa loadingCapabilities
413 bool canChangePassword() const;
414
415 //! \brief Check whether encryption is enabled on this connection
416 //! \sa enableEncryption
417 bool encryptionEnabled() const;
418
419 //! \brief Enable or disable encryption on this connection
420 //!
421 //! \note This has no effect if the library is compiled without E2EE support
422 //!
423 //! \sa encryptionEnabled
425
426 //! \brief Check whether encryption is enabled for new direct chats on this connection
427 //!
428 //! \note This has no effect if the library is compiled without E2EE support
429 //!
430 //! \sa enableDirectChatEncryption
432
433 //! \brief Enable or disable whether new direct chats are encrypted on this connection
434 //!
435 //! \note This has no effect if the library is compiled without E2EE support
436 //!
437 //! \sa directChatEncryptionEnabled
439
440 //! \brief Load room state from a previously saved file
441 //!
442 //! Call this before first sync.
443 //! \sa saveState
445
446 //! \brief Save the current state for all rooms to a file
447 //!
448 //! This method saves the current state of rooms (but not messages
449 //! in them) to a local cache file, so that it could be loaded by
450 //! loadState() on a next run of the client.
451 //! \sa loadState
452 Q_INVOKABLE void saveState() const;
453
454 //! This method saves the current state of a single room.
455 void saveRoomState(Room* r) const;
456
457 //! \brief Get the default directory path to save the room state to
458 //! \sa stateCacheDir
460
461 //! \brief Get the default directory to save the room state to
462 //!
463 //! This function returns the default directory to store the cached
464 //! room state, defined as follows:
465 //! \code
466 //! QStandardPaths::writeableLocation(QStandardPaths::CacheLocation) +
467 //! _safeUserId + "_state.json" \endcode where `_safeUserId` is userId() with
468 //! `:` (colon) replaced by
469 //! `_` (underscore), as colons are reserved characters on Windows.
470 //! \sa loadState, saveState, stateCachePath
472
473 //! \brief Whether or not the rooms state should be cached locally
474 //! \sa loadState, saveState
475 bool cacheState() const;
477
478 bool lazyLoading() const;
480
481 //! \brief Start a pre-made job object on this connection
482 //!
483 //! Use this overload in case when you don't want to, or cannot, use JobHandle. Internally,
484 //! this is also the function all other template wrappers ultimately call to do the real work.
487
488 //! \brief Start a pre-created job on this connection
489 //!
490 //! Use this overload if you have a job object pre-made with JobHandle<>::createFrom() when
491 //! you need to actually start (or rather, queue) the network request. It is strongly
492 //! recommended to use the job handle returned by run() instead of the original, as run() may
493 //! (in the future) attach continuations to the future interface of the handle.
494 //! \sa JobHandle::createFrom
495 template <std::derived_from<BaseJob> JobT>
498 {
500 return std::move(job);
501 }
502
503 //! \brief Start a job of a given type with specified arguments and policy
504 //!
505 //! This is a universal method to create and start a job of a type passed
506 //! as a template parameter. The policy allows to fine-tune the way
507 //! the job is executed - as of this writing it means a choice
508 //! between "foreground" and "background".
509 //!
510 //! \param runningPolicy controls how the job is executed
511 //! \param jobArgs arguments to the job constructor
512 //!
513 //! \sa BaseJob::isBackground. QNetworkRequest::BackgroundRequestAttribute
514 template <typename JobT, typename... JobArgTs>
516 {
518 }
519
520 //! \brief Start a job of a specified type with specified arguments
521 //!
522 //! This is an overload that runs the job with "foreground" policy.
523 template <typename JobT, typename... JobArgTs>
525 {
527 }
528
529 //! \brief Get a request URL for a job with specified type and arguments
530 //!
531 //! This calls JobT::makeRequestUrl() prepending the connection's homeserver
532 //! to the list of arguments.
533 template <typename JobT, typename... JobArgTs>
535 {
537 }
538
539 //! \brief Start a local HTTP server and generate a single sign-on URL
540 //!
541 //! This call does the preparatory steps to carry out single sign-on
542 //! sequence
543 //! \sa https://matrix.org/docs/guides/sso-for-client-developers
544 //! \return A proxy object holding two URLs: one for SSO on the chosen
545 //! homeserver and another for the local callback address. Normally
546 //! you won't need the callback URL unless you proxy the response
547 //! with a custom UI. You do not need to delete the SsoSession
548 //! object; the Connection that issued it will dispose of it once
549 //! the login sequence completes (with any outcome).
551 const QString& deviceId = {});
552
553 //! \brief Generate a new transaction id
554 //!
555 //! Transaction id's are unique within a single Connection object
557
558 //! Convert an mxc: URL into a CS API URL
560
562 const QString& maybeSuccessorId) const;
563
564 //! Set the E2EE default state for any Connection created further
566
567 //! Set the direct chat E2EE default state for any Connection created further
569
570 //! Set a room factory function
572
573 //! Set a user factory function
575
576 //! Get a room factory function
578
579 //! Get a user factory function
581
582 //! Set the room factory to default with the overriden room type
583 template <typename T>
584 static void setRoomType()
585 {
587 }
588
589 //! Set the user factory to default with the overriden user type
590 template <typename T>
591 static void setUserType()
592 {
594 }
595
596 //! \brief Determine and set the homeserver from MXID
597 //!
598 //! This attempts to resolve the homeserver by requesting
599 //! .well-known/matrix/client record from the server taken from the MXID
600 //! serverpart. If there is no record found, the serverpart itself is
601 //! attempted as the homeserver base URL; if the record is there but
602 //! is malformed (e.g., the homeserver base URL cannot be found in it)
603 //! resolveError() is emitted and further processing stops. Otherwise,
604 //! setHomeserver is called, preparing the Connection object for the login
605 //! attempt.
606 //! \param mxid user Matrix ID, such as @someone:example.org
607 //! \sa setHomeserver, homeserverChanged, loginFlowsChanged, resolveError
609
610 //! \brief Set the homeserver base URL and retrieve its login flows
611 //!
612 //! \sa LoginFlowsJob, loginFlows, loginFlowsChanged, homeserverChanged
614
615 //! \brief Get a future to a direct chat with the user
617
618 //! Create a direct chat with a single user, optional name and topic
619 //!
620 //! A room will always be created, unlike in requestDirectChat.
621 //! It is advised to use requestDirectChat as a default way of getting
622 //! one-on-one with a person, and only use createDirectChat when
623 //! a new creation is explicitly desired.
625 const QString& topic = {},
626 const QString& name = {});
627
629 const QStringList& serverNames = {});
630
632 const QStringList& serverNames = {});
633
635
636public Q_SLOTS:
637 //! \brief Log in using a username and password pair
638 //!
639 //! Before logging in, this method checks if the homeserver is valid and
640 //! supports the password login flow. If the homeserver is invalid but
641 //! a full user MXID is provided, this method calls resolveServer() using
642 //! this MXID.
643 //! \sa resolveServer, resolveError, loginError
646 const QString& deviceId = {});
647
648 //! \brief Log in using a login token
649 //!
650 //! One usual case for this method is the final stage of logging in via SSO.
651 //! Unlike loginWithPassword() and assumeIdentity(), this method cannot
652 //! resolve the server from the user name because the full user MXID is
653 //! encoded in the login token. Callers should ensure the homeserver
654 //! sanity in advance.
657 const QString& deviceId = {});
658
659 //! \brief Use an existing access token to connect to the homeserver
660 //!
661 //! Similar to loginWithPassword(), this method checks that the homeserver
662 //! URL is valid and tries to resolve it from the MXID in case it is not.
663 //! \since 0.7.2
665
666 //! \brief Request supported spec versions from the homeserver
667 //!
668 //! This call does not obtain room versions - use loadCapabilities() for that.
670
671 //! Request capabilities and room versions from the server
673
675
676 void sync(int timeout = -1);
678
679 void stopSync();
680
686 int requestedHeight,
688
689 // QIODevice* should already be open
691 const QString& overrideContentType = {});
693 const QString& overrideContentType = {});
694
695 // If localFilename is empty, a temporary file will be created
697
700 const QString& localFilename = {});
701
702 //! \brief Create a room (generic method)
703 //!
704 //! This method allows to customize room entirely to your liking,
705 //! providing all the attributes the original CS API provides.
708 const QString& presetName = {}, const QString& roomVersion = {},
709 bool isDirect = false,
712 const QJsonObject& creationContent = {});
713
714 //! \brief Create a room with additional creators
715 //!
716 //! This is a temporary (until post-0.10) overload that accepts \p additionalCreators.
717 //! After 0.10 both overloads will merge into one again.
719 const QString &name, const QString &topic,
721 const QString &roomVersion, bool isDirect,
724 const QVector<Invite3pid> &invite3pids = {},
726
727 //! \brief Get a direct chat with a single user
728 //!
729 //! This method may return synchronously or asynchoronously depending
730 //! on whether a direct chat room with the respective person exists
731 //! already.
732 //! \sa directChatAvailable
734
735 //! \brief Send /forget to the server and delete room locally
736 //!
737 //! This method is in Connection, not in Room, since it's a
738 //! room lifecycle operation, and Connection is an acting room manager.
739 //! It ensures that the local user is not a member of a room (running /leave,
740 //! if necessary) then issues a /forget request and if that one doesn't fail
741 //! deletion of the local Room object is ensured.
742 //! \param id the room id to forget
743 //! \return the ongoing /forget request to the server; note that the
744 //! success() signal of this request is connected to deleteLater()
745 //! of a respective room so by the moment this finishes, there
746 //! might be no Room object anymore.
748
749 [[deprecated("This method is experimental and may be removed any time")]] //
751
752 //! \deprecated Do not use this directly, use Room::leaveRoom() instead
754
756 const QString& deviceId);
757
759
761
763 bool enableEncryption = true);
764
765 //! \internal
769
770 //! \internal
772
776
779
781 //! \brief Initial server resolution has failed
782 //!
783 //! This signal is emitted when resolveServer() did not manage to resolve
784 //! the homeserver using its .well-known/client record or otherwise.
785 //! \sa resolveServer
787
791
792 void connected();
793 void loggedOut();
794
795 //! \brief Login data or state have changed
796 //!
797 //! This is a common change signal for userId, deviceId and
798 //! accessToken - these properties normally only change at
799 //! a successful login and logout and are constant at other times.
801
802 //! The online state has changed.
804
806
807 //! \brief A network request (job) started by callApi() has failed
808 //! \param request the pointer to the failed job
809 //! \sa callApi
811
812 //! \brief A network request (job) failed due to network problems
813 //!
814 //! This is _only_ emitted when the job will retry on its own;
815 //! once it gives up, requestFailed() will be emitted.
816 //!
817 //! \param message message about the network problem
818 //! \param details raw error details, if any available
819 //! \param retriesTaken how many retries have already been taken
820 //! \param nextRetryInMilliseconds when the job will retry again
821 //! (-1 if no next retry is scheduled)
824
825 void syncDone();
827
829
830 //! \group Signals emitted on room transitions
831 //!
832 //! Note: Rooms in Invite state are always stored separately from
833 //! rooms in Join/Leave state, because of special treatment of
834 //! invite_state in Matrix CS API (see The Spec on /sync for details).
835 //! Therefore, objects below are: r - room in Join/Leave state;
836 //! i - room in Invite state
837 //!
838 //! 1. none -> Invite: newRoom(r), invitedRoom(r,nullptr)
839 //! 2. none -> Join: newRoom(r), joinedRoom(r,nullptr)
840 //! 3. none -> Leave: newRoom(r), leftRoom(r,nullptr)
841 //! 4. Invite -> Join:
842 //! newRoom(r), joinedRoom(r,i), aboutToDeleteRoom(i)
843 //! 4a. Leave and Invite -> Join:
844 //! joinedRoom(r,i), aboutToDeleteRoom(i)
845 //! 5. Invite -> Leave:
846 //! newRoom(r), leftRoom(r,i), aboutToDeleteRoom(i)
847 //! 5a. Leave and Invite -> Leave:
848 //! leftRoom(r,i), aboutToDeleteRoom(i)
849 //! 6. Join -> Leave: leftRoom(r)
850 //! 7. Leave -> Invite: newRoom(i), invitedRoom(i,r)
851 //! 8. Leave -> Join: joinedRoom(r)
852 //! The following transitions are only possible via forgetRoom()
853 //! so far; if a room gets forgotten externally, sync won't tell
854 //! about it:
855 //! 9. any -> none: as any -> Leave, then aboutToDeleteRoom(r)
856
857 //! A new room object has been created
859
860 //! \brief A room invitation is seen for the first time
861 //!
862 //! If the same room is in Left state, it's passed in prev. Beware
863 //! that initial sync will trigger this signal for all rooms in
864 //! Invite state.
866
867 //! \brief A joined room is seen for the first time
868 //!
869 //! It's not the same as receiving a room in "join" section of sync
870 //! response (rooms will be there even after joining); it's also
871 //! not (exactly) the same as actual joining action of a user (all
872 //! rooms coming in initial sync will trigger this signal too). If
873 //! this room was in Invite state before, the respective object is
874 //! passed in prev (and it will be deleted shortly afterwards).
876
877 //! \brief A room has just been left
878 //!
879 //! If this room has been in Invite state (as in case of rejecting
880 //! an invitation), the respective object will be passed in prev
881 //! (and will be deleted shortly afterwards). Note that, similar
882 //! to invitedRoom and joinedRoom, this signal is triggered for all
883 //! Left rooms upon initial sync (not only those that were left
884 //! right before the sync).
886
887 //! The room object is about to be deleted
889
890 //! \brief The room has just been created by createRoom or requestDirectChat
891 //!
892 //! This signal is not emitted in usual room state transitions,
893 //! only as an outcome of room creation operations invoked by
894 //! the client.
895 //! \note requestDirectChat doesn't necessarily create a new chat;
896 //! directChatAvailable() is more appropriate if you need to obtain
897 //! a direct chat room after requestDirectChat().
899
900 //! \brief The first sync for the room has been completed
901 //!
902 //! This signal is emitted after the room has been synced the first
903 //! time. This is the right signal to connect to if you need to
904 //! access the room state (name, aliases, members); state transition
905 //! signals (newRoom, joinedRoom etc.) come earlier, when the room
906 //! has just been created.
908
909 //! Account data (except direct chats) have changed
911
912 //! \brief The direct chat room is ready for using
913 //!
914 //! This signal is emitted upon any successful outcome from
915 //! requestDirectChat.
917
918 //! \brief The list of direct chats has changed
919 //!
920 //! This signal is emitted every time when the mapping of users
921 //! to direct chat rooms is changed (because of either local updates
922 //! or a different list arrived from the server).
925
928
932
933 //! Encryption has been enabled or disabled
936
937 //! Connect to this signal to get notified when a key verification session starts,
938 //! both for incoming and outgoing sessions
940
943
944 //! The account does not yet have cross-signing keys. The client should ask the user
945 //! whether to create them now and then set them up, if desired.
947
948 //! The connection is ready to be used. Most notably, the fundamental e2ee data is loaded.
949 //! This does not mean that the server was reached, a sync was performed, or the state cache was loaded.
950 void ready();
951
952 //! \brief Emitted after the crypto machine has processed the verification events for a sync.
953 //! Usually not relevant to clients.
955
957
959
960 //! \internal
962
963 friend class ::TestCrossSigning;
965protected:
966 //! Access the underlying ConnectionData class
968
969 //! Get the homeserver data necessary to construct network requests
971
972 //! \brief Get a Room object for the given id in the given state
973 //!
974 //! Use this method when you need a Room object in the local list
975 //! of rooms, with the given state. Note that this does not interact
976 //! with the server; in particular, does not automatically create
977 //! rooms on the server. This call performs necessary join state
978 //! transitions; e.g., if it finds a room in Invite but
979 //! `joinState == JoinState::Join` then the Invite room object
980 //! will be deleted and a new room object with Join state created.
981 //! In contrast, switching between Join and Leave happens within
982 //! the same object.
983 //! \param id room id (not alias!)
984 //! \param joinState desired (target) join state of the room; if
985 //! omitted, any state will be found and return unchanged, or a
986 //! new Join room created.
987 //! \return a pointer to a Room object with the specified id and the
988 //! specified state; nullptr if roomId is empty or if roomFactory()
989 //! failed to create a Room object.
991
992 //! Process sync data from a successful sync request
993 void processSyncData(SyncData&& data, bool fromCache = false);
994
995protected Q_SLOTS:
997
998private:
999 class Private;
1000 ImplPtr<Private> d;
1001
1003
1006};
1007} // namespace Quotient
1008Q_DECLARE_METATYPE(Quotient::DirectChatsMap)
1009Q_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