Commit e49c770b3f

e49c770b3f7df1d3054c1238ed14ced8ec9338d9

parent: fafce3b6c5

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2020-10-10 15:24 UTC

room_buffer: Shorten some doc comments.

Layout: unified · split

src/room_buffer.rs +19 −14
@@ -412,7 +412,8 @@ impl RoomBuffer {
412412
413413 /// Remove a Weechat room member by user ID.
414414 ///
415 /// Returns either the removed Weechat room member, or an error if the member does not exist.
415 /// Returns either the removed Weechat room member, or an error if the
416 /// member does not exist.
416417 pub fn remove_member(
417418 &mut self,
418419 user_id: &UserId,
@@ -439,7 +440,8 @@ impl RoomBuffer {
439440
440441 /// Change nick of member.
441442 ///
442 /// Returns either the old nick of the member, or an error if the member does not exist.
443 /// Returns either the old nick of the member, or an error if the member
444 /// does not exist.
443445 pub fn rename_member(
444446 &mut self,
445447 user_id: &UserId,
@@ -499,10 +501,11 @@ impl RoomBuffer {
499501 self.weechat_buffer().set_name(&name)
500502 }
501503
502 /// Helper method to calculate the display name of a room member from their UserId.
504 /// Helper method to calculate the display name of a room member from their
505 /// UserId.
503506 ///
504 /// If no member with that ID is in the room, the string representation of the ID will be
505 /// returned.
507 /// If no member with that ID is in the room, the string representation of
508 /// the ID will be returned.
506509 fn calculate_user_name(&self, user_id: &UserId) -> String {
507510 self.room()
508511 .get_member(user_id)
@@ -537,8 +540,8 @@ impl RoomBuffer {
537540 let send = async move |typing: bool| {
538541 let typing_time = typing_notice_time;
539542
540 // We're in the process of sending out a typing notice, so don't make
541 // the same request twice.
543 // We're in the process of sending out a typing notice, so don't
544 // make the same request twice.
542545 let guard = match typing_in_flight.try_lock() {
543546 Ok(guard) => guard,
544547 Err(_) => {
@@ -593,8 +596,8 @@ impl RoomBuffer {
593596
594597 /// Process disambiguations received from the SDK.
595598 ///
596 /// Disambiguations are a hashmap of user ID -> bool indicating that this user is either newly
597 /// ambiguous (true) or no longer ambiguous (false).
599 /// Disambiguations are a hashmap of user ID -> bool indicating that this
600 /// user is either newly ambiguous (true) or no longer ambiguous (false).
598601 #[allow(dead_code)]
599602 fn process_disambiguations(
600603 &mut self,
@@ -647,6 +650,7 @@ impl RoomBuffer {
647650 ) {
648651 let sender_id = event.sender.clone();
649652 let target_id;
653
650654 if let Ok(t) = UserId::try_from(event.state_key.clone()) {
651655 target_id = t;
652656 } else {
@@ -664,9 +668,10 @@ impl RoomBuffer {
664668
665669 // FIXME: Handle gaps (e.g. long disconnects) properly.
666670 //
667 // For joins and invites, first we need to check whether a member with some MXID
668 // exists. If he does, we have to update *that* member with the new state. Only if they
669 // do not exist yet do we create a new one.
671 // For joins and invites, first we need to check whether a member
672 // with some MXID exists. If he does, we have to update *that*
673 // member with the new state. Only if they do not exist yet do we
674 // create a new one.
670675 //
671676 // For leaves and bans we just need to remove the member.
672677 match event.content.membership {
@@ -694,8 +699,8 @@ impl RoomBuffer {
694699 // emitter.
695700 // self.process_disambiguations(&disambiguations);
696701
697 // Names of rooms without display names can get affected by the member list so we need to
698 // update them.
702 // Names of rooms without display names can get affected by the
703 // member list so we need to update them.
699704 self.update_buffer_name();
700705 } else {
701706 let change_op = event.membership_change();