Commit e844d358 authored by guus's avatar guus

Things will be messed up when not having a 'to' address. Creating a deep-copy...

Things will be messed up when not having a 'to' address. Creating a deep-copy packet that'll include one (OF-462).

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@12531 b35dd754-fafc-0310-a699-88a17e54d16e
parent c9279150
...@@ -329,9 +329,11 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -329,9 +329,11 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
final JID senderJID = packet.getFrom(); final JID senderJID = packet.getFrom();
if (packet.getTo() == null) { if (packet.getTo() == null) {
// packet addressed to service itself (not to a node/user) // packet addressed to service itself (not to a node/user)
final String jidFrom = senderJID.toBareJID();
packet = packet.createCopy();
packet.setTo(jidFrom);
if (packet.getType() == IQ.Type.set) { if (packet.getType() == IQ.Type.set) {
final String jidFrom = senderJID.toBareJID();
PEPService pepService = pepServiceManager.getPEPService(jidFrom); PEPService pepService = pepServiceManager.getPEPService(jidFrom);
// If no service exists yet for jidFrom, create one. // If no service exists yet for jidFrom, create one.
...@@ -394,21 +396,17 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -394,21 +396,17 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
// Process with PubSub as usual. // Process with PubSub as usual.
pepServiceManager.process(pepService, packet); pepServiceManager.process(pepService, packet);
} else if (packet.getType() == IQ.Type.get) { } else if (packet.getType() == IQ.Type.get) {
final String jidFrom = senderJID.toBareJID();
final PEPService pepService = pepServiceManager.getPEPService(jidFrom); final PEPService pepService = pepServiceManager.getPEPService(jidFrom);
final IQ deepCopy = packet.createCopy();
deepCopy.setTo(jidFrom);
if (pepService != null) { if (pepService != null) {
pepServiceManager.process(pepService, deepCopy); pepServiceManager.process(pepService, packet);
} else { } else {
// Process with PubSub using a dummyService. In the case where an IQ packet is sent to // Process with PubSub using a dummyService. In the case where an IQ packet is sent to
// a user who does not have a PEP service, we wish to utilize the error reporting flow // a user who does not have a PEP service, we wish to utilize the error reporting flow
// already present in the PubSubEngine. This gives the illusion that every user has a // already present in the PubSubEngine. This gives the illusion that every user has a
// PEP service, as required by the specification. // PEP service, as required by the specification.
PEPService dummyService = new PEPService(XMPPServer.getInstance(), senderJID.toBareJID()); PEPService dummyService = new PEPService(XMPPServer.getInstance(), senderJID.toBareJID());
pepServiceManager.process(dummyService, deepCopy); pepServiceManager.process(dummyService, 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