diff --git a/Wordle Diagramme/Objektdiagramm Wordle Projekt.uxf b/Wordle Diagramme/Objektdiagramm Wordle Projekt.uxf index 8c1060b..049d61b 100644 --- a/Wordle Diagramme/Objektdiagramm Wordle Projekt.uxf +++ b/Wordle Diagramme/Objektdiagramm Wordle Projekt.uxf @@ -4,7 +4,7 @@ UMLClass - 192 + 114 438 270 96 @@ -27,7 +27,7 @@ UMLClass - 258 + 180 348 126 42 @@ -41,7 +41,7 @@ UMLClass - 78 + 0 642 126 42 @@ -54,7 +54,7 @@ UMLClass - 264 + 186 642 126 42 @@ -67,7 +67,7 @@ UMLClass - 258 + 180 246 126 42 @@ -80,7 +80,7 @@ UMLClass - 438 + 360 642 126 42 @@ -93,7 +93,7 @@ Relation - 318 + 240 384 18 66 @@ -104,7 +104,7 @@ Relation - 318 + 240 282 18 78 @@ -115,18 +115,18 @@ Relation - 318 - 606 + 240 + 612 18 - 48 + 42 lt=<.. - 10.0;60.0;10.0;10.0 + 10.0;50.0;10.0;10.0 Relation - 198 + 120 654 78 18 @@ -137,7 +137,7 @@ Relation - 384 + 306 654 66 18 @@ -148,8 +148,8 @@ UMLClass - 264 - 552 + 186 + 558 126 60 @@ -157,6 +157,7 @@ -- - pullStats(user) + pushStats(user) ++ createNewUser(user) + checkForLogin(String username, String passwort):boolean + getWord(int) @@ -164,7 +165,7 @@ UMLClass - 540 + 462 426 126 156 @@ -191,7 +192,7 @@ Relation - 456 + 378 480 96 24 @@ -203,21 +204,21 @@ m1=n Relation - 318 + 240 528 24 - 36 + 42 lt=<.. 1 - 10.0;40.0;10.0;10.0 + 10.0;50.0;10.0;10.0 Relation - 660 + 582 474 114 30 @@ -230,7 +231,7 @@ m1=1 UMLClass - 762 + 684 450 126 102 diff --git a/WordleServer.java b/WordleServer.java index 18508f0..41560b8 100644 --- a/WordleServer.java +++ b/WordleServer.java @@ -44,14 +44,13 @@ public class WordleServer extends Server { @Override public void processMessage(String pClientIP, int pClientPort, String pMessage) { - String conectionID = pClientIP + ":" + Integer.toString(pClientPort); - User u = users.get(conectionID); + String connectionID = pClientIP + ":" + Integer.toString(pClientPort); + User u = users.get(connectionID); + u.setConnectionID(connectionID); if (pMessage.equals("QUIT")) { send(pClientIP, pClientPort, "+OK Bye"); close(); - } else { - send(pClientIP, pClientPort, "-ERR Command not valid in this state"); } switch (u.getState()) { @@ -61,13 +60,20 @@ public class WordleServer extends Server { if (m.equalsIgnoreCase("USER")) { m = pMessage.substring(6, pMessage.length() - 1); u.setUsername(m); - send(pClientIP, pClientPort, "+OK Bye"); + send(pClientIP, pClientPort, "+OK"); } else if (m.equalsIgnoreCase("PASS")) { m = pMessage.substring(6, pMessage.length() - 1); u.setPassword(m); if (u.getPassword() != null && u.getUsername() != null) { - query.checkLogin(u.getUsername(), u.getPassword()); + if (query.checkLogin(u.getUsername(), u.getPassword())) { + send(pClientIP, pClientPort, "+OK welcome"); + u.setState(3); + } else { + send(pClientIP, pClientPort, "+ERR login not valid"); + } } + } else { + send(pClientIP, pClientPort, "-ERR Command not valid in this state"); } break; case 2: