- use `state_key` instead of `user_id` to determine which member is
affected by the event
- assign state directly from the event in `add_member` instead of using
`membership_change`
- expand/fix docstrings
- add some logging
The new algorithm is simpler. Instead of tracking a list of
disambiguated display names in `Room`, we instead track the display name
ambiguity status in `RoomMember`. This allows a client to generate the
correct name for a member using solely the information available in
`RoomMember`.
The disambiguation algorithm itself now only calculates the set of members
whose ambiguity status had changed instead of producing disambiguated
display names for everyone affected. This is called on each room entry
(join or invite), room entry and profile change, and the updates are
propagated to the affected `RoomMember`s.
The `update_profile` method cannot live in `RoomMember` since that
operation needs information which only exists in `Room` (for instance,
it needs other members in order to perform display name disambiguation).
Leaving other mutating methods on `RoomMember` (like `update_power` and
`update_presence`) then seemed illogical so they were all moved into
`Room`.
In addition, a small refactoring was done to remove
`did_update_presence` and `update_presence` since their existence
doesn't make much sense anymore and it saves us from repeating work.
Their function is now done in `receive_presence_event`.
Also, several docstrings were corrected and reworded.
EventBuilder now clears itself between `build_sync_response` calls so
that each subsequent call will return an empty response if nothing was
added.
This allows reuse of a single EventBuilder instance which is important
for correct sync token rotation.
The previous test only tested using the `EventEmitter`, which missed the
fact that the client was receiving unhoisted events. The test now also
tests the client state to detect this.
Remove 'get' from get_public_rooms* methods.
Rename RoomSearchBuilder -> RoomListFilterBuilder.
Use u32 over UInt in builders and Into<String> for String.
Fix docs of public room methods and builders.