mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 05:51:08 +01:00
Enable PacketExtensions for IQs
This is actually only part one, i.e. with this commit if the user adds a PacketExtension to an IQ it will be included in IQ.toXml(). Which was previously only the case if the IQ subclass explicitly included packet extensions. The second part of the change is to change the IQ provider, so that packet extensions are automatically parsed. Cases where PacketExtensions are used for Message and IQ are slightly changed. The IQ sublcass now only has a field with this PacketExtension (see for example bytestreams.ibb.packet.DataPacketExtension). Also changed hoxt API: Removed unnecessary indirection and made the API more Smack idiomatic.
This commit is contained in:
parent
a9c798f3bb
commit
9e797c1b17
93 changed files with 1347 additions and 1438 deletions
|
|
@ -36,8 +36,15 @@ import java.util.List;
|
|||
*/
|
||||
public class SharedGroupsInfo extends IQ {
|
||||
|
||||
public static final String ELEMENT = "sharedgroup";
|
||||
public static final String NAMESPACE = "http://www.jivesoftware.org/protocol/sharedgroup";
|
||||
|
||||
private List<String> groups = new ArrayList<String>();
|
||||
|
||||
public SharedGroupsInfo() {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a collection with the shared group names returned from the server.
|
||||
*
|
||||
|
|
@ -47,14 +54,13 @@ public class SharedGroupsInfo extends IQ {
|
|||
return groups;
|
||||
}
|
||||
|
||||
public String getChildElementXML() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<sharedgroup xmlns=\"http://www.jivesoftware.org/protocol/sharedgroup\">");
|
||||
@Override
|
||||
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
||||
buf.rightAngleBracket();
|
||||
for (String group : groups) {
|
||||
buf.append("<group>").append(group).append("</group>");
|
||||
buf.element("group", group);
|
||||
}
|
||||
buf.append("</sharedgroup>");
|
||||
return buf.toString();
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue