Commit 4dbf311e authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Do not store messages sent by the MUC service. JM-467

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3112 b35dd754-fafc-0310-a699-88a17e54d16e
parent c61bcf9c
/** /**
* $RCSfile$ * $RCSfile: OfflineMessageStrategy.java,v $
* $Revision$ * $Revision$
* $Date$ * $Date$
* *
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
package org.jivesoftware.messenger; package org.jivesoftware.messenger;
import org.jivesoftware.messenger.container.BasicModule; import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.muc.MultiUserChatServer;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
...@@ -31,6 +32,7 @@ public class OfflineMessageStrategy extends BasicModule { ...@@ -31,6 +32,7 @@ public class OfflineMessageStrategy extends BasicModule {
private OfflineMessageStore messageStore; private OfflineMessageStore messageStore;
private JID serverAddress; private JID serverAddress;
private PacketRouter router; private PacketRouter router;
private String mucServiceDomain;
public OfflineMessageStrategy() { public OfflineMessageStrategy() {
super("Offline Message Strategy"); super("Offline Message Strategy");
...@@ -60,8 +62,15 @@ public class OfflineMessageStrategy extends BasicModule { ...@@ -60,8 +62,15 @@ public class OfflineMessageStrategy extends BasicModule {
public void storeOffline(Message message) { public void storeOffline(Message message) {
if (message != null) { if (message != null) {
// Do nothing if the message was sent to the server itself or to an anonymous user // Do nothing if the message was sent to the server itself or to an anonymous user
if (message.getTo() == null || serverAddress.equals(message.getTo()) || JID recipientJID = message.getTo();
message.getTo().getNode() == null) { if (recipientJID == null || serverAddress.equals(recipientJID) ||
recipientJID.getNode() == null) {
return;
}
// Ignore packets sent from the MUC service
// TODO Remove this code when JEP-79 is implemented and MUC packets include the drop action
JID senderJID = message.getFrom();
if (senderJID != null && mucServiceDomain.equals(senderJID.getDomain())) {
return; return;
} }
...@@ -119,6 +128,7 @@ public class OfflineMessageStrategy extends BasicModule { ...@@ -119,6 +128,7 @@ public class OfflineMessageStrategy extends BasicModule {
super.initialize(server); super.initialize(server);
messageStore = server.getOfflineMessageStore(); messageStore = server.getOfflineMessageStore();
router = server.getPacketRouter(); router = server.getPacketRouter();
mucServiceDomain = server.getMultiUserChatServer().getServiceDomain();
serverAddress = new JID(server.getServerInfo().getName()); serverAddress = new JID(server.getServerInfo().getName());
String quota = JiveGlobals.getProperty("xmpp.offline.quota"); String quota = JiveGlobals.getProperty("xmpp.offline.quota");
......
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