Commit 8a027cc5 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Use bare JID to check membership.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@7761 b35dd754-fafc-0310-a699-88a17e54d16e
parent 326ac7c4
......@@ -12,11 +12,11 @@
package org.jivesoftware.openfire.group;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.event.GroupEventDispatcher;
import org.jivesoftware.util.CacheSizes;
import org.jivesoftware.util.Cacheable;
import org.jivesoftware.util.Log;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.event.GroupEventDispatcher;
import org.xmpp.packet.JID;
import java.io.IOException;
......@@ -233,12 +233,16 @@ public class Group implements Cacheable {
}
/**
* Returns true if the provided username belongs to a user that is part of the group.
* Returns true if the provided JID belongs to a user that is part of the group.
*
* @param user the JID address of the user to check.
* @return true if the specified user is a group user.
*/
public boolean isUser(JID user) {
// Make sure that we are always checking bare JIDs
if (user != null && user.getResource() != null) {
user = new JID(user.toBareJID());
}
return user != null && (members.contains(user) || administrators.contains(user));
}
......
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