1 20 21 package org.jivesoftware.smackx; 22 23 import org.jivesoftware.smack.packet.PacketExtension; 24 import org.jivesoftware.smack.provider.PacketExtensionProvider; 25 import org.xmlpull.v1.XmlPullParser; 26 27 56 public class GroupChatInvitation implements PacketExtension { 57 58 61 public static final String ELEMENT_NAME = "x"; 62 63 66 public static final String NAMESPACE = "jabber:x:conference"; 67 68 private String roomAddress; 69 70 78 public GroupChatInvitation(String roomAddress) { 79 this.roomAddress = roomAddress; 80 } 81 82 89 public String getRoomAddress() { 90 return roomAddress; 91 } 92 93 public String getElementName() { 94 return ELEMENT_NAME; 95 } 96 97 public String getNamespace() { 98 return NAMESPACE; 99 } 100 101 public String toXML() { 102 StringBuffer buf = new StringBuffer (); 103 buf.append("<x xmlns=\"jabber:x:conference\" jid=\"").append(roomAddress).append("\"/>"); 104 return buf.toString(); 105 } 106 107 public static class Provider implements PacketExtensionProvider { 108 public PacketExtension parseExtension (XmlPullParser parser) throws Exception { 109 String roomAddress = parser.getAttributeValue("", "jid"); 110 parser.next(); 112 return new GroupChatInvitation(roomAddress); 113 } 114 } 115 } | Popular Tags |