@Override public Presence addModerator(JID jid, MUCRole senderRole) throws ForbiddenException { if (MUCRole.Affiliation.admin != senderRole.getAffiliation() && MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); } // Update the presence with the new role and inform all occupants try { return changeOccupantRole(jid, MUCRole.Role.moderator); } catch (NotAllowedException e) { // We should never receive this exception....in theory return null; } }
@Override public void unlock(MUCRole senderRole) throws ForbiddenException { if (MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); } if (!isLocked()) { // Do nothing if the room was already unlocked return; } setLocked(false); }
@Override public void lock(MUCRole senderRole) throws ForbiddenException { if (MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); } if (isLocked()) { // Do nothing if the room was already locked return; } setLocked(true); }
@Override public List<Presence> setMembersOnly(boolean membersOnly) { List<Presence> presences = new ArrayList<>(); if (membersOnly && !this.membersOnly) { // If the room was not members-only and now it is, kick occupants that aren't member // of the room for (MUCRole occupant : occupantsByFullJID.values()) { if (occupant.getAffiliation().compareTo(MUCRole.Affiliation.member) > 0) { try { presences.add(kickOccupant(occupant.getRoleAddress(), null, null, LocaleUtils.getLocalizedString("muc.roomIsNowMembersOnly"))); } catch (NotAllowedException e) { Log.error(e.getMessage(), e); } } } } this.membersOnly = membersOnly; return presences; }
public UpdateOccupant(LocalMUCRoom room, MUCRole role) { super(room); this.presence = role.getPresence(); this.nickname = role.getNickname(); this.role = role.getRole().ordinal(); this.affiliation = role.getAffiliation().ordinal(); }
if (isMembersOnly()) { if (!canOccupantsInvite()) { if (MUCRole.Affiliation.admin != sendRole.getAffiliation() && MUCRole.Affiliation.owner != sendRole.getAffiliation()) { throw new ForbiddenException(); if (MUCRole.Affiliation.admin != sendRole.getAffiliation() && MUCRole.Affiliation.owner != sendRole.getAffiliation()) { throw new ForbiddenException();
lock.writeLock().lock(); try { if (MUCRole.Affiliation.admin != senderRole.getAffiliation() && MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException();
try { MUCRole.Affiliation oldAffiliation = MUCRole.Affiliation.none; if (MUCRole.Affiliation.admin != senderRole.getAffiliation() && MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException();
try { MUCRole.Affiliation oldAffiliation = MUCRole.Affiliation.none; if (MUCRole.Affiliation.owner != sendRole.getAffiliation()) { throw new ForbiddenException();
public OccupantAddedEvent(LocalMUCRoom room, MUCRole occupant) { super(room); presence = occupant.getPresence(); role = occupant.getRole().ordinal(); affiliation = occupant.getAffiliation().ordinal(); voiceOnly = occupant.isVoiceOnly(); roleAddress = occupant.getRoleAddress(); userAddress = occupant.getUserAddress(); nodeID = XMPPServer.getInstance().getNodeID(); }
try { MUCRole.Affiliation oldAffiliation = MUCRole.Affiliation.none; if (MUCRole.Affiliation.owner != sendRole.getAffiliation()) { throw new ForbiddenException();
if ("outcast".equals(affiliation)) { if (MUCRole.Affiliation.admin != senderRole.getAffiliation() && MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); && MUCRole.Affiliation.admin != senderRole.getAffiliation() && MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); if (MUCRole.Affiliation.admin != senderRole.getAffiliation() && MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); metaData.addAttribute("jid", role.getUserAddress().toString()); metaData.addAttribute("nick", role.getNickname()); metaData.addAttribute("affiliation", role.getAffiliation().toString()); metaData.addAttribute("jid", role.getUserAddress().toString()); metaData.addAttribute("nick", role.getNickname()); metaData.addAttribute("affiliation", role.getAffiliation().toString());
if (MUCRole.Affiliation.owner != role.getAffiliation()) { throw new ForbiddenException();
throws ForbiddenException, CannotBeInvitedException { if (!isMembersOnly() || canOccupantsInvite() || MUCRole.Affiliation.admin == senderRole.getAffiliation() || MUCRole.Affiliation.owner == senderRole.getAffiliation()) {
@Override public Presence addModerator(JID jid, MUCRole senderRole) throws ForbiddenException { if (MUCRole.Affiliation.admin != senderRole.getAffiliation() && MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); } // Update the presence with the new role and inform all occupants try { return changeOccupantRole(jid, MUCRole.Role.moderator); } catch (NotAllowedException e) { // We should never receive this exception....in theory return null; } }
@Override public void unlock(MUCRole senderRole) throws ForbiddenException { if (MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); } if (!isLocked()) { // Do nothing if the room was already unlocked return; } setLocked(false); }
@Override public void lock(MUCRole senderRole) throws ForbiddenException { if (MUCRole.Affiliation.owner != senderRole.getAffiliation()) { throw new ForbiddenException(); } if (isLocked()) { // Do nothing if the room was already locked return; } setLocked(true); }
@Override public List<Presence> setMembersOnly(boolean membersOnly) { List<Presence> presences = new ArrayList<>(); if (membersOnly && !this.membersOnly) { // If the room was not members-only and now it is, kick occupants that aren't member // of the room for (MUCRole occupant : occupantsByFullJID.values()) { if (occupant.getAffiliation().compareTo(MUCRole.Affiliation.member) > 0) { try { presences.add(kickOccupant(occupant.getRoleAddress(), null, null, LocaleUtils.getLocalizedString("muc.roomIsNowMembersOnly"))); } catch (NotAllowedException e) { Log.error(e.getMessage(), e); } } } } this.membersOnly = membersOnly; return presences; }
public UpdateOccupant(LocalMUCRoom room, MUCRole role) { super(room); this.presence = role.getPresence(); this.nickname = role.getNickname(); this.role = role.getRole().ordinal(); this.affiliation = role.getAffiliation().ordinal(); }
public OccupantAddedEvent(LocalMUCRoom room, MUCRole occupant) { super(room); presence = occupant.getPresence(); role = occupant.getRole().ordinal(); affiliation = occupant.getAffiliation().ordinal(); voiceOnly = occupant.isVoiceOnly(); roleAddress = occupant.getRoleAddress(); userAddress = occupant.getUserAddress(); nodeID = XMPPServer.getInstance().getNodeID(); }