diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen$1.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen$1.class index 7c1974a1de9a270cac93185b5febe95a045199fc..bf673f8ea6d84ed6e9fd40503c8a4767a75048d6 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen$1.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen$1.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen.class index 4a465635ebcb3e55802d5a8bd8dd0b4bd39c2976..f4e30aaffc4a45f3d431149a0acbc881b95b8b2e 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/ChatScreen.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI$1.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI$1.class index 8b9146bbbc79617544b13a9369add59d22f980de..cc90a9c6246be3e81b09d9081b834ead1f6cc592 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI$1.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI$1.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI.class index ddf219680d1967e28e63035b2ef00d9d5300c260..592ac85cd5cd5ffa4ac44a16db9b3f65232a079d 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/GUI/PaintGUI.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/META-INF/comp90015-dsass2-infinitymonkeys-remaster.kotlin_module b/out/production/comp90015-dsass2-infinitymonkeys-remaster/META-INF/comp90015-dsass2-infinitymonkeys-remaster.kotlin_module new file mode 100644 index 0000000000000000000000000000000000000000..2983af70661ad375cc499ebc4da5a68ca46c532e Binary files /dev/null and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/META-INF/comp90015-dsass2-infinitymonkeys-remaster.kotlin_module differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ChatUpdate.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ChatUpdate.class index ab22187ac7d4f98f5d6a18a2636745ef64b3cae1..67a49f505beee840b3e57a9e85b034dd23bf2d8c 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ChatUpdate.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ChatUpdate.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/Client.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/Client.class index 36198e4bf93550c1cc6f881fedc4c0b372cd1dbb..b380d66220f652cc9b22291acc8445552a61b404 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/Client.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/Client.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ClientUpdate.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ClientUpdate.class index ad564f64509e59856ae964be020e02c9981f6eba..66a59d861a1a2a8d97c3926e948b2857958cdca6 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ClientUpdate.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/ClientUpdate.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/DrawingUpdate.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/DrawingUpdate.class index 5e519b95a6d0920b2aae6540612ceb081dda0366..a3b8302dd9e3252b1941eb2af93b54760ea2b35b 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/DrawingUpdate.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/client/DrawingUpdate.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatController.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatController.class index 890f6569a755665302a1d37be8dd61d80793a8f2..53c3ebdbeb067f1865fe93a3e90ce8ef69e59d0b 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatController.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatController.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatUpdate.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatUpdate.class index 05b1a7a82a84c88af6d578d3cb2e7e97a8468921..f84138bb8bf132eae71b572e7f8c37323da8ae93 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatUpdate.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IChatUpdate.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientController.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientController.class index 8ebb942002c9acd24731c041333431529e218a5b..a715a7529d155693afd32a10c6d499fbc792097a 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientController.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientController.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientUpdate.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientUpdate.class index 40d1f67006a40017f46a01564f48064d5da9a51b..594d29d42b0c49bf0496f846c0945c7ceaeacf33 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientUpdate.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IClientUpdate.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IUpdateController.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IUpdateController.class deleted file mode 100644 index afcf1a62220c910720cf59d0c49f8d67d01d2167..0000000000000000000000000000000000000000 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/remote/IUpdateController.class and /dev/null differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ChatController.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ChatController.class index 3d53a767c735c3e1e6236e5ad6325b2e5230a9c2..b56eaad1cdbc2c794f9ab2a79109a88eb63fa3fb 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ChatController.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ChatController.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ClientController.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ClientController.class index fa8d3ef62c0c228de653ec499ca7bf7a1f9fb77c..f8f9cc0ee6a843d9f3771bc2c10ace5c357cb13d 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ClientController.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/ClientController.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/Server.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/Server.class index 52bd59819c3dfe46ae78bce48a1b2617d0822004..0c1967b8f8157aa219773025b224455fa21cf3ef 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/Server.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/Server.class differ diff --git a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/User.class b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/User.class index 3b63492ccae132a24d5de57832e8052015689b63..bb1cfcbe52b605032645164945747218b2160ba8 100644 Binary files a/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/User.class and b/out/production/comp90015-dsass2-infinitymonkeys-remaster/server/User.class differ diff --git a/src/GUI/ChatScreen.form b/src/GUI/ChatScreen.form index 7ff8dffbe24b88abe437e256e76198ea323b9a90..9d8893e963fd7589e8246cf21b7735b63c75c9e6 100644 --- a/src/GUI/ChatScreen.form +++ b/src/GUI/ChatScreen.form @@ -8,7 +8,7 @@ <properties> <maximumSize width="-1" height="-1"/> <minimumSize width="-1" height="-1"/> - <preferredSize width="1200" height="700"/> + <preferredSize width="1200" height="600"/> </properties> <border type="none"/> <children> @@ -185,7 +185,7 @@ <text value="Send Message To:"/> </properties> </component> - <component id="cc35d" class="javax.swing.JComboBox" binding="sentMessageToComboBox"> + <component id="cc35d" class="javax.swing.JComboBox" binding="sendMessageToComboBox"> <constraints> <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/> </constraints> diff --git a/src/GUI/ChatScreen.java b/src/GUI/ChatScreen.java index 0c43cd56aa801ee4e5c3f6b6c891e93f1c4a53cd..e786ca18065ea79e944442d121d84a902ba664cf 100644 --- a/src/GUI/ChatScreen.java +++ b/src/GUI/ChatScreen.java @@ -15,7 +15,7 @@ public class ChatScreen { private JButton sendButton; private JPanel drawingPanel; private JPanel othersPanel; - private JComboBox sentMessageToComboBox; + private JComboBox sendMessageToComboBox; private JTextArea chatDisplayBox; private JComboBox userSelectComboBox; private JButton kickOutButton; @@ -33,30 +33,38 @@ public class ChatScreen { private JButton quitButton; private JFrame frame; - public Client getClient() { - return client; - } - - public Client client; + private Client client; public ChatScreen(Client client) { this.client = client; - exitThisRoomButton.addActionListener(actionListener); - sendButton.addActionListener(actionListener); yourNameDisplay.setText(client.getUserName()); - drawingPanel = new PaintGUI(client); - } +// sentMessageToComboBox.addItem(client.getUserName()); + quitButton.addActionListener(actionListener); + sendButton.addActionListener(actionListener); + frame = new JFrame("Application"); + frame.setContentPane(panel2); + createUIComponents(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setResizable(false); + frame.setVisible(true); + SwingUtilities.getRootPane(sendButton).setDefaultButton(sendButton); + } + private void createUIComponents() { + drawingPanel = new PaintGUI(client).getGlobal(); + } public JTextArea getChatDisplayBox() { return chatDisplayBox; } - public JComboBox getSentMessageToComboBox() { - return sentMessageToComboBox; + public JComboBox getSendMessageToComboBox() + { + return sendMessageToComboBox; } public JPanel getDrawingPanel() { @@ -75,7 +83,17 @@ public class ChatScreen { try { System.out.println("Send button pressed"); - chatController.broadcastMessage(client.getUserName(), message); + + String toUser = sendMessageToComboBox.getSelectedItem().toString(); + + if( toUser.equals("All") ) + { + chatController.broadcastMessage(client.getUserName(), message); + } + else + { + chatController.sendPrivateMessage(client.getUserName(), toUser, message); + } } catch (RemoteException ex) { @@ -99,20 +117,4 @@ public class ChatScreen { } }; - - public void showGUI() { - frame = new JFrame("Application"); - JFrame.setDefaultLookAndFeelDecorated(true); - frame.setContentPane(panel2); - createUIComponents(); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.pack(); - frame.setResizable(false); - frame.setVisible(true); - } - - private void createUIComponents() { -// PaintGUI paintGUI = new PaintGUI(client); - drawingPanel = new PaintGUI(client).getGlobal(); - } } diff --git a/src/client/ChatUpdate.java b/src/client/ChatUpdate.java index 986f6a70224f04c9516b4c0813cd90305cf79f4b..ea4baf8749f7885125bb1027a2f2b6263cfdfff3 100644 --- a/src/client/ChatUpdate.java +++ b/src/client/ChatUpdate.java @@ -17,12 +17,23 @@ public class ChatUpdate extends UnicastRemoteObject implements IChatUpdate, Seri } @Override - public boolean notifyChat(String fromClient, String message) throws RemoteException + public boolean notifyChat(String fromClient, String message, boolean isPrivate) throws RemoteException { - client.getChatScreen().getChatDisplayBox().append(fromClient + ": " + message + "\n"); + String outputString; + + if( isPrivate ) + { + outputString = "PRIVATE (from " + fromClient + "): " + message + "\n"; + } + else + { + outputString = fromClient + ": " + message + "\n"; + } + + client.getChatScreen().getChatDisplayBox().append(outputString); //client.setReceivedMessage(message); - System.out.println(fromClient + ": " + message); + //System.out.println(fromClient + ": " + message); return true; } diff --git a/src/client/Client.java b/src/client/Client.java index ef1939cbdd44061af06cfc932cf65f3a89b26ce2..b5c34ee2fb7f85c513dac93d4208a17c0d12623a 100644 --- a/src/client/Client.java +++ b/src/client/Client.java @@ -19,16 +19,23 @@ public class Client private Registry registryServer; private IChatController chatController; private IClientController clientController; + private IDrawingController drawingController; private ClientUpdate clientUpdate; + private ChatUpdate chatUpdate; private DrawingUpdate drawingUpdate; - private StartScreen startScreen; + private ChatScreen chatScreen; private PaintGUI paintGUI; + private String receivedMessage; + + private String[] connectedUsers; + + public PaintGUI getPaintGUI() { return paintGUI; } @@ -39,6 +46,12 @@ public class Client return chatScreen; } + public void setConnectedUsers(String[] users) + { + this.connectedUsers = users; + } + + public IChatController getChatController() { return chatController; @@ -72,9 +85,9 @@ public class Client this.clientUpdate = new ClientUpdate(this); this.chatUpdate = new ChatUpdate(this); this.drawingUpdate = new DrawingUpdate(this); -// this.startScreen = new StartScreen(this); + this.startScreen = new StartScreen(this); this.chatScreen = new ChatScreen(this); -// this.paintGUI = new PaintGUI(this); + this.paintGUI = new PaintGUI(this); } public static void main(String[] args) @@ -83,7 +96,7 @@ public class Client { Client client = new Client(args[0]); client.connect(); - client.chatScreen.showGUI(); +// client.startScreen.go(); // client.getPaintGUI().showGUI(); } catch (Exception e) @@ -92,6 +105,22 @@ public class Client } } +// public void doSomething() +// { +//// new ChatScreen(); +// +// try +// { +// new ChatScreen(this); +// System.out.println("Sleeping..."); +// TimeUnit.MINUTES.sleep(5); +// } +// catch(Exception e) +// { +// e.printStackTrace(); +// } +// } + public boolean connect() { try @@ -102,7 +131,7 @@ public class Client clientController = (IClientController) registryServer.lookup("ClientController"); drawingController = (IDrawingController) registryServer.lookup("DrawingController"); - if (clientController.join(userName, this.chatUpdate, this.drawingUpdate, this.clientUpdate)) + if (clientController.join(userName, this.chatUpdate, this.clientUpdate, this.drawingUpdate)) { System.out.println("Connected to server"); @@ -116,4 +145,14 @@ public class Client return false; } + + public String getReceivedMessage() + { + return receivedMessage; + } + + public void setReceivedMessage(String receivedMessage) + { + this.receivedMessage = receivedMessage; + } } \ No newline at end of file diff --git a/src/client/ClientUpdate.java b/src/client/ClientUpdate.java index 4faa2723f8733cb457feb1c3c7696330b5e02b56..83967bc77631a406b91fd2c60dda30d076d7e279 100644 --- a/src/client/ClientUpdate.java +++ b/src/client/ClientUpdate.java @@ -2,7 +2,9 @@ package client; import remote.IClientUpdate; +import javax.swing.*; import java.io.Serializable; +import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; @@ -19,7 +21,29 @@ public class ClientUpdate extends UnicastRemoteObject implements IClientUpdate, @Override public boolean notifyClient(String fromClient, String newUsername) throws RemoteException { - client.getChatScreen().getSentMessageToComboBox().addItem(newUsername); + client.getChatScreen().getSendMessageToComboBox().addItem(newUsername); + + return true; + } + + @Override + public boolean updateUserList(String[] users) throws RemoteException + { + //client.setConnectedUsers(users); + + JComboBox userBox = client.getChatScreen().getSendMessageToComboBox(); + + userBox.removeAllItems(); + + userBox.addItem("All"); + + for( String s : users ) + { + if( !s.equals(client.getUserName()) ) + { + userBox.addItem(s); + } + } return true; } diff --git a/src/remote/IChatController.java b/src/remote/IChatController.java index 64e681194d8783b3a45feb132b84d11140fa78d0..82305870e4b5438637dc6b8759ce3235b6a02dd0 100644 --- a/src/remote/IChatController.java +++ b/src/remote/IChatController.java @@ -8,4 +8,5 @@ public interface IChatController extends Remote boolean broadcastMessage(String fromClient, String message) throws RemoteException; boolean broadcastMessageUserLogin(String fromClient) throws RemoteException; boolean broadcastMessageUserLogout(String fromClient) throws RemoteException; + boolean sendPrivateMessage(String fromClient, String toClient, String message) throws RemoteException; } diff --git a/src/remote/IChatUpdate.java b/src/remote/IChatUpdate.java index 55b2e62445fe0e9d455518d4cbe188adfcb89a9e..0c9b54d9daab6367372e1987f2c988a94bcbde8d 100644 --- a/src/remote/IChatUpdate.java +++ b/src/remote/IChatUpdate.java @@ -6,7 +6,7 @@ import java.rmi.RemoteException; public interface IChatUpdate extends Remote, Serializable { - boolean notifyChat(String fromClient, String message) throws RemoteException; + boolean notifyChat(String fromClient, String message, boolean isPrivate) throws RemoteException; boolean notifyUserLogin(String fromClient) throws RemoteException; boolean notifyUserLogout(String fromClient) throws RemoteException; } diff --git a/src/remote/IClientController.java b/src/remote/IClientController.java index 35539cdc112a8cd5f2e78eeeddf911a74e9abb88..bde0a0f500ed01f94c2485ba8de0bdea378d05d9 100644 --- a/src/remote/IClientController.java +++ b/src/remote/IClientController.java @@ -5,7 +5,7 @@ import java.rmi.RemoteException; public interface IClientController extends Remote { - boolean join(String username, IChatUpdate clientChat, IDrawingUpdate clientDrawing, IClientUpdate clientUpdate) throws RemoteException; + boolean join(String username, IChatUpdate clientChat, IClientUpdate clientUpdate, IDrawingUpdate clientDrawing) throws RemoteException; void quit(String username) throws RemoteException; diff --git a/src/remote/IClientUpdate.java b/src/remote/IClientUpdate.java index 9eb5bc90e58e864fdf182b29e871c410adf7f4fb..c1337f90f560c6b527bd067d7d5d2cf0d85ee234 100644 --- a/src/remote/IClientUpdate.java +++ b/src/remote/IClientUpdate.java @@ -7,4 +7,6 @@ import java.rmi.RemoteException; public interface IClientUpdate extends Remote, Serializable { boolean notifyClient(String fromClient, String newUsername) throws RemoteException; + + boolean updateUserList(String[] users) throws RemoteException; } diff --git a/src/server/ChatController.java b/src/server/ChatController.java index 79c344a9a50743c6dbeede8238f75b2ffb7ba579..8fbff1e4457c8c633893caad33f1ceeff7b6b49c 100644 --- a/src/server/ChatController.java +++ b/src/server/ChatController.java @@ -26,7 +26,7 @@ public class ChatController extends UnicastRemoteObject implements IChatControll for( User u : server.users ) { client = u.getIChatUpdate(); - client.notifyChat(fromClient, message); + client.notifyChat(fromClient, message, false); } System.out.print("...DONE\n"); @@ -69,4 +69,22 @@ public class ChatController extends UnicastRemoteObject implements IChatControll return true; } + + @Override + public boolean sendPrivateMessage(String fromClient, String toClient, String message) throws RemoteException + { + int toClientIndex = server.clientController.getUserIndex(toClient); + int fromClientIndex = server.clientController.getUserIndex(fromClient); + + if( toClientIndex >= 0 && fromClientIndex >= 0 ) + { + server.users.get(toClientIndex).getIChatUpdate().notifyChat(fromClient, message, true); + + server.users.get(fromClientIndex).getIChatUpdate().notifyChat(fromClient, message, true); + + return true; + } + + return false; + } } diff --git a/src/server/ClientController.java b/src/server/ClientController.java index 267c0cb3961c90419ef9970d7b2a192e812d8627..bcfd261f7da172aca929a6a4f291b39c277fb2b1 100644 --- a/src/server/ClientController.java +++ b/src/server/ClientController.java @@ -1,11 +1,12 @@ package server; import remote.IChatUpdate; +import remote.IClientController; import remote.IClientUpdate; import remote.IDrawingUpdate; -import remote.IClientController; import java.io.Serializable; +import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; @@ -19,11 +20,11 @@ public class ClientController extends UnicastRemoteObject implements IClientCont } @Override - public boolean join(String username, IChatUpdate clientChat, IDrawingUpdate clientDrawing, IClientUpdate clientUpdate) throws RemoteException + public boolean join(String username, IChatUpdate clientChat, IClientUpdate clientUpdate, IDrawingUpdate clientDrawing) throws RemoteException { server.chatController.broadcastMessageUserLogin(username); - User newUser = new User(username, clientChat, clientDrawing, clientUpdate); + User newUser = new User(username, clientChat, clientUpdate, clientDrawing); server.users.add(newUser); @@ -34,6 +35,8 @@ public class ClientController extends UnicastRemoteObject implements IClientCont System.out.println(username + " registered successfully"); + broadcastUserList(); + return true; } @@ -47,6 +50,8 @@ public class ClientController extends UnicastRemoteObject implements IClientCont server.users.remove(userIndex); server.chatController.broadcastMessageUserLogout(username); + + broadcastUserList(); } } @@ -75,13 +80,16 @@ public class ClientController extends UnicastRemoteObject implements IClientCont if ( adminIndex > 0 && userIndex > 0 && server.users.get(adminIndex).isAdmin() ) { server.users.remove(userIndex); + + broadcastUserList(); + return true; } return false; } - private int getUserIndex(String username) + public int getUserIndex(String username) { int index = -1; @@ -96,4 +104,19 @@ public class ClientController extends UnicastRemoteObject implements IClientCont return index; } + + private void broadcastUserList() throws RemoteException + { + String[] connectedUsers = new String[server.users.size()]; + + for( int i = 0; i<server.users.size(); i++ ) + { + connectedUsers[i] = server.users.get(i).getUserName(); + } + + for( User u : server.users ) + { + u.getIClientUpdate().updateUserList(connectedUsers); + } + } } diff --git a/src/server/User.java b/src/server/User.java index 7211122586603d7709f0861a89f8c6c0e5becd92..543f26e6c9056a69b382ae8dc4819d4116e95559 100644 --- a/src/server/User.java +++ b/src/server/User.java @@ -12,7 +12,7 @@ public class User private IClientUpdate IClientUpdate; private boolean isAdmin; - public User(String username, IChatUpdate IChatUpdate, IDrawingUpdate IDrawingUpdate, IClientUpdate IClientUpdate) + public User(String username, IChatUpdate IChatUpdate, IClientUpdate IClientUpdate, IDrawingUpdate IDrawingUpdate) { this.username = username; this.IChatUpdate = IChatUpdate;