Libraryless. Click here for Pure Java version (2434L/16K/54K).
1 | !752 |
2 | |
3 | static new L<Copy> copies; |
4 | |
5 | static class Copy { |
6 | S machineID; |
7 | S dataID; |
8 | long since; |
9 | S status; |
10 | } |
11 | |
12 | p { |
13 | load("copies"); |
14 | makeBot("I'm Jack's Identity Manager."); |
15 | } |
16 | |
17 | synchronized answer { |
18 | if (match("copy to machine * with data *", s, m) |
19 | || match("copy to machine *", s, m)) { |
20 | deleteFrom(m.unq(0)); |
21 | new Copy c; |
22 | c.machineID = m.unq(0); |
23 | c.dataID = l(m.m) > 1 ? m.unq(1) : "#1001471"; |
24 | c.since = now(); |
25 | c.status = "copy requested"; |
26 | copies.add(c); |
27 | save("copies"); |
28 | ret "OK"; |
29 | } |
30 | |
31 | if "should machine * run jack" { |
32 | ret yn(hasWhere(copies, "machineID", m.unq(0))); |
33 | } |
34 | |
35 | if "delete from machine *" { |
36 | ret deleteFrom(m.unq(0)); |
37 | } |
38 | } |
39 | |
40 | static S deleteFrom(S machineID) { |
41 | Copy c = find(copies, "machineID", machineID); |
42 | if (c == null) ret "not found"; |
43 | copies.remove(c); |
44 | save("copies"); |
45 | ret "OK, deleted"; |
46 | } |
Began life as a copy of #1001348
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: | #1003170 |
Snippet name: | Jack's Identity Manager (LIVE) |
Eternal ID of this version: | #1003170/1 |
Text MD5: | 32b87821675ef482da23aefac45152b3 |
Transpilation MD5: | acd9bc66821928c7809cb4f648451849 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-05-21 04:07:35 |
Source code size: | 915 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 570 / 832 |
Referenced in: | [show references] |