Commit bae4dcf65d
Unsigned
Layout: unified · split
src/bar_items/status.rs +1 −3
| @@ -31,9 +31,7 @@ impl BarItemCallback for Status { | ||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | if room.is_public() { |
| 34 | signs.push( | |
| 35 | server.config().borrow().look().public_room_sign(), | |
| 36 | ); | |
| 34 | signs.push(server.config().borrow().look().public_room_sign()); | |
| 37 | 35 | } |
| 38 | 36 | |
| 39 | 37 | if room.is_busy() { |
src/room/mod.rs +18 −1
| @@ -61,7 +61,7 @@ use matrix_sdk::{ | ||
| 61 | 61 | AnySyncMessageEvent, AnySyncRoomEvent, AnySyncStateEvent, |
| 62 | 62 | SyncMessageEvent, SyncStateEvent, |
| 63 | 63 | }, |
| 64 | identifiers::{EventId, RoomId, UserId}, | |
| 64 | identifiers::{EventId, RoomAliasId, RoomId, UserId}, | |
| 65 | 65 | uuid::Uuid, |
| 66 | 66 | JoinedRoom, |
| 67 | 67 | }; |
| @@ -279,6 +279,10 @@ impl RoomHandle { | ||
| 279 | 279 | buffer.set_localvar("domain", room.room_id().server_name().as_str()); |
| 280 | 280 | buffer.set_localvar("room_id", room.room_id().as_str()); |
| 281 | 281 | |
| 282 | if let Some(alias) = room.alias() { | |
| 283 | buffer.set_localvar("alias", alias.as_str()); | |
| 284 | } | |
| 285 | ||
| 282 | 286 | // This is fine since we're only given the room to the buffer input and |
| 283 | 287 | // the callback can only run once we yield controll back to Weechat. |
| 284 | 288 | unsafe { |
| @@ -352,6 +356,10 @@ impl MatrixRoom { | ||
| 352 | 356 | self.room.is_public() |
| 353 | 357 | } |
| 354 | 358 | |
| 359 | pub fn alias(&self) -> Option<RoomAliasId> { | |
| 360 | self.room.canonical_alias() | |
| 361 | } | |
| 362 | ||
| 355 | 363 | pub fn room_id(&self) -> &RoomId { |
| 356 | 364 | &self.room_id |
| 357 | 365 | } |
| @@ -883,6 +891,14 @@ impl MatrixRoom { | ||
| 883 | 891 | } |
| 884 | 892 | } |
| 885 | 893 | |
| 894 | fn set_alias(&self) { | |
| 895 | if let Some(alias) = self.alias() { | |
| 896 | if let Ok(b) = self.buffer_handle().upgrade() { | |
| 897 | b.set_localvar("alias", alias.as_str()); | |
| 898 | } | |
| 899 | } | |
| 900 | } | |
| 901 | ||
| 886 | 902 | fn update_buffer_name(&self) { |
| 887 | 903 | let name = self.members.calculate_buffer_name(); |
| 888 | 904 | |
| @@ -1015,6 +1031,7 @@ impl MatrixRoom { | ||
| 1015 | 1031 | } |
| 1016 | 1032 | AnySyncStateEvent::RoomName(_) => self.update_buffer_name(), |
| 1017 | 1033 | AnySyncStateEvent::RoomTopic(_) => self.set_topic(), |
| 1034 | AnySyncStateEvent::RoomCanonicalAlias(_) => self.set_alias(), | |
| 1018 | 1035 | _ => (), |
| 1019 | 1036 | } |
| 1020 | 1037 | } |