rejoin rooms on reconnect
This commit is contained in:
@@ -233,4 +233,24 @@ class ChatRoomController {
|
||||
view.roomTextArea.replaceRange(null, line0Start, line0End)
|
||||
}
|
||||
}
|
||||
|
||||
void rejoinRoom() {
|
||||
if (model.room == ChatServer.CONSOLE)
|
||||
return
|
||||
|
||||
UUID uuid = UUID.randomUUID()
|
||||
long now = System.currentTimeMillis()
|
||||
String join = "/JOIN $model.room"
|
||||
byte [] sig = ChatConnection.sign(uuid, now, model.room, join, model.core.me, model.host, model.core.spk)
|
||||
def event = new ChatMessageEvent(
|
||||
uuid : uuid,
|
||||
payload : join,
|
||||
sender : model.core.me,
|
||||
host : model.host,
|
||||
room : model.room,
|
||||
chatTime : now,
|
||||
sig : sig
|
||||
)
|
||||
model.core.eventBus.publish(event)
|
||||
}
|
||||
}
|
@@ -50,19 +50,21 @@ class ChatServerModel {
|
||||
}
|
||||
|
||||
void onChatConnectionEvent(ChatConnectionEvent e) {
|
||||
if (e.persona == host) {
|
||||
runInsideUIAsync {
|
||||
status = e.status
|
||||
}
|
||||
if (e.persona != host)
|
||||
return
|
||||
|
||||
runInsideUIAsync {
|
||||
status = e.status
|
||||
}
|
||||
|
||||
|
||||
ChatLink link = e.connection
|
||||
if (link == null)
|
||||
return
|
||||
if (link.getPersona() == host)
|
||||
this.link = link
|
||||
else if (link.getPersona() == null && host == core.me)
|
||||
this.link = link
|
||||
this.link = e.connection
|
||||
|
||||
mvcGroup.childrenGroups.each {k,v ->
|
||||
v.controller.rejoinRoom()
|
||||
}
|
||||
}
|
||||
|
||||
private void eventLoop() {
|
||||
|
Reference in New Issue
Block a user