static synchronized S manageSnippetList(S s, S name, S varName) { L list = (L) get(main.class, varName); new Matches m; if (match("list " + plural(name), s)) ret structure(list); if (match("how many " + plural(name), s)) ret str(l(list)); if (webAuthed() || litlist("yes", "partially").contains(isTrustedUser())) { if (match("add " + name + " *", s, m)) { S id = m.fsi(0); list.add(id); save(varName); ret "OK, " + name + " " + id + " added. List size now: " + l(list); } if (match("remove " + name + " *", s, m)) { S id = m.fsi(0); int idx = list.indexOf(id); if (idx < 0) ret id + " is not a " + name; list.remove(idx); save(varName); ret "OK, " + name + " " + id + " removed. List size now: " + l(list); } } ret null; }