Commit dd7276f0 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Added #isUser(JID). JM-427

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@2932 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5c9cd1db
...@@ -11,20 +11,22 @@ ...@@ -11,20 +11,22 @@
package org.jivesoftware.messenger.group; package org.jivesoftware.messenger.group;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.Cacheable;
import org.jivesoftware.util.CacheSizes;
import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.event.GroupEventDispatcher; import org.jivesoftware.messenger.event.GroupEventDispatcher;
import org.jivesoftware.messenger.user.UserManager; import org.jivesoftware.messenger.user.UserManager;
import org.jivesoftware.stringprep.Stringprep; import org.jivesoftware.stringprep.Stringprep;
import org.jivesoftware.util.CacheSizes;
import org.jivesoftware.util.Cacheable;
import org.jivesoftware.util.Log;
import org.xmpp.packet.JID;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* Groups organize users into a single entity for easier management. * Groups organize users into a single entity for easier management.
...@@ -181,6 +183,21 @@ public class Group implements Cacheable { ...@@ -181,6 +183,21 @@ public class Group implements Cacheable {
return new MemberCollection(members, false); return new MemberCollection(members, false);
} }
/**
* Returns true if the provided username belongs to a local user that is part of the group.
*
* @param user the JID address of the user to check.
* @return true if the provided username belongs to a user of the group.
*/
public boolean isUser(JID user) {
String serverName = XMPPServer.getInstance().getServerInfo().getName();
if (user != null && serverName.equals(user.getDomain())) {
return isUser(user.getNode());
} else {
return false;
}
}
/** /**
* Returns true if the provided username belongs to a user of the group. * Returns true if the provided username belongs to a user of the group.
* *
......
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