1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 02:58:00 +01:00

Add ELEMENT and NAMESPACE to RosterPacket

This commit is contained in:
Florian Schmaus 2014-09-12 13:40:04 +02:00
parent c024931de8
commit d57fecfcc9
2 changed files with 7 additions and 4 deletions

View file

@ -34,6 +34,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
*/ */
public class RosterPacket extends IQ { public class RosterPacket extends IQ {
public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = "jabber:iq:roster";
private final List<Item> rosterItems = new ArrayList<Item>(); private final List<Item> rosterItems = new ArrayList<Item>();
private String rosterVersion; private String rosterVersion;
@ -73,8 +76,8 @@ public class RosterPacket extends IQ {
@Override @Override
public XmlStringBuilder getChildElementXML() { public XmlStringBuilder getChildElementXML() {
XmlStringBuilder buf = new XmlStringBuilder(); XmlStringBuilder buf = new XmlStringBuilder();
buf.halfOpenElement("query"); buf.halfOpenElement(ELEMENT);
buf.xmlnsAttribute("jabber:iq:roster"); buf.xmlnsAttribute(NAMESPACE);
buf.optAttribute("ver", rosterVersion); buf.optAttribute("ver", rosterVersion);
buf.rightAngleBracket(); buf.rightAngleBracket();
@ -83,7 +86,7 @@ public class RosterPacket extends IQ {
buf.append(entry.toXML()); buf.append(entry.toXML());
} }
} }
buf.closeElement("query"); buf.closeElement(ELEMENT);
return buf; return buf;
} }

View file

@ -534,7 +534,7 @@ public class PacketParserUtils {
if (elementName.equals("error")) { if (elementName.equals("error")) {
error = PacketParserUtils.parseError(parser); error = PacketParserUtils.parseError(parser);
} }
else if (elementName.equals("query") && namespace.equals("jabber:iq:roster")) { else if (elementName.equals(RosterPacket.ELEMENT) && namespace.equals(RosterPacket.NAMESPACE)) {
iqPacket = parseRoster(parser); iqPacket = parseRoster(parser);
} }
else if (elementName.equals(Bind.ELEMENT) && namespace.equals(Bind.NAMESPACE)) { else if (elementName.equals(Bind.ELEMENT) && namespace.equals(Bind.NAMESPACE)) {