diff --git a/src/main/java/envoy/client/Client.java b/src/main/java/envoy/client/Client.java index 51ee5c0..c87d616 100644 --- a/src/main/java/envoy/client/Client.java +++ b/src/main/java/envoy/client/Client.java @@ -148,4 +148,14 @@ public class Client { client.close(); return users.getUser().get(0); } + + /** + * Returns the user ID. + * @return userID + * @since Envoy 0.1 + */ + public long getSenderID() { + return user.getID(); + + } } \ No newline at end of file diff --git a/src/main/java/envoy/client/ui/ChatWindow.java b/src/main/java/envoy/client/ui/ChatWindow.java index 8f71776..0d20f74 100644 --- a/src/main/java/envoy/client/ui/ChatWindow.java +++ b/src/main/java/envoy/client/ui/ChatWindow.java @@ -138,7 +138,7 @@ public class ChatWindow extends JFrame { // TODO: Acquire proper sender id if (!messageEnterTextfield.getText().isEmpty() && recipientID != 0) try { - final Message message = client.createMessage(1, recipientID, messageEnterTextfield.getText()); + final Message message = client.createMessage(client.getSenderID(), recipientID, messageEnterTextfield.getText()); client.sendMessage(message); appendMessageToChat(message); messageEnterTextfield.setText("");