powered by Jive Software

Storing headlines sent when offline (JEP-160)

Many people disagree with JEP-160, which says that headline messages should not be stored offline. Therefore, I’'ve create a patch (below) for 3.3.2, that puts an option (off by default) to allow you to store them.

Can this patch be put into the next version please? Obviously, I’'ve not translated the message into non-English, and I apologise if my java/jsp is not brilliant, I rarely use it.

Cheers,

X.

— openfire_src.original/src/i18n/openfire_i18n_en.properties 2007-06-22 20:25:15.000000000 +0100

+++ openfire_src/src/i18n/openfire_i18n_en.properties 2007-07-09 13:05:06.000000000 +0100

@@ -947,6 +947,7 @@

offline.messages.drop_info=Store messages for a user up to the max storage size. After the max size has been \

exceeded, silently drop messages.

offline.messages.storage_limit=Per-user offline message storage limit:

+offline.messages.headline=Also store headline messages

offline.messages.choose_policy=Please choose a valid storage policy.

offline.messages.enter_store_size=Please enter a store size greater than 0 bytes.

offline.messages.bounce_option=Bounce

diff -Naur openfire_src.original/src/i18n/openfire_i18n_es.properties openfire_src/src/i18n/openfire_i18n_es.properties

— openfire_src.original/src/java/org/jivesoftware/openfire/OfflineMessageStrategy .java 2007-06-22 20:25:23.000000000 +0100

+++ openfire_src/src/java/org/jivesoftware/openfire/OfflineMessageStrategy.java 2007-07-09 15:13:22.000000000 +0100

@@ -31,6 +31,7 @@

*/

public class OfflineMessageStrategy extends BasicModule {

  • private static boolean includeHeadlines = false; // Don’'t store Headlines by default (JEP-160)

private static int quota = 100*1024; // Default to 100 K.

private static Type type = Type.store_and_bounce;

@@ -53,6 +54,15 @@

JiveGlobals.setProperty(“xmpp.offline.quota”, Integer.toString(quota));

}

  • public boolean getIncludeHeadlines() {

  •    return includeHeadlines;
    
  • }

  • public void setIncludeHeadlines(boolean includeHeadlines) {

  •    OfflineMessageStrategy.includeHeadlines = includeHeadlines;
    
  •    JiveGlobals.setProperty("xmpp.offline.includeheadlines", Boolean.toString(includeHeadlines));
    
  • }

public OfflineMessageStrategy.Type getType() {

return type;

}

@@ -77,7 +87,7 @@

// Do not store messages of type groupchat, error or headline as specified in JEP-160

if (Message.Type.groupchat == message.getType() ||

Message.Type.error == message.getType() ||

  •                Message.Type.headline == message.getType()) {
    
  •                (Message.Type.headline == message.getType() && !includeHeadlines)) {
    

return;

}

// Do not store messages if communication is blocked

@@ -184,6 +194,7 @@

if (type != null && type.length() > 0) {

OfflineMessageStrategy.type = Type.valueOf(type);

}

  •    OfflineMessageStrategy.includeHeadlines = JiveGlobals.getBooleanProperty("xmpp.offline.includeheadlines", false);
    

}

/**

— openfire_src.original/src/web/offline-messages.jsp 2007-06-22 20:25:15.000000000 +0100

+++ openfire_src/src/web/offline-messages.jsp 2007-07-09 12:43:51.000000000 +0100

@@ -49,6 +49,7 @@

int strategy = ParamUtils.getIntParameter(request,“strategy”,-1);

int storeStrategy = ParamUtils.getIntParameter(request,“storeStrategy”,-1);

double quota = ParamUtils.getDoubleParameter(request,“quota”, manager.getQuota()/1024);

  • boolean includeHeadlines = request.getParameter(“includeHeadlines”) != null;

DecimalFormat format = new DecimalFormat("#0.00");

// Update the session kick policy if requested

@@ -89,6 +90,7 @@

else /* (storeStrategy == ALWAYS_STORE) */ {

manager.setType(OfflineMessageStrategy.Type.store);

}

  •            manager.setIncludeHeadlines(includeHeadlines);
    

}

else {

if (strategy == BOUNCE) {

@@ -138,6 +140,8 @@

if (quota