Libraryless. Click here for Pure Java version (4898L/33K/110K).
!752 static class Resp { long virtualPort; S botName; O responder; } static new List<Resp> responders; static Android3 android; static long nextVirtualPort = 1; p { synchronized(getJavaX()) { if (!getMultiPorts().isEmpty()) return; if (!(boolean) call(getJavaX(), "addMultiPort", main.class)) { // XXX - hope this still works Android3 android = new Android3("Multi-Port at " + getVMID() + "."); android.useMultiPort = false; android.incomingSilent = true; android.console = false; makeAndroid3(android); } } print("Multi-Port registered with VM. Now " + l(getMultiPorts()) + " multi-port(s)."); } static S answer(S s) { new Matches m; if (match3("list bots", s, m)) { ret structure(listBotsWithPort()); } if (match3("has bot *", s, m)) { S name = m.unq(0); ret findResponder(name) != null ? "yes" : "no"; } if (match3("silent", s, m)) { android.incomingSilent = true; ret "OK."; } if (match3("unsilent", s, m)) { android.incomingSilent = false; ret "OK."; } if (match3("please forward to bot *: *", s, m)) { S bot = unquote(m.m[0]); S line = unquote(m.m[1]); O responder = findResponder(bot); if (responder == null) ret "Error: bot not found"; else ret (S) call(responder, "answer", line, litlist(s)); } ret null; } static synchronized L<S> listBots() { new L<S> list; for (Resp r : responders) list.add(r.botName); ret list; } static synchronized Map<Long,S> listBotsWithPort() { new Map<Long,S> map; for (Resp r : responders) map.put(r.virtualPort, r.botName); ret map; } static synchronized O findResponder(S botName) { if (isInteger(botName)) { long vport = parseLong(botName); for (Resp r : responders) if (r.virtualPort == vport) ret r.responder; } else { for (Resp r : responders) if (startsWithIgnoreCase(r.botName, botName)) ret r.responder; } ret null; } static synchronized long addResponder(S botName, O responder) { new Resp r; r.virtualPort = nextVirtualPort++; r.botName = botName; r.responder = responder; responders.add(r); ret r.virtualPort; } static synchronized void removeResponder(O responder) { for (int i = 0; i < l(responders); i++) if (responders.get(i).responder == responder) { //print("Responder removed."); responders.remove(i); ret; } } static synchronized void removePort(long virtualPort) { for (int i = 0; i < l(responders); i++) if (responders.get(i).virtualPort == virtualPort) { //print("Virtual port " + virtualPort + " removed."); responders.remove(i); ret; } }
download show line numbers debug dex old transpilations
Travelled to 151 computer(s): afvcxyesxakz, agxbjmyenqqu, aoiabmzegqzx, bfooyqadtzbb, bhatertpkbcr, bkpbhqsukdzp, brfxcrgsgrhg, cbybwowwnfue, cfunsshuasjs, connxhvfqtma, crvwmplrxojx, dbyzmesgzjrf, ddnzoavkxhuk, dhtvkmknsjym, digkpvzjadop, dlyzodsxvbls, doutfcgsyoqy, dsbpoofgtjnx, dtyaoxivooce, dvxvdlhqlwwc, dyfldxrfteug, ecqjixtmvxlp, egsshdfjpivr, etmzoiygucik, ezeddxofnljr, flwlchajcels, fnmrsykwqckh, funhxakgkfno, fvctnogetyww, gavnqejikrat, gbdqvketdppm, gqhbhyymrpxx, gsrwncdeurkl, gveowxfxqtil, gwrvuhgaqvyk, gzronoodcfmh, hkknpzsgoixq, honjdlwrmtdu, htkmirzsdzmu, hvbppbdwfhjy, idcfvzviszxn, ifxxhhcvckaw, igfbtfetlyvk, inzdgbwbursp, ipcmaqahdjtn, ishmyahliavo, ishqpsrjomds, ivagervvdxrj, jaezsmbrhigw, jgjqzccotruy, jlatgrcjtklg, jlfdhaxjyrpf, jrjpqrqxafhk, jtubtzbbkimh, jtwzfcwerbbv, jwlibnwemntm, kiawvgutsbre, ldywjnwigrac, ledgnsvlgdlr, lgdvxdgcpgrv, liwcxgsjrgqn, lnjhkqwteiwi, lpdgvwnxivlt, lqsqiistucwk, lsgdidgppwqq, lwfphbruhgtm, mdbqpbajgrux, mdefezkwdeup, meaqxkopohqc, mmaxggujatqf, mmmwsgafmleu, mnzieskfvskl, mqqgnosmbjvj, mrmohjpeebfc, nbgitpuheiab, ndavzgiapdkk, nmhwwpuvbanc, nrhsverhnpsn, nysugtttblhj, omkuifhlbvuf, omrbxrqoiqeh, omzkqqnokwlv, onfqjnomoxuw, onxytkatvevr, opsabzhijxss, owkcekpozlzc, pekvfmzvrlzt, pgppnpcqwliz, pidvqqudxurz, pnmttuucjkfb, ppwwtnwhztze, pyentgdyhuwx, pzhvpgtvlbxg, qdihqxvjryuq, qhcvkqotyiga, qhhqrodowzfo, qmupjbhcwcol, qnhezvwmdcbn, quisjpqxfggn, recxuykagbtt, rsdhgwlghzqg, sawdedvomwva, sksrqysvpwbz, skttnvmfkzhq, slhtubpyutdj, tcpfgdjhqqpe, teubizvjbppd, tjmheftkjvzt, tpcbwahvpzrm, tpdfwrfxnmsq, tslmcundralx, tsuzdeebumli, tvejysmllsmz, tvkpfieynkqz, twqnfdxxpuxv, txvdafyrfdei, txzhwycxdpzm, ucpxxyxryupy, umpqpbvfwjre, unkrhppcbqnk, uvkibmskjcsb, uwnvikuolobj, uzhyvevygbcc, uzolovmvtubr, vaduqbtgckcl, vdgqpiitesmp, vgjwidwdhwnw, vouqrxazstgt, vqblocesogdc, vqftxbmjmmzu, vxshqlgoesuw, vzpxdoxhqfnw, wglhsqxgxbdq, whwpvezoxzgq, winwedijdyqq, wltunwwkxhxr, wtjuwcnefrcw, wwghvftpbobq, xhsrmoityime, xprdwmaupziu, yabhydzhqlvs, ybmhnqzijvxm, yjcobudmfboh, yjprkgrpedlo, ymicnlqhuozx, yqkyyimflwur, yuicjtqnulgz, ywixcsqzavbw, zndhoewobdyk, zrzaeipbowrh, ztgjuucfqghy
No comments. add comment