Closed cburschka closed 8 years ago
Okay, timeline.
xmpp.setRoom()
calls xmpp.leaveRoom()
after we're done joining. It does this before setting xmpp.room.current
, therefore leaveRoom()
thinks it's leaving the current room, and enters prejoin
mode.prejoin()
helpfully nulls out the current room and the URL fragment.chat.commands.part()
part()
calls xmpp.leaveRoom()
yet again.This makes it clear that leaveRoom()
's dependency on xmpp.room.current is something of an anti-pattern. Ideally, the caller should decide whether .prejoin() must be called.
Especially since leaveRoom
is called by three functions (setRoom
, /part
and /configure
), and only /part
leaves the current room.
Right now, joining another room while you're already inside a room will cause you to be instantly kicked out of the second room.
(Also, you will then see the output of the
/list
command twice.)