static Map<S, Int> newFindBot2_cache = synchroHashMap(); sbool newFindBot2_verbose; static DialogIO newFindBot2(S name) { Int port = newFindBot2_cache.get(name); if (port != null) { if (newFindBot2_verbose) print("newFindBot2: testing " + name + " => " + port); DialogIO io = talkTo(port); S q = format("has bot *", name); S s = io.ask(q); if (match("yes", s)) { io = talkToSubBot(name, io); call(io, "pushback", "?"); // put some hello string in (yes, this should be improved.) ret io; } // bot not there anymore - remove cache entry newFindBot2_cache.remove(name); if (newFindBot2_verbose) print("newFindBot2: dropping " + name + " => " + port); } DialogIO io = findBot(name); if (io != null) { newFindBot2_cache.put(name, io.getPort()); if (newFindBot2_verbose) print("newFindBot2: remembering " + name + " => " + port); } ret io; }
Began life as a copy of #1001964
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005451 |
Snippet name: | newFindBot2 |
Eternal ID of this version: | #1005451/1 |
Text MD5: | 65f1567ebd04a178865553eb19923672 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-19 13:29:50 |
Source code size: | 962 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 532 / 541 |
Referenced in: | [show references] |