Commit 32a1c171 authored by Tom Evans's avatar Tom Evans

OF-857: Incorporate review feedback

- Use !equals() rather than != for JID comparison
- Ignore carbons for the offline delivery mechanism
parent 9205a2f1
......@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID;
import org.xmpp.packet.Message;
import org.xmpp.packet.PacketError;
import org.xmpp.packet.PacketExtension;
/**
* Controls what is done with offline messages.
......@@ -80,9 +81,11 @@ public class OfflineMessageStrategy extends BasicModule {
public void storeOffline(Message message) {
if (message != null) {
// Do nothing if the message was sent to the server itself, an anonymous user or a non-existent user
// Also ignore message carbons
JID recipientJID = message.getTo();
if (recipientJID == null || serverAddress.equals(recipientJID) ||
recipientJID.getNode() == null ||
message.getExtension("received", "urn:xmpp:carbons:2") != null ||
!UserManager.getInstance().isRegisteredUser(recipientJID.getNode())) {
return;
}
......
......@@ -641,7 +641,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener
JID searchJID = new JID(originatingResource.getNode(), originatingResource.getDomain(), null);
List<JID> addresses = routingTable.getRoutes(searchJID, null);
for (JID address : addresses) {
if (originatingResource != address) {
if (!originatingResource.equals(address)) {
// Send the presence of the session whose presence has changed to
// this user's other session(s)
presence.setTo(address);
......
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