This commit is contained in:
Theau Giraud 2020-12-18 11:11:05 +01:00
commit a168df58fb

View file

@ -190,16 +190,18 @@ public class Controller {
String tmpPseudo = view.PseudotextField.getText(); // Read user input
while(!(this.validatePseudo(tmpPseudo)) || tmpPseudo.equals(oldPseudo)) {
if(!(this.validatePseudo(tmpPseudo)) || tmpPseudo.equals(oldPseudo)) {
view.Pseudolabel.setText("Already exists, enter another nickname. Your current username is: " + oldPseudo); // Read user input
tmpPseudo = view.PseudotextField.getText(); // Read user input
}
else {
this.myUser.setPseudo(tmpPseudo);
JOptionPane.showMessageDialog(null ,"Your new nickname : " + tmpPseudo + " is valid !");
this.notify_remote_users();
this.myUser.setPseudo(tmpPseudo);
}
JOptionPane.showMessageDialog(null ,"Your new nickname : " + tmpPseudo + " is valid !");
this.notify_remote_users();
}
/**
* <p>
@ -380,11 +382,12 @@ public class Controller {
}
public void askCloseSession() {
closeSession(this.activeChat);
this.activeChat = null;
}
public void closeSession(Chat c) {
sendMessage(new Msg_Text(myUser.getAddIP(),"end"), c); // tell rm session STOP
JOptionPane.showMessageDialog(null ,"Close session with "+c.getRemoteUser().getPseudo()+" loading history");
JOptionPane.showMessageDialog(null ,"Close session with "+c.getRemoteUser().getPseudo());
this.myUser.closeChat(c);
}