aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/room.cpp b/room.cpp
index 81b64c54..1513cbeb 100644
--- a/room.cpp
+++ b/room.cpp
@@ -41,7 +41,7 @@
using namespace QMatrixClient;
-class Room::Private: public QObject
+class Room::Private
{
public:
/** Map of user names to users. User names potentially duplicate, hence a multi-hashmap. */
@@ -52,9 +52,10 @@ class Room::Private: public QObject
Room* q;
//static LogMessage* parseMessage(const QJsonObject& message);
- void gotMessages(KJob* job);
- // This updates the room displayname field (which is the way a room should be shown in the room list)
- // It should be called whenever the list of members or the room name (m.room.name) or canonical alias change.
+
+ // This updates the room displayname field (which is the way a room
+ // should be shown in the room list) It should be called whenever the
+ // list of members or the room name (m.room.name) or canonical alias change.
void updateDisplayname();
Connection* connection;
@@ -75,9 +76,9 @@ class Room::Private: public QObject
QString prevBatch;
RoomMessagesJob* roomMessagesJob;
- // Convenience methods to work with the membersMap and usersLeft. addMember()
- // and removeMember() emit respective Room:: signals after a succesful
- // operation.
+ // Convenience methods to work with the membersMap and usersLeft.
+ // addMember() and removeMember() emit respective Room:: signals
+ // after a succesful operation.
//void inviteUser(User* u); // We might get it at some point in time.
void addMember(User* u);
bool hasMember(User* u) const;
@@ -110,7 +111,7 @@ Room::Room(Connection* connection, QString id)
Room::~Room()
{
- qDebug() << "deconstructing room" << this;
+ qDebug() << "deconstructing room" << id();
delete d;
}
@@ -324,6 +325,11 @@ QString Room::roomMembername(User *u) const
return username % " <" % u->id() % ">";
}
+QString Room::roomMembername(QString userId) const
+{
+ return roomMembername(connection()->user(userId));
+}
+
void Room::addMessage(Event* event)
{
processMessageEvent(event);
@@ -398,7 +404,7 @@ void Room::Private::getPreviousContent()
}
}
-Connection* Room::connection()
+Connection* Room::connection() const
{
return d->connection;
}
@@ -497,7 +503,7 @@ QString Room::Private::roomNameFromMemberNames(const QList<User *> &userlist) co
// the current one to render the name of the room.
// std::array is the leanest C++ container
- std::array<User*, 2> first_two { nullptr, nullptr };
+ std::array<User*, 2> first_two = { {nullptr, nullptr} };
std::partial_sort_copy(
userlist.begin(), userlist.end(),
first_two.begin(), first_two.end(),