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

Cleanup of IQ parsing.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2008 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-08-04 21:58:31 +00:00 committed by mtucker
parent a63fb745c0
commit 8ed06a4f06

View file

@ -347,7 +347,6 @@ class PacketReader {
String from = parser.getAttributeValue("", "from"); String from = parser.getAttributeValue("", "from");
IQ.Type type = IQ.Type.fromString(parser.getAttributeValue("", "type")); IQ.Type type = IQ.Type.fromString(parser.getAttributeValue("", "type"));
XMPPError error = null; XMPPError error = null;
Map properties = null;
boolean done = false; boolean done = false;
while (!done) { while (!done) {
@ -391,21 +390,19 @@ class PacketReader {
} }
// Set basic values on the iq packet. // Set basic values on the iq packet.
if (iqPacket == null) { if (iqPacket == null) {
iqPacket = new IQ(); // If an IQ packet wasn't created above, create an empty IQ packet.
iqPacket = new IQ() {
public String getChildElementXML() {
return null;
}
};
} }
iqPacket.setPacketID(id); iqPacket.setPacketID(id);
iqPacket.setTo(to); iqPacket.setTo(to);
iqPacket.setFrom(from); iqPacket.setFrom(from);
iqPacket.setType(type); iqPacket.setType(type);
iqPacket.setError(error); iqPacket.setError(error);
// Set packet properties.
if (properties != null) {
for (Iterator i=properties.keySet().iterator(); i.hasNext(); ) {
String name = (String)i.next();
iqPacket.setProperty(name, properties.get(name));
}
}
// Return the packet.
return iqPacket; return iqPacket;
} }