fix parted messages to only contain the id of the user leaving a room

This commit is contained in:
kc1awv
2026-01-09 10:21:59 -05:00
parent 9628955dce
commit 5e44961306
2 changed files with 18 additions and 28 deletions
+15 -19
View File
@@ -315,25 +315,21 @@ When a user joins a room:
### PART Behavior
When a user leaves a room:
When a user leaves a room, all users (including the departing user) receive a
`PARTED` message containing **only** the departing user's identity hash (if
`include_joined_member_list` is enabled).
1. **Parting user receives**: A `PARTED` message containing the list of
remaining room members (if `include_joined_member_list` is enabled).
2. **Remaining room members receive**: A `PARTED` message containing **only**
the identity hash of the user who just left.
```python
{
0: 1,
1: T_PARTED,
2: <msg-id>,
3: <timestamp>,
4: <hub-identity-hash>,
5: <room-name>,
6: [<departed-user-hash>] # body: single-element list
}
```
```python
{
0: 1,
1: T_PARTED,
2: <msg-id>,
3: <timestamp>,
4: <hub-identity-hash>,
5: <room-name>,
6: [<departed-user-hash>] # body: single-element list
}
```
### Configuration
@@ -347,7 +343,7 @@ When disabled, all `JOINED` and `PARTED` messages have `null` or empty bodies.
- **JOINED bodies** may contain either a full member list (multiple hashes) or a
single hash. Clients should handle both cases.
- **PARTED bodies** follow the same pattern.
- **PARTED bodies** always contain a single hash (the departing user's identity).
- The message source (`K_SRC`) is always the hub's identity hash, not the
joining/parting user.
- This extension allows clients to maintain accurate room member lists without
+3 -9
View File
@@ -614,15 +614,9 @@ class MessageRouter:
outgoing, member_link, member_notification_payload
)
parted_body = None
if self.hub.config.include_joined_member_list:
members: list[bytes] = []
for member_link in self.hub.room_manager.get_room_members(r):
s = self.hub.session_manager.sessions.get(member_link)
ph = s.get("peer") if s else None
if isinstance(ph, (bytes, bytearray)):
members.append(bytes(ph))
parted_body = members
parted_body = (
[peer_hash] if self.hub.config.include_joined_member_list else None
)
if self.hub.identity is not None:
parted = make_envelope(