Commit 801833fe authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Route presences between components. JM-1123

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9164 b35dd754-fafc-0310-a699-88a17e54d16e
parent 9127aa74
...@@ -99,6 +99,7 @@ public class PresenceRouter extends BasicModule { ...@@ -99,6 +99,7 @@ public class PresenceRouter extends BasicModule {
private void handle(Presence packet) { private void handle(Presence packet) {
JID recipientJID = packet.getTo(); JID recipientJID = packet.getTo();
JID senderJID = packet.getFrom();
// Check if the packet was sent to the server hostname // Check if the packet was sent to the server hostname
if (recipientJID != null && recipientJID.getNode() == null && if (recipientJID != null && recipientJID.getNode() == null &&
recipientJID.getResource() == null && serverName.equals(recipientJID.getDomain())) { recipientJID.getResource() == null && serverName.equals(recipientJID.getDomain())) {
...@@ -110,6 +111,14 @@ public class PresenceRouter extends BasicModule { ...@@ -110,6 +111,14 @@ public class PresenceRouter extends BasicModule {
} }
} }
try { try {
// Presences sent between components are just routed to the component
if (recipientJID != null && !XMPPServer.getInstance().isLocal(recipientJID) &&
!XMPPServer.getInstance().isLocal(senderJID)) {
// Route the packet
routingTable.routePacket(recipientJID, packet, false);
return;
}
Presence.Type type = packet.getType(); Presence.Type type = packet.getType();
// Presence updates (null is 'available') // Presence updates (null is 'available')
if (type == null || Presence.Type.unavailable == type) { if (type == null || Presence.Type.unavailable == type) {
...@@ -121,9 +130,9 @@ public class PresenceRouter extends BasicModule { ...@@ -121,9 +130,9 @@ public class PresenceRouter extends BasicModule {
updateHandler.process(packet); updateHandler.process(packet);
} }
else { else {
JID senderJID = packet.getFrom(); // Trigger events for presences of remote users
// Manage remote presence event dispatching if (senderJID != null && !serverName.equals(senderJID.getDomain()) &&
if (senderJID != null && !serverName.equals(senderJID.getDomain())) { !routingTable.hasComponentRoute(senderJID)) {
if (type == null) { if (type == null) {
// Remote user has become available // Remote user has become available
RemotePresenceEventDispatcher.remoteUserAvailable(packet); RemotePresenceEventDispatcher.remoteUserAvailable(packet);
......
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