本文整理汇总了Java中org.jivesoftware.openfire.group.Group.isUser方法的典型用法代码示例。如果您正苦于以下问题:Java Group.isUser方法的具体用法?Java Group.isUser怎么用?Java Group.isUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.openfire.group.Group
的用法示例。
在下文中一共展示了Group.isUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: packetToFromGroup
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
private boolean packetToFromGroup(String rulegroup, JID packetToFrom) {
Group group = null;
boolean result = false;
try {
group = GroupManager.getInstance().getGroup(rulegroup);
} catch (GroupNotFoundException e) {
if (PacketFilterConstants.ANY_GROUP.equals(rulegroup)) {
if (!GroupManager.getInstance().getGroups(packetToFrom).isEmpty()) {
result = true;
}
} else {
e.printStackTrace();
}
}
if (group != null) {
if (group.isUser(packetToFrom)) {
result = true;
}
}
return result;
}
示例2: isBookmarkForJID
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
* True if the specified bookmark should be appended to the users list of
* bookmarks.
*
* @param jid the jid of the user.
* @param bookmark the bookmark.
* @return true if bookmark should be appended.
*/
private static boolean isBookmarkForJID(JID jid, Bookmark bookmark) {
String username = jid.getNode();
if (bookmark.getUsers().contains(username)) {
return true;
}
Collection<String> groups = bookmark.getGroups();
if (groups != null && !groups.isEmpty()) {
GroupManager groupManager = GroupManager.getInstance();
for (String groupName : groups) {
try {
Group group = groupManager.getGroup(groupName);
if (group.isUser(jid.getNode())) {
return true;
}
}
catch (GroupNotFoundException e) {
Log.debug(e.getMessage(), e);
}
}
}
return false;
}
示例3: isGroupVisible
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
* Returns true if a given group is visible to a given user. That means, if the user can
* see the group in his roster.
*
* @param group the group to check if the user can see.
* @param user the JID of the user to check if he may see the group.
* @return true if a given group is visible to a given user.
*/
boolean isGroupVisible(Group group, JID user) {
String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
if ("everybody".equals(showInRoster)) {
return true;
}
else if ("onlyGroup".equals(showInRoster)) {
if (group.isUser(user)) {
return true;
}
// Check if the user belongs to a group that may see this group
Collection<Group> groupList = parseGroups(group.getProperties().get(
"sharedRoster.groupList"));
for (Group groupInList : groupList) {
if (groupInList.isUser(user)) {
return true;
}
}
}
return false;
}
示例4: isGroupVisible
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
* Returns true if a given group is visible to a given user. That means, if the user can
* see the group in his roster.
*
* @param group the group to check if the user can see.
* @param user the JID of the user to check if he may see the group.
* @return true if a given group is visible to a given user.
*/
public boolean isGroupVisible(Group group, JID user) {
String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
if ("everybody".equals(showInRoster)) {
return true;
}
else if ("onlyGroup".equals(showInRoster)) {
if (group.isUser(user)) {
return true;
}
// Check if the user belongs to a group that may see this group
Collection<Group> groupList = parseGroups(group.getProperties().get(
"sharedRoster.groupList"));
for (Group groupInList : groupList) {
if (groupInList.isUser(user)) {
return true;
}
}
}
return false;
}
示例5: getSharedGroups
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
* Returns a collection with all the groups that the user may include in his roster. The
* following criteria will be used to select the groups: 1) Groups that are configured so that
* everybody can include in his roster, 2) Groups that are configured so that its users may
* include the group in their rosters and the user is a group user of the group and 3) User
* belongs to a Group that may see a Group that whose members may include the Group in their
* rosters.
*
* @param username the username of the user to return his shared groups.
* @return a collection with all the groups that the user may include in his roster.
*/
public Collection<Group> getSharedGroups(String username) {
Collection<Group> answer = new HashSet<>();
Collection<Group> groups = GroupManager.getInstance().getSharedGroups(username);
for (Group group : groups) {
String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
if ("onlyGroup".equals(showInRoster)) {
if (group.isUser(username)) {
// The user belongs to the group so add the group to the answer
answer.add(group);
}
else {
// Check if the user belongs to a group that may see this group
Collection<Group> groupList = parseGroups(group.getProperties().get("sharedRoster.groupList"));
for (Group groupInList : groupList) {
if (groupInList.isUser(username)) {
answer.add(group);
}
}
}
}
else if ("everybody".equals(showInRoster)) {
// Anyone can see this group so add the group to the answer
answer.add(group);
}
}
return answer;
}
示例6: getSharedUsersForRoster
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
Collection<JID> getSharedUsersForRoster(Group group, Roster roster) {
String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
String groupNames = group.getProperties().get("sharedRoster.groupList");
// Answer an empty collection if the group is not being shown in users' rosters
if (!"onlyGroup".equals(showInRoster) && !"everybody".equals(showInRoster)) {
return new ArrayList<>();
}
// Add the users of the group
Collection<JID> users = new HashSet<>(group.getMembers());
users.addAll(group.getAdmins());
// If the user of the roster belongs to the shared group then we should return
// users that need to be in the roster with subscription "from"
if (group.isUser(roster.getUsername())) {
// Check if anyone can see this shared group
if ("everybody".equals(showInRoster)) {
// Add all users in the system
for (String username : UserManager.getInstance().getUsernames()) {
users.add(server.createJID(username, null, true));
}
}
else {
// Add the users that may see the group
Collection<Group> groupList = parseGroups(groupNames);
for (Group groupInList : groupList) {
users.addAll(groupInList.getMembers());
users.addAll(groupInList.getAdmins());
}
}
}
return users;
}
示例7: copyToGroups
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
private static void copyToGroups(String currentUser, String newUser) {
GroupManager groupManager = GroupManager.getInstance();
for (Group group : groupManager.getGroups()) {
if (group.isUser(currentUser)) {
group.getMembers().add(XMPPServer.getInstance().createJID(newUser, null));
}
}
}
示例8: copyToGroups
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
private static void copyToGroups(String currentUser, String newUser) {
GroupManager groupManager = GroupManager.getInstance();
for (Group group : groupManager.getGroups()) {
if (group.isUser(currentUser)) {
group.getMembers().add(XMPPServer.getInstance().createJID(newUser, null));
}
}
}
示例9: filterGroupSearchResults
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
public Set<User> filterGroupSearchResults(JID jid, Set<User> searchResults) {
if (groupOnly) {
Collection<Group> groups = GroupManager.getInstance().getGroups(jid);
Set<User> allSearchResults = new HashSet<User>(searchResults);
searchResults.clear();
for (User user : allSearchResults) {
for (Group group : groups) {
if (group.isUser(user.getUID())) {
searchResults.add(user);
}
}
}
}
return searchResults;
}
示例10: copyToGroups
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
* Copy to groups.
*
* @param currentUser
* the current user
* @param newUser
* the new user
*/
private static void copyToGroups(String currentUser, String newUser) {
GroupManager groupManager = GroupManager.getInstance();
for (Group group : groupManager.getGroups()) {
if (group.isUser(currentUser)) {
group.getMembers().add(XMPPServer.getInstance().createJID(newUser, null));
}
}
}
示例11: isMember
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
public boolean isMember(Agent agent) {
if (agents.contains(agent)) {
return true;
}
for (Group group : getGroupObjects()) {
if (group.isUser(agent.getAgentJID())) {
return true;
}
}
return false;
}
示例12: getSharedGroups
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
* Returns a collection with all the groups that the user may include in his roster. The
* following criteria will be used to select the groups: 1) Groups that are configured so that
* everybody can include in his roster, 2) Groups that are configured so that its users may
* include the group in their rosters and the user is a group user of the group and 3) User
* belongs to a Group that may see a Group that whose members may include the Group in their
* rosters.
*
* @param username the username of the user to return his shared groups.
* @return a collection with all the groups that the user may include in his roster.
*/
public Collection<Group> getSharedGroups(String username) {
Collection<Group> answer = new HashSet<Group>();
Collection<Group> groups = GroupManager.getInstance().getSharedGroups();
for (Group group : groups) {
String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
if ("onlyGroup".equals(showInRoster)) {
if (group.isUser(username)) {
// The user belongs to the group so add the group to the answer
answer.add(group);
}
else {
// Check if the user belongs to a group that may see this group
Collection<Group> groupList = parseGroups(group.getProperties().get("sharedRoster.groupList"));
for (Group groupInList : groupList) {
if (groupInList.isUser(username)) {
answer.add(group);
}
}
}
}
else if ("everybody".equals(showInRoster)) {
// Anyone can see this group so add the group to the answer
answer.add(group);
}
}
return answer;
}
示例13: getSharedUsersForRoster
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
Collection<JID> getSharedUsersForRoster(Group group, Roster roster) {
String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
String groupNames = group.getProperties().get("sharedRoster.groupList");
// Answer an empty collection if the group is not being shown in users' rosters
if (!"onlyGroup".equals(showInRoster) && !"everybody".equals(showInRoster)) {
return new ArrayList<JID>();
}
// Add the users of the group
Collection<JID> users = new HashSet<JID>(group.getMembers());
users.addAll(group.getAdmins());
// If the user of the roster belongs to the shared group then we should return
// users that need to be in the roster with subscription "from"
if (group.isUser(roster.getUsername())) {
// Check if anyone can see this shared group
if ("everybody".equals(showInRoster)) {
// Add all users in the system
for (String username : UserManager.getInstance().getUsernames()) {
users.add(server.createJID(username, null, true));
}
}
else {
// Add the users that may see the group
Collection<Group> groupList = parseGroups(groupNames);
for (Group groupInList : groupList) {
users.addAll(groupInList.getMembers());
users.addAll(groupInList.getAdmins());
}
}
}
return users;
}
示例14: filterGroupSearchResults
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
public Set<User> filterGroupSearchResults(JID jid, Set<User> searchResults) {
if (groupOnly) {
Collection<Group> groups = GroupManager.getInstance().getGroups(jid);
Set<User> allSearchResults = new HashSet<User>(searchResults);
searchResults.clear();
for (User user : allSearchResults) {
for (Group group : groups) {
if (group.isUser(user.getUID())) {
searchResults.add(user);
}
}
}
}
return searchResults;
}
示例15: getSharedGroups
import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
* Returns a collection with all the groups that the user may include in his roster. The
* following criteria will be used to select the groups: 1) Groups that are configured so that
* everybody can include in his roster, 2) Groups that are configured so that its users may
* include the group in their rosters and the user is a group user of the group and 3) User
* belongs to a Group that may see a Group that whose members may include the Group in their
* rosters.
*
* @param username the username of the user to return his shared groups.
* @return a collection with all the groups that the user may include in his roster.
*/
public Collection<Group> getSharedGroups(String username) {
Collection<Group> answer = new HashSet<Group>();
Collection<Group> groups = GroupManager.getInstance().getSharedGroups(username);
for (Group group : groups) {
String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
if ("onlyGroup".equals(showInRoster)) {
if (group.isUser(username)) {
// The user belongs to the group so add the group to the answer
answer.add(group);
}
else {
// Check if the user belongs to a group that may see this group
Collection<Group> groupList = parseGroups(group.getProperties().get("sharedRoster.groupList"));
for (Group groupInList : groupList) {
if (groupInList.isUser(username)) {
answer.add(group);
}
}
}
}
else if ("everybody".equals(showInRoster)) {
// Anyone can see this group so add the group to the answer
answer.add(group);
}
}
return answer;
}