diff --git a/bin/.gitignore b/bin/.gitignore index 1513e5a..69840a0 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -15,3 +15,4 @@ /logout(1).png /logout.png /logout(2).resized.png +/live.png diff --git a/src/com/chatroom/client/Client.java b/src/com/chatroom/client/Client.java index ac3e93b..bf465e7 100755 --- a/src/com/chatroom/client/Client.java +++ b/src/com/chatroom/client/Client.java @@ -9,6 +9,7 @@ import java.lang.Thread.State; import java.net.Socket; import java.util.Scanner; + import com.chatroom.configuration.Config; import com.chatroom.models.Request; import com.chatroom.models.Response; @@ -236,7 +237,20 @@ else if(response.getId() == Response.Type.MSG.ordinal() || response.getId() == R else Message.println("\n<" + name + ">: " + msg); } - + else if(response.getId() == Response.Type.GEN.ordinal()) { + String data = "List of Online Users \n"; + int i = 1; + data += i + ". You \n"; + String temp = response.getContents(); + if(temp.length() != 0 && !temp.equals("")) { + String arrayOFNames[] = temp.split(","); + for (String string : arrayOFNames) { + i++; + data += i + ". " + string + "\n"; + } + } + Message.println(data); + } if(response.getContents().equals("sv_exit_successful")) { synchronized(this){ this.wait(); @@ -326,4 +340,4 @@ else if(response.getId() == Request.Type.LOGIN.ordinal()) { LogFileWriter.Log(Config.errors.toString()); } } -} +} \ No newline at end of file