Uses 911K of libraries. Click here for Pure Java version (14117L/78K).
!7 cmodule OSChat > 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('sendingToChat, msg); logQuotedWithDate(javaxDataDir("OS Chat/sent.log"), msg); //print("Sending to chat: " + msg); connector.sendLine("chat: " + quote(msg)); } void cleanMeUp { cleanUp(connector); } start { thread { exportComputerPublicKeyToServerMechList(); } connector = new StefansOS_ConnectToServer; connector.onLine = voidfunc(S line) { new Matches m; if (startsWith(line, "chat:", m)) { S msg = unquote(m.rest()); infoBox(indent(">> ", msg)); vmBus_send('gotFromChat, msg); logQuotedWithDate(stefansOS_chat_receivedLogFile(), msg); } }; connector.startWithSubs("chat"); } }
Began life as a copy of #1016578
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, hpgrupgrauku, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017119 |
Snippet name: | OS Chat [Public Chat among Stefan's OS users] |
Eternal ID of this version: | #1017119/29 |
Text MD5: | 7c04b439e4940ae88f33affa00042e67 |
Transpilation MD5: | f117f917f5f99a356941a08cf0cc0dbc |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-30 15:30:06 |
Source code size: | 1522 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 590 / 115831 |
Version history: | 28 change(s) |
Referenced in: | #1017134 - dm_osChat #1019239 - Listen To Snippet Updates [old, not needed anymore] #1019644 - Private Chat [Dyn Module] #1020212 - Stack Trace showing unnoticed deadlock in old version of setField() #1025927 - Machine Group Chat [Public chat among Stefan's OS machines] |