aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-10 16:32:33 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-10 16:32:33 +0900
commit501c79f55b5f6cb5df80993330d0b1ae1764024a (patch)
tree6c45e4a331dd68105677b7c52721e21ca6a8a990 /lib/room.cpp
parent9b3e437f3268e251f1950000b210cf849d49c24e (diff)
downloadlibquotient-501c79f55b5f6cb5df80993330d0b1ae1764024a.tar.gz
libquotient-501c79f55b5f6cb5df80993330d0b1ae1764024a.zip
Room::getPreviousContent: use early return
...instead of the entire function body wrapped in an if block.
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index 84072d3e..3cbd2271 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1440,18 +1440,18 @@ void Room::getPreviousContent(int limit)
void Room::Private::getPreviousContent(int limit)
{
- if( !isJobRunning(eventsHistoryJob) )
- {
- eventsHistoryJob =
- connection->callApi<GetRoomEventsJob>(id, prevBatch, "b", "", limit);
- emit q->eventsHistoryJobChanged();
- connect( eventsHistoryJob, &BaseJob::success, q, [=] {
- prevBatch = eventsHistoryJob->end();
- addHistoricalMessageEvents(eventsHistoryJob->chunk());
- });
- connect( eventsHistoryJob, &QObject::destroyed,
- q, &Room::eventsHistoryJobChanged);
- }
+ if (isJobRunning(eventsHistoryJob))
+ return;
+
+ eventsHistoryJob =
+ connection->callApi<GetRoomEventsJob>(id, prevBatch, "b", "", limit);
+ emit q->eventsHistoryJobChanged();
+ connect( eventsHistoryJob, &BaseJob::success, q, [=] {
+ prevBatch = eventsHistoryJob->end();
+ addHistoricalMessageEvents(eventsHistoryJob->chunk());
+ });
+ connect( eventsHistoryJob, &QObject::destroyed,
+ q, &Room::eventsHistoryJobChanged);
}
void Room::inviteToRoom(const QString& memberId)