fix: improve multi-link identity handling to prevent incorrect room state emissions

This commit is contained in:
kc1awv
2026-05-16 23:48:33 +00:00
parent 5b8f4f0a24
commit 5ea91a011e
3 changed files with 22 additions and 3 deletions
+2
View File
@@ -7,6 +7,8 @@ This project follows the versioning policy in VERSIONING.md.
- Added core message type `ACTION` (`T_ACTION = 22`) routing with room-content semantics
- Added advisory capability flag `CAP_ACTION` and now include `B_WELCOME_CAPS` in WELCOME payloads
- ACTION bodies are forwarded as-is and are not interpreted as slash commands by the hub
- Fixed multi-link identity handling: do not emit room `PARTED` or clear
hash-link index state when a peer still remains in the room via another active link (thanks, neutral for the patch!)
## 0.2.2 - 2026-01-09
+9 -1
View File
@@ -602,7 +602,15 @@ class MessageRouter:
if st is not None and not st.get("registered"):
self.hub.room_manager._room_state.pop(r, None)
if remaining_members and self.hub.identity is not None:
peer_still_in_room = False
if peer_hash:
for member_link in remaining_members:
other = self.hub.session_manager.sessions.get(member_link)
if other and other.get("peer") == peer_hash:
peer_still_in_room = True
break
if remaining_members and self.hub.identity is not None and not peer_still_in_room:
notification_body = (
[peer_hash] if self.hub.config.include_joined_member_list else None
)
+11 -2
View File
@@ -119,7 +119,8 @@ class SessionManager:
rooms_count = len(sess.get("rooms") or ())
if isinstance(peer, (bytes, bytearray)):
self._index_by_hash.pop(bytes(peer), None)
if self._index_by_hash.get(bytes(peer)) is link:
self._index_by_hash.pop(bytes(peer), None)
if nick:
self.update_nick_index(link, nick, None)
@@ -134,7 +135,15 @@ class SessionManager:
self.hub.room_manager.remove_member(room, link)
if remaining_members and peer_hash and self.hub.identity:
peer_still_in_room = False
if peer_hash:
for member_link in remaining_members:
other = self.sessions.get(member_link)
if other and other.get("peer") == peer_hash:
peer_still_in_room = True
break
if remaining_members and peer_hash and self.hub.identity and not peer_still_in_room:
notification_body = (
[peer_hash] if self.hub.config.include_joined_member_list else None
)