public void start(String login, String ip, String port, boolean isHost) { this.login = login; this.port = port; this.ip = ip; connection = isHost ? new Server(this) : new Client(this); if (!isHost) messages.createWelcomeMessage(); gui.showChatView(login); }
public void stop(boolean sayToServer) { // connected = false; messages.createLogoutMessage(); // if(sayToServer) // sendMessage("", Server.CLIENT_DISCONNECT); gui.showLoginView(); connection.stop(); // connection = null; // Log.printLogs( // ); }
public void sendFile(File file) { gui.appendText("Odoslal sa súbor: " + file.getName(), false); messages.createFileMessage(file); }
public void sendMessage(String text, byte type) { if (text.isEmpty()) return; gui.appendText(text, false); messages.createTextMessage(text); }