Commit ad3cc7f1 authored by guus's avatar guus

Workaround for OF-23 - send presence error stanzas to all resources of the original sender.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11568 b35dd754-fafc-0310-a699-88a17e54d16e
parent 304c2ed5
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
package org.jivesoftware.openfire.server; package org.jivesoftware.openfire.server;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
...@@ -297,13 +299,24 @@ public class OutgoingSessionPromise implements RoutableChannelHandler { ...@@ -297,13 +299,24 @@ public class OutgoingSessionPromise implements RoutableChannelHandler {
routingTable.routePacket(reply.getTo(), reply, true); routingTable.routePacket(reply.getTo(), reply, true);
} }
else if (packet instanceof Presence) { else if (packet instanceof Presence) {
// workaround for OF-23. "undo" the 'setFrom' to a bare JID
// by sending the error to all available resources.
final List<JID> routes = new ArrayList<JID>();
if (to.getResource() == null) {
routes.addAll(routingTable.getRoutes(to, null));
} else {
routes.add(to);
}
for (JID route : routes) {
Presence reply = new Presence(); Presence reply = new Presence();
reply.setID(packet.getID()); reply.setID(packet.getID());
reply.setTo(from); reply.setTo(from);
reply.setFrom(to); reply.setFrom(route);
reply.setError(PacketError.Condition.remote_server_not_found); reply.setError(PacketError.Condition.remote_server_not_found);
routingTable.routePacket(reply.getTo(), reply, true); routingTable.routePacket(reply.getTo(), reply, true);
} }
}
else if (packet instanceof Message) { else if (packet instanceof Message) {
Message reply = new Message(); Message reply = new Message();
reply.setID(packet.getID()); reply.setID(packet.getID());
......
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