01: /**
02: * Copyright (C) 2004-2007 Jive Software. All rights reserved.
03: *
04: * This software is published under the terms of the GNU Public License (GPL),
05: * a copy of which is included in this distribution.
06: */package org.xmpp.muc;
07:
08: import org.dom4j.Element;
09: import org.xmpp.packet.IQ;
10: import org.xmpp.packet.JID;
11:
12: /**
13: * DestroyRoom is a packet that when sent will ask the server to destroy a given room. The room to
14: * destroy must be specified in the TO attribute of the IQ packet. The server will send a presence
15: * unavailable together with the alternate room and reason for the destruction to all the room
16: * occupants before destroying the room.<p>
17: *
18: * When destroying a room it is possible to provide an alternate room which may be replacing the
19: * room about to be destroyed. It is also possible to provide a reason for the room destruction.
20: */
21: public class DestroyRoom extends IQ {
22:
23: /**
24: * Creates a new DestroyRoom with the reason for the destruction and an alternate room JID.
25: *
26: * @param alternateJID JID of the alternate room or <tt>null</tt> if none.
27: * @param reason reason for the destruction or <tt>null</tt> if none.
28: */
29: public DestroyRoom(JID alternateJID, String reason) {
30: super ();
31: setType(Type.set);
32: Element query = setChildElement("query",
33: "http://jabber.org/protocol/muc#owner");
34: Element destroy = query.addElement("destroy");
35: if (alternateJID != null) {
36: destroy.addAttribute("jid", alternateJID.toString());
37: }
38: if (reason != null) {
39: destroy.addElement("reason").setText(reason);
40: }
41: }
42: }
|