@Override public IQ handleIQ(IQ packet) { if (Type.get.equals(packet.getType())) { return IQ.createResultIQ(packet); } return null; }
/** * Construct a JID representing a Group from a regular JID. This constructor is * private because it is used only from within this class after the source JID * has been validated. * * @param source A full JID representing a group * @see GroupJID#fromString */ private GroupJID(JID source) { // skip stringprep for the new group JID, since it has already been parsed super(source.getNode(), source.getDomain(), source.getResource(), true); }
private Message createServerMessage(String subject, String body) { Message message = new Message(); message.setFrom(serverAddress); if (subject != null) { message.setSubject(subject); } message.setBody(body); return message; }
/** * Returns the Element that contains the multiple recipients. * * @param packet packet containing the multiple recipients. * @return the Element that contains the multiple recipients. */ private Element getAddresses(Packet packet) { if (packet instanceof IQ) { return ((IQ) packet).getChildElement().element("addresses"); } else { return packet.getElement().element("addresses"); } }
public Presence createSubscribePresence(JID senderAddress, JID targetJID, boolean isSubscribe) { Presence presence = new Presence(); presence.setFrom(senderAddress); presence.setTo(targetJID); if (isSubscribe) { presence.setType(Presence.Type.subscribe); } else { presence.setType(Presence.Type.unsubscribe); } return presence; }
@Override public IQ handleIQ(IQ packet) throws UnauthorizedException { // Just answer that the session has been activated IQ reply = IQ.createResultIQ(packet); return reply; }
/** * Creates a forwarded removal packet. * * @param from The sender address to use * @param to The recipient address to use * @return The forwarded packet generated */ private Packet createRemoveForward(JID from, JID to) { org.xmpp.packet.Roster response = new org.xmpp.packet.Roster(IQ.Type.set); response.setFrom(from); response.setTo(to); response.addItem(from, org.xmpp.packet.Roster.Subscription.remove); return response; }
public DestroyRoomRequest(LocalMUCRoom room, String alternateJID, String reason) { super(room); this.alternateJID = new JID(alternateJID); this.reason = reason; }
private String getUserGroupsKey(final JID user) { return USER_GROUPS_KEY + user.toBareJID(); }
/** * Creates a session with an underlying connection and permission protection. * * @param serverName name of the server. * @param connection The connection we are proxying. * @param streamID unique identifier of this session. */ public LocalClientSession(String serverName, Connection connection, StreamID streamID, Locale language) { super(serverName, connection, streamID, language); // Set an unavailable initial presence presence = new Presence(); presence.setType(Presence.Type.unavailable); }
public String getNickname() { return presence.getFrom().getResource().trim(); }
public AddMember(LocalMUCRoom room, JID bareJID, String nickname) { super(room); this.bareJID = bareJID.asBareJID(); this.nickname = nickname; }
private void setRoleAddress(JID jid) { rJID = jid; // Set the new sender of the user presence in the room presence.setFrom(jid); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((realjid == null) ? 0 : realjid.hashCode()); return result; }
public static RosterItem.AskType getAskStatus(org.xmpp.packet.Roster.Item item) { if (item.getAsk() == org.xmpp.packet.Roster.Ask.subscribe) { return RosterItem.ASK_SUBSCRIBE; } else if (item.getAsk() == org.xmpp.packet.Roster.Ask.unsubscribe) { return RosterItem.ASK_UNSUBSCRIBE; } else { return RosterItem.ASK_NONE; } }
@Override public JID getAddress() { return new JID(serviceOwnerJID); }
public AddAffiliation(LocalMUCRoom room, JID bareJID, MUCRole.Affiliation affiliation) { super(room); this.bareJID = bareJID.asBareJID(); this.affiliation = affiliation; }
private void setRoleAddress(JID jid) { roleAddress = jid; // Set the new sender of the user presence in the room presence.setFrom(jid); }