Commit a838d46e authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Optimization: Do not copy message if history is disabled. JM-480

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3157 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5dab4a3a
......@@ -181,6 +181,14 @@ public class HistoryStrategy {
}
}
boolean isHistoryEnabled() {
Type strategyType = type;
if (type == Type.defaulType && parent != null) {
strategyType = parent.getType();
}
return strategyType != HistoryStrategy.Type.none;
}
/**
* Obtain the current history as an iterator of messages to play back to a new room member.
*
......
/**
* $RCSfile$
* $RCSfile: MUCRoomHistory.java,v $
* $Revision$
* $Date$
*
......@@ -53,9 +53,14 @@ public final class MUCRoomHistory {
packet.getSubject() == null) {
return;
}
Message packetToAdd = (Message) packet.createCopy();
// Do not store messages is strategy is none and message is not changing the room subject
if (!historyStrategy.isHistoryEnabled()) {
if (packet.getSubject() == null || packet.getSubject().trim().length() == 0) {
return;
}
}
// TODO Analyze concurrency (on the LinkList) when adding many messages simultaneously
Message packetToAdd = (Message) packet.createCopy();
// Check if the room has changed its configuration
if (isNonAnonymousRoom != room.canAnyoneDiscoverJID()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment