/** * Deletes a user from all the groups where he/she belongs. The most probable cause for this * request is that the user has been deleted from the system. * * <p>TODO: remove this method and use events isntead. * * @param user the deleted user from the system. */ public void deleteUser(User user) { JID userJID = XMPPServer.getInstance().createJID(user.getUsername(), null); for (Group group : getGroups(userJID)) { if (group.getAdmins().contains(userJID)) { group.getAdmins().remove(userJID); } else { group.getMembers().remove(userJID); } } }
/** * Deletes a group from the system. * * @param group the group to delete. */ public void deleteGroup(Group group) { // Fire event. GroupEventDispatcher.dispatchEvent( group, GroupEventDispatcher.EventType.group_deleting, Collections.emptyMap()); // Delete the group. provider.deleteGroup(group.getName()); // Expire all relevant caches. groupCache.remove(group.getName()); }