private void disconnect() { if (session != null && session.isConnected()) { session.disconnect(); } jToggleButtonConnect.setSelected(false); jToggleButtonConnect.setText("Connect"); jToggleButtonRegister.setSelected(false); onlineUsers.clear(); jToggleButtonRegister.setText("Register"); }
private void register() { if (session != null && session.isConnected()) { onlineUsers.clear(); // get the current list Message msg = session.sendMessage("", "list", ""); System.out.println("LIST: " + msg.getBody()); StringTokenizer st = new StringTokenizer(msg.getBody(), "\n"); while (st.hasMoreTokens()) { onlineUsers.addElement(new HostItem(st.nextToken())); } session.postMessage("", "register", ""); } }
private void deregister() { onlineUsers.clear(); if (session != null && session.isConnected()) { session.postMessage("", "deregister", ""); } }