From 9f9511971c3693ab324f2c43d309727f4e7df8b5 Mon Sep 17 00:00:00 2001 From: Dele Olajide Date: Wed, 20 Dec 2023 18:57:42 +0000 Subject: [PATCH] fix #4 - llama user to join chat room not working --- changelog.html | 1 + src/java/org/ifsoft/llama/openfire/LLaMA.java | 2 +- .../org/ifsoft/llama/openfire/LLaMAConnection.java | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/changelog.html b/changelog.html index abac419..45cffcc 100644 --- a/changelog.html +++ b/changelog.html @@ -46,6 +46,7 @@

0.0.2 -- December 31, 2023

diff --git a/src/java/org/ifsoft/llama/openfire/LLaMA.java b/src/java/org/ifsoft/llama/openfire/LLaMA.java index efd2633..3d3d5df 100644 --- a/src/java/org/ifsoft/llama/openfire/LLaMA.java +++ b/src/java/org/ifsoft/llama/openfire/LLaMA.java @@ -447,7 +447,7 @@ public void messageReceived(JID roomJID, JID user, String nickname, Message mess Thread.sleep(1000); } - llamaConnection.handlePrediction(body, roomJID, message.getType()); + //llamaConnection.handlePrediction(body, roomJID, message.getType()); } } catch (Exception e) { Log.error("unable to handle groupchat message", e); diff --git a/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java b/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java index 91116af..db0e1f3 100644 --- a/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java +++ b/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java @@ -261,7 +261,19 @@ public void deliver(Packet packet) throws UnauthorizedException { if (!isNull(msg) && !isNull(from) /*&& SessionManager.getInstance().getSessions(from).size() > 0*/) { - handlePrediction(msg, packet.getFrom(), message.getType()); + JID requestor = packet.getFrom(); + + if (message.getType() == Message.Type.groupchat) { + final String llamaUser = JiveGlobals.getProperty("llama.username", "llama"); + + if (msg.toLowerCase().startsWith(llamaUser.toLowerCase())) { + requestor = new JID(packet.getFrom().toBareJID()); + handlePrediction(msg, requestor, message.getType()); + } + + } else { + handlePrediction(msg, requestor, message.getType()); + } } } }