Commit 771a49c7d2

771a49c7d243009f4978677b81f75d2a6ff4dfdb

parent: 81a9baaf39

Unsigned

Valentin Brandl <vbrandl@riseup.net> · 2020-05-09 10:24 UTC
committer: <dkasak@termina.org.uk>

Implement function to get the user display name

Layout: unified · split

src/room_buffer.rs +13
@@ -187,6 +187,19 @@ impl RoomBuffer {
187187 self.weechat_buffer().set_name(&name)
188188 }
189189
190 /// Calculate the display name for a room member from its UserId. If no member with that ID is in
191 /// the room, the string representation of the ID will be returned.
192 fn calculate_user_name(&self, user_id: &UserId) -> String {
193 self.inner
194 .room
195 .borrow()
196 .members
197 .get(user_id)
198 // TODO: get rid of clone?
199 .and_then(|member| member.display_name.clone())
200 .unwrap_or_else(|| format!("{}", user_id))
201 }
202
190203 pub fn handle_membership_event(
191204 &mut self,
192205 event: &MemberEvent,