示例#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 int getMaxMsgLenght() {
   return gui.getMaxSize();
 }
示例#4
0
 public void sendFile(File file) {
   gui.appendText("Odoslal sa súbor: " + file.getName(), false);
   messages.createFileMessage(file);
 }
示例#5
0
 public void sendMessage(String text, byte type) {
   if (text.isEmpty()) return;
   gui.appendText(text, false);
   messages.createTextMessage(text);
 }
示例#6
0
 public void recieveMessage(String message) {
   //		lastContact = System.currentTimeMillis();
   connection.setLastContact(System.currentTimeMillis());
   gui.appendText(message, true);
 }