wip on private messages

pull/34/head
Zlatin Balevsky 2019-11-12 13:16:36 +00:00
parent 59c03be35e
commit 1f9b171021
4 changed files with 10 additions and 6 deletions

View File

@ -67,6 +67,7 @@ class ChatRoomController {
params['room'] = newRoom
params['console'] = false
params['host'] = model.host
params['roomTabName'] = newRoom
mvcGroup.parentGroup.createMVCGroup("chat-room", newRoom, params)
}
@ -76,9 +77,9 @@ class ChatRoomController {
view.closeTab.call()
}
UUID uuid = UUID.randomUUID()
String room = model.console ? ChatServer.CONSOLE : model.room
UUID uuid = UUID.randomUUID()
byte [] sig = ChatConnection.sign(uuid, now, room, command.source, model.core.me, model.host, model.core.spk)
def event = new ChatMessageEvent(uuid : uuid,

View File

@ -15,6 +15,7 @@ class ChatRoomModel {
String room
boolean console
boolean privateChat
String roomTabName
def members = []

View File

@ -96,14 +96,15 @@ class ChatServerModel {
room = chatCommand.payload
}
if (chatCommand.action == ChatAction.SAY &&
room == core.me.getHumanReadableName()) {
room == core.me.toBase64()) {
if (!mvcGroup.childrenGroups.containsKey(e.sender.getHumanReadableName()+"-private-chat")) {
def params = [:]
params['core'] = core
params['tabName'] = host.getHumanReadableName() + "-chat-rooms"
params['room'] = e.sender.getHumanReadableName()
params['room'] = e.sender.toBase64()
params['privateChat'] = true
params['host'] = host
params['roomTabName'] = e.sender.getHumanReadableName()
mvcGroup.createMVCGroup("chat-room",e.sender.getHumanReadableName()+"-private-chat", params)
}

View File

@ -86,7 +86,7 @@ class ChatRoomView {
void mvcGroupInit(Map<String,String> args) {
parent = mvcGroup.parentGroup.view.builder.getVariable(model.tabName)
parent.addTab(model.room, pane)
parent.addTab(model.roomTabName, pane)
int index = parent.indexOfComponent(pane)
parent.setSelectedIndex(index)
@ -94,7 +94,7 @@ class ChatRoomView {
def tabPanel = builder.panel {
borderLayout()
panel (constraints : BorderLayout.CENTER) {
label(text : model.room)
label(text : model.roomTabName)
}
button(icon : imageIcon("/close_tab.png"), preferredSize: [20, 20], constraints : BorderLayout.EAST,
actionPerformed : closeTab )
@ -122,6 +122,7 @@ class ChatRoomView {
params['room'] = p.getHumanReadableName()
params['privateChat'] = true
params['host'] = model.host
params['privateTarget'] = p
mvcGroup.parentGroup.createMVCGroup("chat-room", p.getHumanReadableName()+"-private-chat", params)
}