private void user_kick(String[] cmd) throws IOException { if (cmd.length == 2 && logged) { String username = cmd[1]; boolean b = GestionePartite.getInstance().kickUser(username); if (b) OutputWrite("user_kick=OK"); else OutputWrite("user_kick=error"); } else OutputWrite("user_kick=error"); }
private void user_list_online(String[] cmd) throws IOException { if (cmd.length == 1) { if (!logged) { OutputWrite("user_list_online=error;message=Non sei loggato"); } else { ArrayList<String> list = GestionePartite.getInstance().listUsers(); StringBuilder resp = new StringBuilder( "user_list_online=OK;client_attivi=" + ConnectionsCount.getConnectionsAlive() + ";loggati=" + list.size()); for (int i = 0; i < list.size(); i++) { resp.append(";utente=" + list.get(i)); } OutputWrite(resp.toString()); } } else OutputWrite("user_list_online=error;message=Usage: list_users"); }