powered by Jive Software

Group Chat History contains one message to many

When specifying “Show a Specific Number of Messages” for Group Chat History Settings, the user get one message to many. For example, if 10 is specified. the user get the last eleven messages in the room.

A glance at the code showed that the bug is easily fixed:

--- a/src/java/org/jivesoftware/openfire/muc/HistoryStrategy.java
+++ b/src/java/org/jivesoftware/openfire/muc/HistoryStrategy.java
@@ -197,7 +197,7 @@ public class HistoryStrategy {
                 // message because we want to preserve the room subject if
                 // possible.
                 Iterator<Message> historyIter = history.iterator();
-                while (historyIter.hasNext() && history.size() > strategyMaxNumber) {
+                while (historyIter.hasNext() && history.size() >= strategyMaxNumber) {
                     if (historyIter.next() != roomSubject) {

If you are familiar with GitHub, you can provide a pull request for this at https://github.com/igniterealtime/Openfire

Already did it. But you have seen this too.