예제 #1
0
  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);
  }
예제 #2
0
  public void stop(boolean sayToServer) {
    //		connected = false;

    messages.createLogoutMessage();

    //		if(sayToServer)
    //			sendMessage("", Server.CLIENT_DISCONNECT);

    gui.showLoginView();

    connection.stop();
    //		connection = null;
    //		Log.printLogs(
    //                                                     );
  }
예제 #3
0
 public void sendFile(File file) {
   gui.appendText("Odoslal sa súbor: " + file.getName(), false);
   messages.createFileMessage(file);
 }
예제 #4
0
 public void sendMessage(String text, byte type) {
   if (text.isEmpty()) return;
   gui.appendText(text, false);
   messages.createTextMessage(text);
 }