petite correction

This commit is contained in:
Alexandre Gonzalvez 2020-12-19 11:10:43 +01:00
parent 7bd2f3ecb6
commit 21eef445a7
2 changed files with 9 additions and 6 deletions

View file

@ -94,7 +94,6 @@ public class ListeningThreadTCPChat extends ListeningThread{
try { try {
String msgToprint; String msgToprint;
while (!(input=in.readLine()).equals("end")/* && c.getActive()*/) { while (!(input=in.readLine()).equals("end")/* && c.getActive()*/) {
System.out.println("("+this.controller.myUser.getPseudo()+") recoit => "+rm.getPseudo()+" : "+input); System.out.println("("+this.controller.myUser.getPseudo()+") recoit => "+rm.getPseudo()+" : "+input);
Msg_Text message = new Msg_Text(rm,input); Msg_Text message = new Msg_Text(rm,input);
c.addMessage(message); c.addMessage(message);

View file

@ -70,12 +70,19 @@ public class LocalUser extends User{
int index = this.remoteUsersList.indexOf(tmpRemoteUser); int index = this.remoteUsersList.indexOf(tmpRemoteUser);
if(index!=-1) { if(index!=-1) {
System.out.println("("+this.pseudo+") "+"MAJ, IP(port) : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPortTCP+")"); System.out.println("("+this.pseudo+") "+"MAJ, IP(port) : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPortTCP+")");
this.remoteUsersList.set(index,tmpRemoteUser); this.remoteUsersList.get(index).setAddIP(remoteUserIP);
this.remoteUsersList.get(index).setPortTCP(remoteUserPortTCP);
this.remoteUsersList.get(index).setPseudo(remoteUserPseudo);
} }
else { else {
System.out.println("("+this.pseudo+") "+"Add new user IP(port) : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPortTCP+")"); System.out.println("("+this.pseudo+") "+"Add new user IP(port) : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPortTCP+")");
this.remoteUsersList.add(tmpRemoteUser); this.remoteUsersList.add(tmpRemoteUser);
} }
/*
int i = getChatIndexOf(tmpRemoteUser);
if(i!=-1) {
chats.get(i).setRemoteUser(tmpRemoteUser);
}*/
} }
public Chat addChats(RemoteUser rm) { public Chat addChats(RemoteUser rm) {
@ -83,10 +90,7 @@ public class LocalUser extends User{
if(getChatIndexOf(rm)==-1) { if(getChatIndexOf(rm)==-1) {
this.getChats().add(newChat); this.getChats().add(newChat);
}/* }
else {
System.out.println("pb add chat, déjà un chat avec cet rm user");
}*/
return newChat; return newChat;
} }