-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support per-room displaynames #141
Labels
enhancement
A feature or change request for the library
Comments
After the first attempt to code:
|
It's worthwhile to finally think what use-cases we have to support. I'm using display names below; per-room avatars are an even less frequent case.
Overall, the whole thing is not widespread (especially because Synapse flushes all overrides when a profile name is set) so postponing it for now. |
KitsuneRal
added a commit
that referenced
this issue
Feb 23, 2018
This commit includes (and has to be dissected along the lines, some of which close #141): - Avatar does not store Connection internally anymore; it also gained upload(), which is common code from User::setAvatar - User::Private stores two new maps (for display names and avatars respectively) and is able to retrieve and store names/avatars on a per-room basis. The "most used" trait is stored separately and room lists are not kept for it (because most people have a single name and a single avatar across all or most rooms). - Some (pretty minor) rearranging in Room: user() (instead of Private::member) and memberJoinState() (instead of Private::hasMember) were added to the external interface; user display names and avatars are retrieved in the context of a specific Room now.
KitsuneRal
added a commit
that referenced
this issue
Feb 23, 2018
This commit includes (and has to be dissected along the lines, some of which close #141): - Avatar does not store Connection internally anymore; it also gained upload(), which is common code from User::setAvatar - User::Private stores two new maps (for display names and avatars respectively) and is able to retrieve and store names/avatars on a per-room basis. The "most used" trait is stored separately and room lists are not kept for it (because most people have a single name and a single avatar across all or most rooms). - Some (pretty minor) rearranging in Room: user() (instead of Private::member) and memberJoinState() (instead of Private::hasMember) were added to the external interface; user display names and avatars are retrieved in the context of a specific Room now.
KitsuneRal
added a commit
that referenced
this issue
Feb 23, 2018
User::Private stores two new maps (for display names and avatars respectively) and is able to retrieve and store names/avatars on a per-room basis. The "most used" trait is stored separately and room lists are not kept for it (because most people have a single name and a single avatar across all or most rooms). TODO: The avatar container should be replaced with something less clumsy; the current code doesn't even compile with MSVC. A "handle" copyable structure that would hold the Avatar is one of options. Closes #141.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As per matrix-org/matrix-doc#545 discussion, the API is already in place (although Synapse discards all custom-made displaynames when a generic displayname is changed). libqmatrixclient allows to send arbitrary
m.room.member
events nowadays; but it only stores a single common displayname and will be confused by such events arriving over the wire. There's a need of aRoomMemberTraits
structure that will store this room-specific displayname (and avatarurl, which also can be overridden per-room). The considered options in how to manage these structures are below; option 3 looks most reasonable:User*
inRoom
, we store aRoomMemberTraits
instance for eachm.room.member
event coming. We'll have to make lots of such structures, and most of them will have the same traits for a particular user. And Qt's COW won't help because these events will be parsed separately. But that's really easy to implement. Updating the current user displayname/avatar logic is also fairly straightforward.User
object is created, we'll have to request its profile from the server (trying to not overload the server with such requests along the way - imagine getting profiles for 10k+ users of Matrix HQ at initial sync). Uponm.room.member
arrival, we'll have to check whether the displayname/avatarurl there coincide with the generic ones; if they don't, createRoomMemberTraits
and store them for this user and room (either inRoom
or inUser
, there's no preference).User
. Atm.room.member
arrival, simply check whether thisUser
already has an exactly the sameRoomMemberTraits
for other rooms; if yes, reuse the existing traits and add the room of this member event to the rooms list associated with thisRoomMemberTraits
; if no, add a newRoomMemberTraits
. Generic traits of aUser
will have to be separately retrieved upon explicit demand.The text was updated successfully, but these errors were encountered: