Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

46
LINES

< > BotCompany Repo | #1003170 // Jack's Identity Manager (LIVE)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2434L/16K/54K).

!752

static new L<Copy> copies;

static class Copy {
  S machineID;
  S dataID;
  long since;
  S status;
}

p {
  load("copies");
  makeBot("I'm Jack's Identity Manager.");
}

synchronized answer {
  if (match("copy to machine * with data *", s, m)
    || match("copy to machine *", s, m)) {
    deleteFrom(m.unq(0));
    new Copy c;
    c.machineID = m.unq(0);
    c.dataID = l(m.m) > 1 ? m.unq(1) : "#1001471";
    c.since = now();
    c.status = "copy requested";
    copies.add(c);
    save("copies");
    ret "OK";
  }
  
  if "should machine * run jack" {
    ret yn(hasWhere(copies, "machineID", m.unq(0)));
  }
  
  if "delete from machine *" {
    ret deleteFrom(m.unq(0));
  }
}

static S deleteFrom(S machineID) {
  Copy c = find(copies, "machineID", machineID);
  if (c == null) ret "not found";
  copies.remove(c);
  save("copies");
  ret "OK, deleted";
}

Author comment

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: 571 / 834
Referenced in: #1001248 - Public Comm Bot with forwarding (LIVE)