From f36d14e7e639dd2facf9700ffa15b8b16bd7771d Mon Sep 17 00:00:00 2001 From: Dele Olajide Date: Tue, 22 Oct 2024 10:40:35 +0100 Subject: [PATCH] fix bug with IQ prompts --- .../llama/openfire/LLaMAConnection.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java b/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java index f31a08b..f95c2a0 100644 --- a/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java +++ b/src/java/org/ifsoft/llama/openfire/LLaMAConnection.java @@ -408,10 +408,13 @@ private String getJson(String urlToRead, JSONObject data, JID requestor, Message Log.info("getJson - chat\n" + msg); result = new StringBuilder(); - if (requestor != null && !isNull(msg)) { - replyChat(msg, requestor, chatType); + if (!isNull(msg)) { accumulator = accumulator + msg; - } + + if (requestor != null && !isNull(msg)) { + replyChat(msg, requestor, chatType); + } + } } else { @@ -423,11 +426,14 @@ private String getJson(String urlToRead, JSONObject data, JID requestor, Message } } else { // end of text stream String msg = result.toString(); - Log.info("getJson - chat\n" + msg); + Log.info("getJson - final chat\n" + msg); - if (requestor != null) { - replyChat(msg, requestor, chatType); - accumulator = accumulator + msg; + if (!isNull(msg)) { + accumulator = accumulator + msg; + + if (requestor != null) { + replyChat(msg, requestor, chatType); + } } } }