aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2016-07-29 20:10:15 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2016-07-29 20:10:15 +0900
commita5b4f5f989072b075bfb907e5f8f1497b0ab88cc (patch)
tree67f8975af212dcc9adf44f5027abb3357ae01d84
parent37bd50b22d65dfd6ae86322fc0bb5cd9825b6472 (diff)
downloadlibquotient-a5b4f5f989072b075bfb907e5f8f1497b0ab88cc.tar.gz
libquotient-a5b4f5f989072b075bfb907e5f8f1497b0ab88cc.zip
Added roomMembername() overload for userId, in addition to User*
-rw-r--r--room.cpp7
-rw-r--r--room.h9
2 files changed, 13 insertions, 3 deletions
diff --git a/room.cpp b/room.cpp
index 772d9f58..dab30749 100644
--- a/room.cpp
+++ b/room.cpp
@@ -324,6 +324,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 +403,7 @@ void Room::Private::getPreviousContent()
}
}
-Connection* Room::connection()
+Connection* Room::connection() const
{
return d->connection;
}
diff --git a/room.h b/room.h
index 831b5382..0f7967fb 100644
--- a/room.h
+++ b/room.h
@@ -55,9 +55,14 @@ namespace QMatrixClient
/**
* @brief Produces a disambiguated name for a given user in
- * the context of the room.
+ * the context of the room
*/
Q_INVOKABLE QString roomMembername(User* u) const;
+ /**
+ * @brief Produces a disambiguated name for a user with this id in
+ * the context of the room
+ */
+ Q_INVOKABLE QString roomMembername(QString userId) const;
Q_INVOKABLE void addMessage( Event* event );
Q_INVOKABLE void addInitialState( State* state );
@@ -95,7 +100,7 @@ namespace QMatrixClient
void notificationCountChanged(Room* room);
protected:
- Connection* connection();
+ Connection* connection() const;
virtual void processMessageEvent(Event* event);
virtual void processStateEvent(Event* event);
virtual void processEphemeralEvent(Event* event);