public String toXML() { StringBuilder buf = new StringBuilder(); buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); if (getInvite() != null) { buf.append(getInvite().toXML()); } if (getDecline() != null) { buf.append(getDecline().toXML()); } if (getItem() != null) { buf.append(getItem().toXML()); } if (getPassword() != null) { buf.append("<password>").append(getPassword()).append("</password>"); } if (getStatus() != null) { buf.append(getStatus().toXML()); } if (getDestroy() != null) { buf.append(getDestroy().toXML()); } buf.append("</").append(getElementName()).append(">"); return buf.toString(); }
MUCUser mucUser = new MUCUser(); boolean done = false; while (!done) { if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("invite")) { mucUser.setInvite(parseInvite(parser)); mucUser.setItem(parseItem(parser)); mucUser.setPassword(parser.nextText()); mucUser.setStatus(new MUCUser.Status(parser.getAttributeValue("", "code"))); mucUser.setDecline(parseDecline(parser)); mucUser.setDestroy(parseDestroy(parser));
public void processPacket(Packet packet) { // Get the MUCUser extension MUCUser mucUser = (MUCUser) packet.getExtension("x", "http://jabber.org/protocol/muc#user"); // Check if the MUCUser extension includes an invitation if (mucUser.getInvite() != null && ((Message) packet).getType() != Message.Type.error) { // Fire event for invitation listeners fireInvitationListeners(packet.getFrom(), mucUser.getInvite().getFrom(), mucUser.getInvite().getReason(), mucUser.getPassword(), (Message) packet); } } };
String oldAffiliation = mucExtension.getItem().getAffiliation(); String oldRole = mucExtension.getItem().getRole(); String newAffiliation = mucExtension.getItem().getAffiliation(); String newRole = mucExtension.getItem().getRole(); occupantsMap.remove(from); MUCUser mucUser = getMUCUserExtension(presence); if (mucUser != null && mucUser.getStatus() != null) { mucUser.getStatus().getCode(), presence.getFrom().equals(myRoomJID), mucUser,
/** * Informs the sender of an invitation that the invitee declines the invitation. The rejection * will be sent to the room which in turn will forward the rejection to the inviter. * * @param conn the connection to use for sending the rejection. * @param room the room that sent the original invitation. * @param inviter the inviter of the declined invitation. * @param reason the reason why the invitee is declining the invitation. */ public static void decline(Connection conn, String room, String inviter, String reason) { Message message = new Message(room); // Create the MUCUser packet that will include the rejection MUCUser mucUser = new MUCUser(); MUCUser.Decline decline = new MUCUser.Decline(); decline.setTo(inviter); decline.setReason(reason); mucUser.setDecline(decline); // Add the MUCUser packet that includes the rejection message.addExtension(mucUser); conn.sendPacket(message); }
/** * Invites another user to the room in which one is an occupant using a given Message. The invitation * will be sent to the room which in turn will forward the invitation to the invitee.<p> * * If the room is password-protected, the invitee will receive a password to use to join * the room. If the room is members-only, the the invitee may be added to the member list. * * @param message the message to use for sending the invitation. * @param user the user to invite to the room.(e.g. hecate@shakespeare.lit) * @param reason the reason why the user is being invited. */ public void invite(Message message, String user, String reason) { // TODO listen for 404 error code when inviter supplies a non-existent JID message.setTo(room); // Create the MUCUser packet that will include the invitation MUCUser mucUser = new MUCUser(); MUCUser.Invite invite = new MUCUser.Invite(); invite.setTo(user); invite.setReason(reason); mucUser.setInvite(invite); // Add the MUCUser packet that includes the invitation to the message message.addExtension(mucUser); connection.sendPacket(message); }
new Object[] { mucUser.getItem().getActor(), mucUser.getItem().getReason()}); List params = new ArrayList(); params.add(from); params.add(mucUser.getItem().getActor()); params.add(mucUser.getItem().getReason()); fireParticipantStatusListeners("kicked", params); new Object[] { mucUser.getItem().getActor(), mucUser.getItem().getReason()}); List params = new ArrayList(); params.add(from); params.add(mucUser.getItem().getActor()); params.add(mucUser.getItem().getReason()); fireParticipantStatusListeners("banned", params); List params = new ArrayList(); params.add(from); params.add(mucUser.getItem().getNick()); fireParticipantStatusListeners("nicknameChanged", params);
MUCUser.Invite invite = mucUser != null ? mucUser.getInvite() : null; if (invite != null && workgroupJID.equals(invite.getFrom())) { String sessionID = null;
public void processPacket(Packet packet) { // Get the MUC User extension MUCUser mucUser = getMUCUserExtension(packet); // Check if the MUCUser informs that the invitee has declined the invitation if (mucUser.getDecline() != null && ((Message) packet).getType() != Message.Type.error) { // Fire event for invitation rejection listeners fireInvitationRejectionListeners( mucUser.getDecline().getFrom(), mucUser.getDecline().getReason()); } } };
String oldAffiliation = mucExtension.getItem().getAffiliation(); String oldRole = mucExtension.getItem().getRole(); String newAffiliation = mucExtension.getItem().getAffiliation(); String newRole = mucExtension.getItem().getRole(); occupantsMap.remove(from); MUCUser mucUser = getMUCUserExtension(presence); if (mucUser != null && mucUser.getStatus() != null) { mucUser.getStatus().getCode(), presence.getFrom().equals(myRoomJID), mucUser,
public void processPacket(Packet packet) { // Get the MUCUser extension MUCUser mucUser = (MUCUser) packet.getExtension("x", "http://jabber.org/protocol/muc#user"); // Check if the MUCUser extension includes an invitation if (mucUser.getInvite() != null && ((Message) packet).getType() != Message.Type.error) { // Fire event for invitation listeners fireInvitationListeners(packet.getFrom(), mucUser.getInvite().getFrom(), mucUser.getInvite().getReason(), mucUser.getPassword(), (Message) packet); } } };
/** * Informs the sender of an invitation that the invitee declines the invitation. The rejection * will be sent to the room which in turn will forward the rejection to the inviter. * * @param conn the connection to use for sending the rejection. * @param room the room that sent the original invitation. * @param inviter the inviter of the declined invitation. * @param reason the reason why the invitee is declining the invitation. */ public static void decline(XMPPConnection conn, String room, String inviter, String reason) { Message message = new Message(room); // Create the MUCUser packet that will include the rejection MUCUser mucUser = new MUCUser(); MUCUser.Decline decline = new MUCUser.Decline(); decline.setTo(inviter); decline.setReason(reason); mucUser.setDecline(decline); // Add the MUCUser packet that includes the rejection message.addExtension(mucUser); conn.sendPacket(message); }
/** * Invites another user to the room in which one is an occupant using a given Message. The invitation * will be sent to the room which in turn will forward the invitation to the invitee.<p> * * If the room is password-protected, the invitee will receive a password to use to join * the room. If the room is members-only, the the invitee may be added to the member list. * * @param message the message to use for sending the invitation. * @param user the user to invite to the room.(e.g. hecate@shakespeare.lit) * @param reason the reason why the user is being invited. */ public void invite(Message message, String user, String reason) { // TODO listen for 404 error code when inviter supplies a non-existent JID message.setTo(room); // Create the MUCUser packet that will include the invitation MUCUser mucUser = new MUCUser(); MUCUser.Invite invite = new MUCUser.Invite(); invite.setTo(user); invite.setReason(reason); mucUser.setInvite(invite); // Add the MUCUser packet that includes the invitation to the message message.addExtension(mucUser); connection.sendPacket(message); }
new Object[] { mucUser.getItem().getActor(), mucUser.getItem().getReason()}); List<String> params = new ArrayList<String>(); params.add(from); params.add(mucUser.getItem().getActor()); params.add(mucUser.getItem().getReason()); fireParticipantStatusListeners("kicked", params); new Object[] { mucUser.getItem().getActor(), mucUser.getItem().getReason()}); List<String> params = new ArrayList<String>(); params.add(from); params.add(mucUser.getItem().getActor()); params.add(mucUser.getItem().getReason()); fireParticipantStatusListeners("banned", params); List<String> params = new ArrayList<String>(); params.add(from); params.add(mucUser.getItem().getNick()); fireParticipantStatusListeners("nicknameChanged", params);
MUCUser.Invite invite = mucUser != null ? mucUser.getInvite() : null; if (invite != null && workgroupJID.equals(invite.getFrom())) { String sessionID = null;
public void processPacket(Packet packet) { // Get the MUC User extension MUCUser mucUser = getMUCUserExtension(packet); // Check if the MUCUser informs that the invitee has declined the invitation if (mucUser.getDecline() != null && ((Message) packet).getType() != Message.Type.error) { // Fire event for invitation rejection listeners fireInvitationRejectionListeners( mucUser.getDecline().getFrom(), mucUser.getDecline().getReason()); } } };
public String toXML() { StringBuilder buf = new StringBuilder(); buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); if (getInvite() != null) { buf.append(getInvite().toXML()); } if (getDecline() != null) { buf.append(getDecline().toXML()); } if (getItem() != null) { buf.append(getItem().toXML()); } if (getPassword() != null) { buf.append("<password>").append(getPassword()).append("</password>"); } if (getStatus() != null) { buf.append(getStatus().toXML()); } if (getDestroy() != null) { buf.append(getDestroy().toXML()); } buf.append("</").append(getElementName()).append(">"); return buf.toString(); }
MUCUser mucUser = new MUCUser(); boolean done = false; while (!done) { if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("invite")) { mucUser.setInvite(parseInvite(parser)); mucUser.setItem(parseItem(parser)); mucUser.setPassword(parser.nextText()); mucUser.setStatus(new MUCUser.Status(parser.getAttributeValue("", "code"))); mucUser.setDecline(parseDecline(parser)); mucUser.setDestroy(parseDestroy(parser));