Openfire (ARCHIVED)

Prevent empty-bodied messages from being stored in the offline message store.

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 3.6.0
  • Component/s: Core
  • Labels:
    None
  • Acceptance Test - Add?:
    No

Description

The offline message store will save every non-null Message object that it receives. This could include messages that do not have a body. Typical examples of these could be chat-state notification messages.

These messages should not be persisted in the offline message store, but ignored instead.

Activity

Hide
Guus der Kinderen added a comment -

This should fix the problem:

Index: src/java/org/jivesoftware/openfire/OfflineMessageStore.java
===================================================================
--- src/java/org/jivesoftware/openfire/OfflineMessageStore.java    (revision 10694)
+++ src/java/org/jivesoftware/openfire/OfflineMessageStore.java    (working copy)
@@ -107,6 +107,10 @@
         if (message == null) {
             return;
         }
+        if (message.getBody() == null || message.getBody().length() == 0) {
+            // ignore empty bodied message (typically chat-state notifications).
+            return;
+        }
         JID recipient = message.getTo();
         String username = recipient.getNode();
         // If the username is null (such as when an anonymous user), don't store.
Show
Guus der Kinderen added a comment - This should fix the problem:
Index: src/java/org/jivesoftware/openfire/OfflineMessageStore.java
===================================================================
--- src/java/org/jivesoftware/openfire/OfflineMessageStore.java    (revision 10694)
+++ src/java/org/jivesoftware/openfire/OfflineMessageStore.java    (working copy)
@@ -107,6 +107,10 @@
         if (message == null) {
             return;
         }
+        if (message.getBody() == null || message.getBody().length() == 0) {
+            // ignore empty bodied message (typically chat-state notifications).
+            return;
+        }
         JID recipient = message.getTo();
         String username = recipient.getNode();
         // If the username is null (such as when an anonymous user), don't store.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: