aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-25 17:20:27 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-25 17:20:27 +0900
commit7ef5d0b10ae214f7c58aa77fb84547be1388f2d6 (patch)
tree1b488fed4106dde1f0248da402fdd40bf89de9c9 /room.cpp
parenta4a1129385731c3999a6d5986a24fc069938245c (diff)
downloadlibquotient-7ef5d0b10ae214f7c58aa77fb84547be1388f2d6.tar.gz
libquotient-7ef5d0b10ae214f7c58aa77fb84547be1388f2d6.zip
Now really switching to the new toolchain: C++14, GCC/Clang 5, Qt 5.6
Also a bit of code tightening with some C++14 (but not only) things.
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/room.cpp b/room.cpp
index d39e6d32..45521a73 100644
--- a/room.cpp
+++ b/room.cpp
@@ -457,7 +457,7 @@ void Room::Private::removeMemberFromMap(const QString& username, User* u)
emit q->memberRenamed(formerNamesakes[0]);
}
-inline QByteArray makeErrorStr(const Event& e, QByteArray msg)
+inline auto makeErrorStr(const Event& e, QByteArray msg)
{
return msg.append("; event dump follows:\n").append(e.originalJson());
}
@@ -499,7 +499,7 @@ void Room::Private::addMember(User *u)
{
insertMemberIntoMap(u);
connect(u, &User::nameChanged, q,
- [=] (User* u, const QString& newName) { renameMember(u, newName); });
+ bind(&Private::renameMember, this, _1, _2));
emit q->userAdded(u);
}
}
@@ -660,7 +660,7 @@ void Room::Private::getPreviousContent(int limit)
{
roomMessagesJob =
connection->callApi<RoomMessagesJob>(id, prevBatch, limit);
- connect( roomMessagesJob, &RoomMessagesJob::result, [=]() {
+ connect( roomMessagesJob, &RoomMessagesJob::result, [=] {
if( !roomMessagesJob->error() )
{
addHistoricalMessageEvents(roomMessagesJob->releaseEvents());
@@ -780,8 +780,7 @@ void Room::Private::processRedaction(RoomEventPtr redactionEvent)
}
auto keepContentKeys =
find_if(keepContentKeysMap.begin(), keepContentKeysMap.end(),
- [&](const std::pair<EventType,QStringList>& t)
- { return ti->type() == t.first; } );
+ [&ti](const auto& t) { return ti->type() == t.first; } );
if (keepContentKeys == keepContentKeysMap.end())
{
originalJson.remove("content");
@@ -1226,9 +1225,9 @@ bool MemberSorter::operator()(User *u1, User *u2) const
{
auto n1 = room->roomMembername(u1);
auto n2 = room->roomMembername(u2);
- if (n1[0] == '@')
+ if (n1.startsWith('@'))
n1.remove(0, 1);
- if (n2[0] == '@')
+ if (n2.startsWith('@'))
n2.remove(0, 1);
return n1.localeAwareCompare(n2) < 0;
}