public OccupantLeftEvent(LocalMUCRoom room, MUCRole role) { super(room); this.role = role; this.nickname = role.getNickname(); this.userAddress = role.getUserAddress(); }
String nickname = leaveRole.getNickname(); List<MUCRole> occupants = occupantsByNickname.get(nickname.toLowerCase()); if (occupants != null) {
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(); }
private Element addAffiliationToResult(String affiliation, Element parent, JID jid) { Element result = parent.addElement("item", "http://jabber.org/protocol/muc#admin"); result.addAttribute("affiliation", affiliation); result.addAttribute("jid", jid.toString()); try { List<MUCRole> roles = room.getOccupantsByBareJID(jid); MUCRole role = roles.get(0); result.addAttribute("role", role.getRole().toString()); result.addAttribute("nick", role.getNickname()); } catch (UserNotFoundException e) { // the JID is note currently an occupant } return result; } }
kickPresence(presence, senderRole.getUserAddress(), senderRole.getNickname());
new UpdateOccupantRequest(this, role.getNickname(), newAffiliation, newRole), role.getNodeID().toByteArray()); if (element != null) {
if (getOccupantsByNickname(leaveRole.getNickname()).size() <= 1) {
@Override public void sendPublicMessage(Message message, MUCRole senderRole) throws ForbiddenException { // Check that if the room is moderated then the sender of the message has to have voice if (isModerated() && senderRole.getRole().compareTo(MUCRole.Role.participant) > 0) { throw new ForbiddenException(); } // Send the message to all occupants message.setFrom(senderRole.getRoleAddress()); send(message); // Fire event that message was received by the room MUCEventDispatcher.messageReceived(getRole().getRoleAddress(), senderRole.getUserAddress(), senderRole.getNickname(), message); }
metaData.addAttribute("role", "moderator"); metaData.addAttribute("jid", role.getUserAddress().toString()); metaData.addAttribute("nick", role.getNickname()); metaData.addAttribute("affiliation", role.getAffiliation().toString()); metaData.addAttribute("role", "participant"); metaData.addAttribute("jid", role.getUserAddress().toString()); metaData.addAttribute("nick", role.getNickname()); metaData.addAttribute("affiliation", role.getAffiliation().toString()); throw new ForbiddenException(); presences.add(room.kickOccupant(jid, senderRole.getUserAddress(), senderRole.getNickname(), item.elementTextTrim("reason")));
/** * Handles occupants updating their presence in the chatroom. Assumes the user updates their presence whenever their * availability in the room changes. This method should not be called to handle other presence related updates, such * as nickname changes. * {@inheritDoc} */ @Override public void presenceUpdated(final MUCRole occupantRole, final Presence newPresence) { final String occupantNickName = occupantRole.getNickname(); // Update the presence of the occupant on the local node with the occupant's new availability. Updates the // local node first so the remote nodes receive presence that correctly reflects the occupant's new // availability and previously existing role and affiliation with the room. final UpdatePresence localUpdateRequest = new UpdatePresence(this, newPresence.createCopy(), occupantNickName); localUpdateRequest.setOriginator(true); localUpdateRequest.run(); // Get the new, updated presence for the occupant in the room. The presence reflects the occupant's updated // availability and their existing association. final Presence updatedPresence = occupantRole.getPresence().createCopy(); // Ask other cluster nodes to update the presence of the occupant. Uses the updated presence from the local // MUC role. final UpdatePresence clusterUpdateRequest = new UpdatePresence(this, updatedPresence, occupantNickName); CacheFactory.doClusterTask(clusterUpdateRequest); // Broadcast updated presence of occupant. broadcastPresence(updatedPresence, false); }
new UpdateOccupantRequest(this, role.getNickname(), null, newRole), role.getNodeID().toByteArray()); if (element != null) {
: recipient.getResource().trim()); if (resource == null || role.getNickname().equalsIgnoreCase(resource)) { String oldNick = role.getNickname(); role.getChatRoom().nicknameChanged(role, packet, oldNick, resource);
if ( selfPingEnabled && toNickname.equals( role.getNickname() ) && packet.isRequest() && packet.getElement().element( QName.get( IQPingHandler.ELEMENT_NAME, IQPingHandler.NAMESPACE ) ) != null )
public OccupantLeftEvent(LocalMUCRoom room, MUCRole role) { super(room); this.role = role; this.nickname = role.getNickname(); }
String nickname = leaveRole.getNickname(); List<MUCRole> occupants = occupantsByNickname.get(nickname.toLowerCase()); if (occupants != null) {
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(); }
private Element addAffiliationToResult(String affiliation, Element parent, JID jid) { Element result = parent.addElement("item", "http://jabber.org/protocol/muc#admin"); result.addAttribute("affiliation", affiliation); result.addAttribute("jid", jid.toString()); try { List<MUCRole> roles = room.getOccupantsByBareJID(jid); MUCRole role = roles.get(0); result.addAttribute("role", role.getRole().toString()); result.addAttribute("nick", role.getNickname()); } catch (UserNotFoundException e) { // the JID is note currently an occupant } return result; } }
@Override public void sendPublicMessage(Message message, MUCRole senderRole) throws ForbiddenException { // Check that if the room is moderated then the sender of the message has to have voice if (isModerated() && senderRole.getRole().compareTo(MUCRole.Role.participant) > 0) { throw new ForbiddenException(); } // Send the message to all occupants message.setFrom(senderRole.getRoleAddress()); send(message); // Fire event that message was received by the room MUCEventDispatcher.messageReceived(getRole().getRoleAddress(), senderRole.getUserAddress(), senderRole.getNickname(), message); }
/** * Handles occupants updating their presence in the chatroom. Assumes the user updates their presence whenever their * availability in the room changes. This method should not be called to handle other presence related updates, such * as nickname changes. * {@inheritDoc} */ @Override public void presenceUpdated(final MUCRole occupantRole, final Presence newPresence) { final String occupantNickName = occupantRole.getNickname(); // Update the presence of the occupant on the local node with the occupant's new availability. Updates the // local node first so the remote nodes receive presence that correctly reflects the occupant's new // availability and previously existing role and affiliation with the room. final UpdatePresence localUpdateRequest = new UpdatePresence(this, newPresence.createCopy(), occupantNickName); localUpdateRequest.setOriginator(true); localUpdateRequest.run(); // Get the new, updated presence for the occupant in the room. The presence reflects the occupant's updated // availability and their existing association. final Presence updatedPresence = occupantRole.getPresence().createCopy(); // Ask other cluster nodes to update the presence of the occupant. Uses the updated presence from the local // MUC role. final UpdatePresence clusterUpdateRequest = new UpdatePresence(this, updatedPresence, occupantNickName); CacheFactory.doClusterTask(clusterUpdateRequest); // Broadcast updated presence of occupant. broadcastPresence(updatedPresence, false); }
new UpdateOccupantRequest(this, role.getNickname(), null, newRole), role.getNodeID().toByteArray()); if (element != null) {