Commit 1673db76 authored by Armando Jagucki's avatar Armando Jagucki Committed by ajagucki

PEP: Generating Notifications - Service sends to all resources of subscriber...

PEP: Generating Notifications - Service sends to all resources of subscriber when subscribed with bare JID and the service has presence info for subscriber.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches@8860 b35dd754-fafc-0310-a699-88a17e54d16e
parent 275676ec
...@@ -315,7 +315,8 @@ public class PEPService implements PubSubService { ...@@ -315,7 +315,8 @@ public class PEPService implements PubSubService {
public void sendNotification(Node node, Message message, JID recipientJID) { public void sendNotification(Node node, Message message, JID recipientJID) {
message.setFrom(getAddress()); message.setFrom(getAddress());
message.setID(node.getNodeID() + "__" + recipientJID.toBareJID() + "__" + StringUtils.randomString(5));
// If this PEPService can retrieve presence information for the recipient, // If this PEPService can retrieve presence information for the recipient,
// collect all of their full JIDs and send the notification to each below. // collect all of their full JIDs and send the notification to each below.
Collection<JID> recipientFullJIDs = new ArrayList<JID>(); Collection<JID> recipientFullJIDs = new ArrayList<JID>();
...@@ -328,9 +329,13 @@ public class PEPService implements PubSubService { ...@@ -328,9 +329,13 @@ public class PEPService implements PubSubService {
recipientFullJIDs.add(recipientJID); recipientFullJIDs.add(recipientJID);
} }
message.setTo(recipientJID); if (recipientFullJIDs.isEmpty()) {
message.setID(node.getNodeID() + "__" + recipientJID.toBareJID() + "__" + StringUtils.randomString(5)); message.setTo(recipientJID);
router.route(message);
return;
}
for (JID recipientFullJID : recipientFullJIDs) { for (JID recipientFullJID : recipientFullJIDs) {
// Include an Extended Stanza Addressing "replyto" extension specifying the publishing // Include an Extended Stanza Addressing "replyto" extension specifying the publishing
// resource. However, only include the extension if the receiver has a presence subscription // resource. However, only include the extension if the receiver has a presence subscription
...@@ -387,8 +392,6 @@ public class PEPService implements PubSubService { ...@@ -387,8 +392,6 @@ public class PEPService implements PubSubService {
extendedMessage.setTo(recipientFullJID); extendedMessage.setTo(recipientFullJID);
router.route(extendedMessage); router.route(extendedMessage);
return;
} }
} }
catch (IndexOutOfBoundsException e) { catch (IndexOutOfBoundsException e) {
...@@ -401,7 +404,6 @@ public class PEPService implements PubSubService { ...@@ -401,7 +404,6 @@ public class PEPService implements PubSubService {
// Do not add addressing extension to message. // Do not add addressing extension to message.
} }
} }
router.route(message);
} }
public boolean isNodeCreationRestricted() { public boolean isNodeCreationRestricted() {
......
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