Commit 28e7572ed5

28e7572ed54a7768f7d996499257d512a0b9f300

parent: afcffbe3d3

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2021-01-02 18:14 UTC

room: Set the nick localvar for room buffers.

Layout: unified · split

src/room/mod.rs +6 −1
@@ -44,7 +44,7 @@ use std::{
4444 time::{Instant, SystemTime},
4545};
4646
47use futures::StreamExt;
47use futures::{executor::block_on, StreamExt};
4848
4949use async_trait::async_trait;
5050use unicode_segmentation::UnicodeSegmentation;
@@ -200,6 +200,10 @@ impl RoomHandle {
200200 ) -> Self {
201201 let members = Members::new(room.clone());
202202
203 let own_nick = block_on(room.get_member(own_user_id))
204 .map(|m| m.name().to_owned())
205 .unwrap_or_else(|| own_user_id.localpart().to_owned());
206
203207 let mut room = MatrixRoom {
204208 homeserver: Rc::new(homeserver.clone()),
205209 room_id: Rc::new(room_id.clone()),
@@ -270,6 +274,7 @@ impl RoomHandle {
270274 buffer.enable_nicklist();
271275 buffer.disable_nicklist_groups();
272276 buffer.set_localvar("server", server_name);
277 buffer.set_localvar("nick", &own_nick);
273278
274279 // This is fine since we're only given the room to the buffer input and
275280 // the callback can only run once we yield controll back to Weechat.