// assumes hello message has not been read yet static DialogIO replaceHelloMessage(final DialogIO io, final S newMsg) { io.readLine(); // read old hello msg ret new DialogIO() { bool sent; // delegate all but readLineImpl() boolean isStillConnected() { ret io.isStillConnected(); } boolean isLocalConnection() { ret io.isLocalConnection(); } Socket getSocket() { ret io.getSocket(); } public void close() ctex { io.close(); } void sendLine(String line) { io.sendLine(line); } String readLineImpl() { if (!sent) { sent = true; ret newMsg; } ret io.readLine(); } }; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007062 |
Snippet name: | replaceHelloMessage |
Eternal ID of this version: | #1007062/4 |
Text MD5: | ebcb7e489aa57f050e56aff62b0309e8 |
Author: | stefan |
Category: | javax / bots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-26 23:22:27 |
Source code size: | 672 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 474 / 506 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |