!7 cmodule MachineGroupChat > DynPrintLog { S msg; bool sign; transient StefansOS_ConnectToServer connector; visualize { JComponent log = super.visualize(); enableWordWrap(); ret centerAndSouthWithMargins(log, centerAndEastWithMargin(withLabel("Talk to everyone:", onEnterAndCtrlEnter(jLiveValueTextField_bothWays(dm_fieldLiveValue('msg)), rThread sendMsg)), centerAndEastWithMargin(jLiveValueCheckBox("Sign", dm_fieldLiveValue('sign)), jbutton("Send", rThread sendMsg)))); } void sendMsg { postMsg(trim(msg), sign); setField(msg := ""); } void postSigned(S msg) q { postMsg(msg, true); } void postMsg(S _msg, bool sign) q { S msg = _msg; if (empty(msg = trim(msg))) ret; if (sign) msg = signWithComputerIDAndDate(msg); vmBus_send('sendingToMachineChat, msg); //logQuotedWithDate(javaxDataDir("OS Chat/sent.log"), msg); //print("Sending to machine chat: " + msg); connector.sendLine("machineChat: " + quote(msg)); } void cleanMeUp { cleanUp(connector); } start { thread { exportComputerPublicKeyToServerMechList(); } connector = new StefansOS_ConnectToServer; connector.onLine = voidfunc(S line) { new Matches m; if (startsWith(line, "machineChat:", m)) { S msg = unquote(m.rest()); //infoBox(indent(">> ", msg)); vmBus_send('gotFromMachineChat, msg); //logQuotedWithDate(stefansOS_chat_receivedLogFile(), msg); } }; connector.startWithSubs("machineChat"); } }