static new TreeMap startVMLister_vms; static Lock startVMLister_lock = lock(); sclass startVMLister_Data { long started; int port; S vmID; bool hidden; } static void startVMLister() { S bot = "VM Lister."; if (!hasBot(bot)) makeBot(bot, f startVMLister_answer); } static S startVMLister_answer(S s) { lock startVMLister_lock; new Matches m; if "started vm * *" { int port = parseInt($1); startVMLister_vms.put(port, nu(startVMLister_Data, started := now(), +port, vmID := $2)); ret "OK"; } if "hiding vm *" { startVMLister_Data vm = startVMLister_vms.get(parseInt($1)); if (vm != null) vm.hidden = true; ret "OK"; } if "unhiding vm *" { startVMLister_Data vm = startVMLister_vms.get(parseInt($1)); if (vm != null) vm.hidden = false; ret "OK"; } if "killing vm *" { startVMLister_vms.remove(parseInt($1)); ret "OK"; } if "number of vms" ret lstr(startVMLister_vms); null; }