Browse Source

Change pseudo bug correction

Paul Faure 3 years ago
parent
commit
9d9634f79f

BIN
build/libs/Clavardage-1.0-all.jar View File


+ 4
- 2
src/main/java/app/insa/clav/Core/Model.java View File

@@ -300,7 +300,7 @@ public class Model implements PropertyChangeListener{
300 300
                 this.support.firePropertyChange("pseudoRefused", this.user.getPseudo(), this.ancienPseudo);
301 301
             }
302 302
             synchronized (userList) {
303
-                if (!this.userList.contains(newUser)) {
303
+                if ((!this.userList.contains(newUser)) && (!newUser.equals(this.user))) {
304 304
                     this.userList.add(newUser);
305 305
                     Collections.sort(this.userList);
306 306
                     this.support.firePropertyChange("newUserConnected", -1, -2);
@@ -664,7 +664,9 @@ public class Model implements PropertyChangeListener{
664 664
                     }
665 665
                     userList.removeAll(userListToRemove);
666 666
                     servUserList.removeAll(userListWatched);
667
-                    servUserList.remove(user);
667
+                    if (servUserList.remove(user)) {
668
+                        System.out.println(("\n\nUSER SUPP\n\n"));
669
+                    }
668 670
                     userListToAdd.addAll(servUserList);
669 671
                     userList.addAll(userListToAdd);
670 672
                 } else {

+ 3
- 3
src/main/java/app/insa/clav/Core/Utilisateurs.java View File

@@ -100,9 +100,9 @@ public class Utilisateurs implements Comparable{
100 100
     }
101 101
 
102 102
     @Override
103
-    public boolean equals(Object obj) {
104
-        Utilisateurs aux = (Utilisateurs) obj;
105
-        return this.id == aux.id;
103
+    public boolean equals(Object o) {
104
+        Utilisateurs u = (Utilisateurs) o;
105
+        return this.id == u.id;
106 106
     }
107 107
 
108 108
     @Override

+ 3
- 0
src/main/java/app/insa/clav/UIControllers/ChatWindowController.java View File

@@ -306,7 +306,10 @@ public class ChatWindowController implements Initializable, PropertyChangeListen
306 306
         this.tcpCo = tcpCo;
307 307
         if (this.tcpCo.isOutdoor()) {
308 308
             this.pickFileButton.setVisible(false);
309
+            this.removeFileButton.setVisible(false);
309 310
             this.pickFileButton.setDisable(true);
311
+            this.removeFileButton.setDisable(true);
312
+
310 313
         }
311 314
         tcpCo.addPropertyChangeListener(this);
312 315
         int remoteUserId = tcpCo.remoteUserId;

+ 5
- 1
src/main/java/app/insa/clav/UIControllers/PseudoWindowController.java View File

@@ -96,7 +96,11 @@ public class PseudoWindowController implements PropertyChangeListener, Initializ
96 96
     public void clickButtonValidatePseudo(ActionEvent evt){
97 97
         String newPseudo = this.pseudoInput.getText();
98 98
         if (!newPseudo.equals(this.model.user.getPseudo())){
99
-            this.model.choosePseudo(newPseudo,true);
99
+            if (!this.model.user.isOutdoor()) {
100
+                this.model.choosePseudo(newPseudo, true);
101
+            } else {
102
+                this.model.choosePseudoOutdoor(newPseudo, true);
103
+            }
100 104
             this.spinnerPseudo.setVisible(true);
101 105
         }
102 106
     }

Loading…
Cancel
Save