From b9157ca9923f48a33755d3abb08e544b7633d48d Mon Sep 17 00:00:00 2001 From: Maxi Date: Sat, 12 Oct 2019 17:35:58 +0200 Subject: [PATCH] Added the setting of the senderID in the xml. --- src/main/java/envoy/client/Client.java | 10 ++++++++++ src/main/java/envoy/client/ui/ChatWindow.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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("");