Commit e3dc7f3f authored by Armando Jagucki's avatar Armando Jagucki Committed by ajagucki

Rearranged some methods in PEP related classes.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches@8955 b35dd754-fafc-0310-a699-88a17e54d16e
parent bead2b24
...@@ -92,7 +92,8 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -92,7 +92,8 @@ import java.util.concurrent.ConcurrentHashMap;
* *
*/ */
public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ServerFeaturesProvider, public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ServerFeaturesProvider,
UserIdentitiesProvider, UserItemsProvider, PresenceEventListener, RosterEventListener, PacketInterceptor { UserIdentitiesProvider, UserItemsProvider, PresenceEventListener, RosterEventListener,
PacketInterceptor {
/** /**
* Map of PEP services. Table, Key: bare JID (String); Value: PEPService * Map of PEP services. Table, Key: bare JID (String); Value: PEPService
...@@ -135,7 +136,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -135,7 +136,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
// Listen to presence events to manage PEP auto-subscriptions. // Listen to presence events to manage PEP auto-subscriptions.
PresenceEventDispatcher.addListener(this); PresenceEventDispatcher.addListener(this);
// Listen to roster events for PEP subscription cancelling on contact deletion. // Listen to roster events for PEP subscription cancelling on contact deletion.
RosterEventDispatcher.addListener(this); RosterEventDispatcher.addListener(this);
...@@ -210,10 +211,26 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -210,10 +211,26 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
return info; return info;
} }
/**
* Returns the filteredNodesMap.
*
* @return the filteredNodesMap
*/
public Map<String, Set<String>> getFilteredNodesMap() {
return filteredNodesMap;
}
/**
* Returns the knownRemotePresences map.
*
* @return the knownRemotePresences map
*/
public Map<String, Set<JID>> getKnownRemotePresenes() {
return knownRemotePresences;
}
@Override @Override
public IQ handleIQ(IQ packet) throws UnauthorizedException { public IQ handleIQ(IQ packet) throws UnauthorizedException {
// TODO: Finish implementing ... ;)
if (packet.getTo() == null && packet.getType() == IQ.Type.set) { if (packet.getTo() == null && packet.getType() == IQ.Type.set) {
String jidFrom = packet.getFrom().toBareJID(); String jidFrom = packet.getFrom().toBareJID();
...@@ -260,7 +277,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -260,7 +277,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
Element publishElement = childElement.element("publish"); Element publishElement = childElement.element("publish");
if (publishElement != null) { if (publishElement != null) {
String nodeID = publishElement.attributeValue("node"); String nodeID = publishElement.attributeValue("node");
// Do not allow User Avatar nodes to be created. // Do not allow User Avatar nodes to be created.
// TODO: Implement XEP-0084 // TODO: Implement XEP-0084
if (nodeID.startsWith("http://www.xmpp.org/extensions/xep-0084.html")) { if (nodeID.startsWith("http://www.xmpp.org/extensions/xep-0084.html")) {
...@@ -373,6 +390,34 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -373,6 +390,34 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
pubSubEngine.process(pepService, subscriptionPacket); pubSubEngine.process(pepService, subscriptionPacket);
} }
/**
* Cancels a subscription to a PEPService's root collection node.
*
* @param unsubscriber the JID of the subscriber whose subscription is being canceled.
* @param serviceOwner the JID of the owner of the PEP service for which the subscription is being canceled.
*/
private void cancelSubscriptionToPEPService(JID unsubscriber, JID serviceOwner) {
// Retrieve recipientJID's PEP service, if it exists.
PEPService pepService = pepServices.get(serviceOwner.toBareJID());
if (pepService == null) {
return;
}
// Cancel unsubscriberJID's subscription to recipientJID's PEP service, if it exists.
CollectionNode rootNode = pepService.getRootCollectionNode();
NodeSubscription nodeSubscription = rootNode.getSubscription(unsubscriber);
if (nodeSubscription != null) {
rootNode.cancelSubscription(nodeSubscription);
if (Log.isDebugEnabled()) {
Log.debug("PEP: " + unsubscriber + " subscription to " + serviceOwner + "'s PEP service was cancelled.");
}
}
else {
return;
}
}
/** /**
* Implements ServerIdentitiesProvider and UserIdentitiesProvider, adding * Implements ServerIdentitiesProvider and UserIdentitiesProvider, adding
* the PEP identity to the respective disco#info results. * the PEP identity to the respective disco#info results.
...@@ -445,44 +490,17 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -445,44 +490,17 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
} }
} }
} }
pepService.sendLastPublishedItem(subscriberJID); pepService.sendLastPublishedItem(subscriberJID);
} }
} }
public void unsubscribedToPresence(JID unsubscriberJID, JID recipientJID) { public void unsubscribedToPresence(JID unsubscriberJID, JID recipientJID) {
if (Log.isDebugEnabled()) { if (Log.isDebugEnabled()) {
Log.debug("PEP: " + unsubscriberJID + " unsubscribed from " + recipientJID + "'s presence."); Log.debug("PEP: " + unsubscriberJID + " unsubscribed from " + recipientJID + "'s presence.");
} }
// Retrieve recipientJID's PEP service, if it exists. cancelSubscriptionToPEPService(unsubscriberJID, recipientJID);
PEPService pepService = pepServices.get(recipientJID.toBareJID());
if (pepService == null) {
return;
}
// Cancel unsubscriberJID's subscription to recipientJID's PEP service, if it exists.
CollectionNode rootNode = pepService.getRootCollectionNode();
NodeSubscription nodeSubscription = rootNode.getSubscription(unsubscriberJID);
if (nodeSubscription != null) {
rootNode.cancelSubscription(nodeSubscription);
if (Log.isDebugEnabled()) {
Log.debug("PEP: " + unsubscriberJID + " subscription to " + recipientJID + "'s PEP service was cancelled.");
}
}
else {
return;
}
// In the case of both users being local, we must also cancel recipientJID's subscription
// to unsubscriberJID's PEP service, if it exists.
//unsubscribedToPresence(recipientJID, unsubscriberJID);
}
public void unavailableSession(ClientSession session, Presence presence) {
// Do nothing
} }
public void availableSession(ClientSession session, Presence presence) { public void availableSession(ClientSession session, Presence presence) {
...@@ -505,13 +523,15 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -505,13 +523,15 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
} }
public void presenceChanged(ClientSession session, Presence presence) { public void contactDeleted(Roster roster, RosterItem item) {
// Do nothing JID rosterOwner = XMPPServer.getInstance().createJID(roster.getUsername(), null);
JID deletedContact = item.getJid();
} if (Log.isDebugEnabled()) {
Log.debug("PEP: contactDeleted: rosterOwner is " + rosterOwner + " and deletedContact is" + deletedContact);
}
public void presencePriorityChanged(ClientSession session, Presence presence) { cancelSubscriptionToPEPService(deletedContact, rosterOwner);
// Do nothing
} }
...@@ -623,8 +643,8 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -623,8 +643,8 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
else if (incoming && processed && packet instanceof Presence) { else if (incoming && processed && packet instanceof Presence) {
// Cache newly-available presence resources for remote users (since the PresenceEventDispatcher // Cache newly-available presence resources for remote users (since the PresenceEventDispatcher
// methods are not called for remote presence events). // methods are not called for remote presence events).
JID jidFrom = packet.getFrom(); JID jidFrom = packet.getFrom();
JID jidTo = packet.getTo(); JID jidTo = packet.getTo();
if (!XMPPServer.getInstance().isLocal(jidFrom) && jidFrom != null && jidTo != null) { if (!XMPPServer.getInstance().isLocal(jidFrom) && jidFrom != null && jidTo != null) {
if (Log.isDebugEnabled()) { if (Log.isDebugEnabled()) {
...@@ -667,53 +687,40 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ...@@ -667,53 +687,40 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
} }
/** /**
* Returns the filteredNodesMap. * The following functions are unimplemented required interface methods.
*
* @return the filteredNodesMap
*/ */
public Map<String, Set<String>> getFilteredNodesMap() { public void unavailableSession(ClientSession session, Presence presence) {
return filteredNodesMap; // Do nothing
} }
/** public void presenceChanged(ClientSession session, Presence presence) {
* Returns the knownRemotePresences map. // Do nothing
*
* @return the knownRemotePresences map }
*/
public Map<String, Set<JID>> getKnownRemotePresenes() { public void presencePriorityChanged(ClientSession session, Presence presence) {
return knownRemotePresences; // Do nothing
} }
public boolean addingContact(Roster roster, RosterItem item, boolean persistent) { public boolean addingContact(Roster roster, RosterItem item, boolean persistent) {
// TODO Auto-generated method stub // Do nothing
return false; return false;
} }
public void contactAdded(Roster roster, RosterItem item) { public void contactAdded(Roster roster, RosterItem item) {
// TODO Auto-generated method stub // Do nothing
}
public void contactDeleted(Roster roster, RosterItem item) {
JID rosterOwner = XMPPServer.getInstance().createJID(roster.getUsername(), null);
JID deletedContact = item.getJid();
if (Log.isDebugEnabled()) {
Log.debug("PEP: contactDeleted: rosterOwner is " + rosterOwner + " and deletedContact is" + deletedContact);
}
// FIXME: Extract the code in the below method into its own method
unsubscribedToPresence(deletedContact, rosterOwner);
} }
public void contactUpdated(Roster roster, RosterItem item) { public void contactUpdated(Roster roster, RosterItem item) {
// TODO Auto-generated method stub // Do nothing
} }
public void rosterLoaded(Roster roster) { public void rosterLoaded(Roster roster) {
// TODO Auto-generated method stub // Do nothing
} }
} }
...@@ -139,12 +139,12 @@ public class PEPService implements PubSubService { ...@@ -139,12 +139,12 @@ public class PEPService implements PubSubService {
* items. * items.
*/ */
private Timer timer = new Timer("PEP service maintenance"); private Timer timer = new Timer("PEP service maintenance");
/** /**
* Date format to use for time stamps in delayed event notifications. * Date format to use for time stamps in delayed event notifications.
*/ */
private static final FastDateFormat fastDateFormat; private static final FastDateFormat fastDateFormat;
static { static {
fastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("UTC")); fastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("UTC"));
} }
...@@ -230,33 +230,8 @@ public class PEPService implements PubSubService { ...@@ -230,33 +230,8 @@ public class PEPService implements PubSubService {
nodes.put(node.getNodeID(), node); nodes.put(node.getNodeID(), node);
} }
public void broadcast(Node node, Message message, Collection<JID> jids) { public void removeNode(String nodeID) {
message.setFrom(getAddress()); nodes.remove(nodeID);
for (JID jid : jids) {
message.setTo(jid);
message.setID(node.getNodeID() + "__" + jid.toBareJID() + "__" + StringUtils.randomString(5));
router.route(message);
}
}
public boolean canCreateNode(JID creator) {
// Node creation is always allowed for sysadmin
if (isNodeCreationRestricted() && !isServiceAdmin(creator)) {
// The user is not allowed to create nodes
return false;
}
return true;
}
public JID getAddress() {
return new JID(serviceOwnerJID);
}
public DefaultNodeConfiguration getDefaultNodeConfiguration(boolean leafType) {
if (leafType) {
return leafDefaultConfiguration;
}
return collectionDefaultConfiguration;
} }
public Node getNode(String nodeID) { public Node getNode(String nodeID) {
...@@ -271,15 +246,56 @@ public class PEPService implements PubSubService { ...@@ -271,15 +246,56 @@ public class PEPService implements PubSubService {
return rootCollectionNode; return rootCollectionNode;
} }
public JID getAddress() {
return new JID(serviceOwnerJID);
}
public String getServiceID() { public String getServiceID() {
// The bare JID of the user is the service ID for PEP // The bare JID of the user is the service ID for PEP
return serviceOwnerJID; return serviceOwnerJID;
} }
public DefaultNodeConfiguration getDefaultNodeConfiguration(boolean leafType) {
if (leafType) {
return leafDefaultConfiguration;
}
return collectionDefaultConfiguration;
}
public Collection<String> getShowPresences(JID subscriber) { public Collection<String> getShowPresences(JID subscriber) {
return PubSubEngine.getShowPresences(this, subscriber); return PubSubEngine.getShowPresences(this, subscriber);
} }
public boolean canCreateNode(JID creator) {
// Node creation is always allowed for sysadmin
if (isNodeCreationRestricted() && !isServiceAdmin(creator)) {
// The user is not allowed to create nodes
return false;
}
return true;
}
/**
* Returns true if the the prober is allowed to see the presence of the probee.
*
* @param prober the user that is trying to probe the presence of another user.
* @param probee the username of the uset that is being probed.
* @return true if the the prober is allowed to see the presence of the probee.
* @throws UserNotFoundException If the probee does not exist in the local server or the prober
* is not present in the roster of the probee.
*/
private boolean canProbePresence(JID prober, JID probee) throws UserNotFoundException {
Roster roster;
roster = XMPPServer.getInstance().getRosterManager().getRoster(prober.getNode());
RosterItem item = roster.getRosterItem(probee);
if (item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_FROM) {
return true;
}
return false;
}
public boolean isCollectionNodesSupported() { public boolean isCollectionNodesSupported() {
return true; return true;
} }
...@@ -303,6 +319,10 @@ public class PEPService implements PubSubService { ...@@ -303,6 +319,10 @@ public class PEPService implements PubSubService {
} }
} }
public boolean isNodeCreationRestricted() {
return nodeCreationRestricted;
}
public void presenceSubscriptionNotRequired(Node node, JID user) { public void presenceSubscriptionNotRequired(Node node, JID user) {
PubSubEngine.presenceSubscriptionNotRequired(this, node, user); PubSubEngine.presenceSubscriptionNotRequired(this, node, user);
} }
...@@ -311,19 +331,24 @@ public class PEPService implements PubSubService { ...@@ -311,19 +331,24 @@ public class PEPService implements PubSubService {
PubSubEngine.presenceSubscriptionRequired(this, node, user); PubSubEngine.presenceSubscriptionRequired(this, node, user);
} }
public void removeNode(String nodeID) {
nodes.remove(nodeID);
}
public void send(Packet packet) { public void send(Packet packet) {
router.route(packet); router.route(packet);
} }
public void broadcast(Node node, Message message, Collection<JID> jids) {
message.setFrom(getAddress());
for (JID jid : jids) {
message.setTo(jid);
message.setID(node.getNodeID() + "__" + jid.toBareJID() + "__" + StringUtils.randomString(5));
router.route(message);
}
}
public void sendNotification(Node node, Message message, JID recipientJID) { public void sendNotification(Node node, Message message, JID recipientJID) {
message.setTo(recipientJID); message.setTo(recipientJID);
message.setFrom(getAddress()); message.setFrom(getAddress());
message.setID(node.getNodeID() + "__" + recipientJID.toBareJID() + "__" + StringUtils.randomString(5)); message.setID(node.getNodeID() + "__" + recipientJID.toBareJID() + "__" + StringUtils.randomString(5));
// If the recipient subscribed with a bare JID and this PEPService can retrieve // If the recipient subscribed with a bare JID and this PEPService can retrieve
// presence information for the recipient, collect all of their full JIDs and // presence information for the recipient, collect all of their full JIDs and
// send the notification to each below. // send the notification to each below.
...@@ -336,9 +361,8 @@ public class PEPService implements PubSubService { ...@@ -336,9 +361,8 @@ public class PEPService implements PubSubService {
else { else {
// Since recipientJID is not local, try to get presence info from cached known remote // Since recipientJID is not local, try to get presence info from cached known remote
// presences. // presences.
Map<String, Set<JID>> knownRemotePresences = Map<String, Set<JID>> knownRemotePresences = XMPPServer.getInstance().getIQPEPHandler().getKnownRemotePresenes();
XMPPServer.getInstance().getIQPEPHandler().getKnownRemotePresenes();
Set<JID> remotePresenceSet = knownRemotePresences.get(getAddress().toBareJID()); Set<JID> remotePresenceSet = knownRemotePresences.get(getAddress().toBareJID());
if (remotePresenceSet != null) { if (remotePresenceSet != null) {
for (JID remotePresence : remotePresenceSet) { for (JID remotePresence : remotePresenceSet) {
...@@ -353,7 +377,7 @@ public class PEPService implements PubSubService { ...@@ -353,7 +377,7 @@ public class PEPService implements PubSubService {
router.route(message); router.route(message);
return; 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
...@@ -364,10 +388,10 @@ public class PEPService implements PubSubService { ...@@ -364,10 +388,10 @@ public class PEPService implements PubSubService {
// Get the ID of the node that had an item published to or retracted from. // Get the ID of the node that had an item published to or retracted from.
Element itemsElement = message.getElement().element("event").element("items"); Element itemsElement = message.getElement().element("event").element("items");
String nodeID = itemsElement.attributeValue("node"); String nodeID = itemsElement.attributeValue("node");
// Get the ID of the item that was published or retracted. // Get the ID of the item that was published or retracted.
String itemID = null; String itemID = null;
Element itemElement = itemsElement.element("item"); Element itemElement = itemsElement.element("item");
if (itemElement == null) { if (itemElement == null) {
Element retractElement = itemsElement.element("retract"); Element retractElement = itemsElement.element("retract");
if (retractElement != null) { if (retractElement != null) {
...@@ -437,62 +461,12 @@ public class PEPService implements PubSubService { ...@@ -437,62 +461,12 @@ public class PEPService implements PubSubService {
} }
catch (UserNotFoundException e1) { catch (UserNotFoundException e1) {
// Do nothing // Do nothing
} }
router.route(message); router.route(message);
} }
} }
} }
public boolean isNodeCreationRestricted() {
return nodeCreationRestricted;
}
public void queueItemToAdd(PublishedItem newItem) {
PubSubEngine.queueItemToAdd(this, newItem);
}
public void queueItemToRemove(PublishedItem removedItem) {
PubSubEngine.queueItemToRemove(this, removedItem);
}
public Map<String, Map<String, String>> getBarePresences() {
return barePresences;
}
public Queue<PublishedItem> getItemsToAdd() {
return itemsToAdd;
}
public Queue<PublishedItem> getItemsToDelete() {
return itemsToDelete;
}
public AdHocCommandManager getManager() {
return manager;
}
public PublishedItemTask getPublishedItemTask() {
return publishedItemTask;
}
public void setPublishedItemTask(PublishedItemTask task) {
publishedItemTask = task;
}
public Timer getTimer() {
return timer;
}
public int getItemsTaskTimeout() {
return items_task_timeout;
}
public void setItemsTaskTimeout(int timeout) {
items_task_timeout = timeout;
}
/** /**
* Sends an event notification for the last published item to the recipient JID. For * Sends an event notification for the last published item to the recipient JID. For
* a PEPService, the last published item is the latest item published for all of the * a PEPService, the last published item is the latest item published for all of the
...@@ -539,8 +513,7 @@ public class PEPService implements PubSubService { ...@@ -539,8 +513,7 @@ public class PEPService implements PubSubService {
} }
// Send event notification to the subscriber // Send event notification to the subscriber
Message notification = new Message(); Message notification = new Message();
Element event = notification.getElement() Element event = notification.getElement().addElement("event", "http://jabber.org/protocol/pubsub#event");
.addElement("event", "http://jabber.org/protocol/pubsub#event");
Element items = event.addElement("items"); Element items = event.addElement("items");
items.addAttribute("node", lastPublishedItem.getNode().getNodeID()); items.addAttribute("node", lastPublishedItem.getNode().getNodeID());
Element item = items.addElement("item"); Element item = items.addElement("item");
...@@ -555,31 +528,55 @@ public class PEPService implements PubSubService { ...@@ -555,31 +528,55 @@ public class PEPService implements PubSubService {
notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body")); notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body"));
} }
// Include date when published item was created // Include date when published item was created
notification.getElement().addElement("x", "jabber:x:delay") notification.getElement().addElement("x", "jabber:x:delay").addAttribute("stamp", fastDateFormat.format(lastPublishedItem.getCreationDate()));
.addAttribute("stamp", fastDateFormat.format(lastPublishedItem.getCreationDate()));
// Send the event notification to the subscriber // Send the event notification to the subscriber
this.sendNotification(subscription.getNode(), notification, subscription.getJID()); this.sendNotification(subscription.getNode(), notification, subscription.getJID());
} }
/**
* Returns true if the the prober is allowed to see the presence of the probee.
*
* @param prober the user that is trying to probe the presence of another user.
* @param probee the username of the uset that is being probed.
* @return true if the the prober is allowed to see the presence of the probee.
* @throws UserNotFoundException If the probee does not exist in the local server or the prober
* is not present in the roster of the probee.
*/
private boolean canProbePresence(JID prober, JID probee) throws UserNotFoundException {
Roster roster;
roster = XMPPServer.getInstance().getRosterManager().getRoster(prober.getNode());
RosterItem item = roster.getRosterItem(probee);
if (item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_FROM) {
return true;
}
return false; public void queueItemToAdd(PublishedItem newItem) {
PubSubEngine.queueItemToAdd(this, newItem);
}
public void queueItemToRemove(PublishedItem removedItem) {
PubSubEngine.queueItemToRemove(this, removedItem);
}
public Map<String, Map<String, String>> getBarePresences() {
return barePresences;
}
public Queue<PublishedItem> getItemsToAdd() {
return itemsToAdd;
}
public Queue<PublishedItem> getItemsToDelete() {
return itemsToDelete;
}
public AdHocCommandManager getManager() {
return manager;
}
public PublishedItemTask getPublishedItemTask() {
return publishedItemTask;
}
public void setPublishedItemTask(PublishedItemTask task) {
publishedItemTask = task;
}
public Timer getTimer() {
return timer;
}
public int getItemsTaskTimeout() {
return items_task_timeout;
}
public void setItemsTaskTimeout(int timeout) {
items_task_timeout = timeout;
} }
} }
...@@ -88,8 +88,8 @@ public class NodeAffiliate { ...@@ -88,8 +88,8 @@ public class NodeAffiliate {
Element items = event.addElement("items"); Element items = event.addElement("items");
items.addAttribute("node", getNode().getNodeID()); items.addAttribute("node", getNode().getNodeID());
for (PublishedItem publishedItem : itemsBySubs.get(nodeSubscriptions)) { for (PublishedItem publishedItem : itemsBySubs.get(nodeSubscriptions)) {
// FIXME: This was added for compatibility with PEP supporting clients like Psi. // FIXME: This was added for compatibility with PEP supporting clients.
// May not be the best of solutions. // Alternate solution needed when XEP-0163 version > 1.0 is released.
// //
// If the node ID looks like a JID, replace it with the published item's node ID. // If the node ID looks like a JID, replace it with the published item's node ID.
if (getNode().getNodeID().indexOf("@") >= 0) { if (getNode().getNodeID().indexOf("@") >= 0) {
......
...@@ -377,9 +377,7 @@ public class UserManager implements IQResultListener { ...@@ -377,9 +377,7 @@ public class UserManager implements IQResultListener {
for (Iterator it=child.elementIterator("identity"); it.hasNext();) { for (Iterator it=child.elementIterator("identity"); it.hasNext();) {
Element identity = (Element) it.next(); Element identity = (Element) it.next();
String accountType = identity.attributeValue("type"); String accountType = identity.attributeValue("type");
// FIXME: Not all servers provide these identity types for their regged users. if ("registered".equals(accountType) || "admin".equals(accountType)) {
// So for PEP testing purposes, let's just assume everyone is registered.
if (true /*"registered".equals(accountType) || "admin".equals(accountType)*/) {
isRegistered = Boolean.TRUE; isRegistered = Boolean.TRUE;
break; break;
} }
......
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