aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connection.cpp9
-rw-r--r--connection.h22
2 files changed, 16 insertions, 15 deletions
diff --git a/connection.cpp b/connection.cpp
index c515e5a4..51a73e8d 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -24,6 +24,7 @@
#include "jobs/generated/login.h"
#include "jobs/generated/logout.h"
#include "jobs/generated/receipts.h"
+#include "jobs/generated/leaving.h"
#include "jobs/sendeventjob.h"
#include "jobs/joinroomjob.h"
#include "jobs/roommessagesjob.h"
@@ -437,7 +438,7 @@ User* Connection::user(const QString& userId)
{
if( d->userMap.contains(userId) )
return d->userMap.value(userId);
- auto* user = createUser(this, userId);
+ auto* user = userFactory(this, userId);
d->userMap.insert(userId, user);
return user;
}
@@ -515,7 +516,7 @@ Room* Connection::provideRoom(const QString& id, JoinState joinState)
}
else
{
- room = createRoom(this, id, joinState);
+ room = roomFactory(this, id, joinState);
if (!room)
{
qCCritical(MAIN) << "Failed to create a room" << id;
@@ -550,11 +551,11 @@ Room* Connection::provideRoom(const QString& id, JoinState joinState)
return room;
}
-Connection::room_factory_t Connection::createRoom =
+Connection::room_factory_t Connection::roomFactory =
[](Connection* c, const QString& id, JoinState joinState)
{ return new Room(c, id, joinState); };
-Connection::user_factory_t Connection::createUser =
+Connection::user_factory_t Connection::userFactory =
[](Connection* c, const QString& id) { return new User(id, c); };
QByteArray Connection::generateTxnId()
diff --git a/connection.h b/connection.h
index 79d7d658..b9aa328b 100644
--- a/connection.h
+++ b/connection.h
@@ -18,7 +18,6 @@
#pragma once
-#include "jobs/generated/leaving.h"
#include "joinstate.h"
#include <QtCore/QObject>
@@ -39,6 +38,7 @@ namespace QMatrixClient
class SyncData;
class RoomMessagesJob;
class PostReceiptJob;
+ class ForgetRoomJob;
class MediaThumbnailJob;
class JoinRoomJob;
class UploadContentJob;
@@ -145,7 +145,7 @@ namespace QMatrixClient
template <typename T = Room>
static void setRoomType()
{
- createRoom =
+ roomFactory =
[](Connection* c, const QString& id, JoinState joinState)
{ return new T(c, id, joinState); };
}
@@ -153,7 +153,7 @@ namespace QMatrixClient
template <typename T = User>
static void setUserType()
{
- createUser =
+ userFactory =
[](Connection* c, const QString& id) { return new T(id, c); };
}
@@ -186,15 +186,15 @@ namespace QMatrixClient
int requestedHeight) const;
// QIODevice* should already be open
- virtual UploadContentJob* uploadContent(QIODevice* contentSource,
+ UploadContentJob* uploadContent(QIODevice* contentSource,
const QString& filename = {},
const QString& contentType = {}) const;
- virtual UploadContentJob* uploadFile(const QString& fileName,
- const QString& contentType = {});
- virtual GetContentJob* getContent(const QString& mediaId) const;
+ UploadContentJob* uploadFile(const QString& fileName,
+ const QString& contentType = {});
+ GetContentJob* getContent(const QString& mediaId) const;
GetContentJob* getContent(const QUrl& url) const;
// If localFilename is empty, a temporary file will be created
- virtual DownloadFileJob* downloadFile(const QUrl& url,
+ DownloadFileJob* downloadFile(const QUrl& url,
const QString& localFilename = {}) const;
virtual JoinRoomJob* joinRoom(const QString& roomAlias);
@@ -310,7 +310,7 @@ namespace QMatrixClient
* the server; in particular, does not automatically create rooms
* on the server.
* @return a pointer to a Room object with the specified id; nullptr
- * if roomId is empty if createRoom() failed to create a Room object.
+ * if roomId is empty if roomFactory() failed to create a Room object.
*/
Room* provideRoom(const QString& roomId, JoinState joinState);
@@ -340,7 +340,7 @@ namespace QMatrixClient
const QString& initialDeviceName,
const QString& deviceId = {});
- static room_factory_t createRoom;
- static user_factory_t createUser;
+ static room_factory_t roomFactory;
+ static user_factory_t userFactory;
};
} // namespace QMatrixClient