1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

Rename IQ.ELEMENT to IQ.IQ_ELEMENT

to avoid confusion between the IQ element 'iq' and the IQs child
element. ELEMENT defined in an IQ sublcass should contain the *child*
element.

Add element to StreamInitation and fix FileTransferManager which still
used a packet listener instead of an IQ request handler to handle
incoming stream initiation requests.
This commit is contained in:
Florian Schmaus 2015-01-11 21:52:06 +01:00
parent f1a1215f35
commit b0cecee710
6 changed files with 19 additions and 15 deletions

View file

@ -40,7 +40,8 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
*/
public abstract class IQ extends Packet {
public static final String ELEMENT = "iq";
// Don't name this field 'ELEMENT'. When it comes to IQ, ELEMENT is the child element!
public static final String IQ_ELEMENT = "iq";
public static final String QUERY_ELEMENT = "query";
private final String childElementName;
@ -98,7 +99,7 @@ public abstract class IQ extends Packet {
@Override
public final XmlStringBuilder toXML() {
XmlStringBuilder buf = new XmlStringBuilder();
buf.halfOpenElement(ELEMENT);
buf.halfOpenElement(IQ_ELEMENT);
addCommonAttributes(buf);
if (type == null) {
buf.attribute("type", "get");
@ -108,7 +109,7 @@ public abstract class IQ extends Packet {
}
buf.rightAngleBracket();
buf.append(getChildElementXML());
buf.closeElement(ELEMENT);
buf.closeElement(IQ_ELEMENT);
return buf;
}

View file

@ -149,7 +149,7 @@ public class PacketParserUtils {
switch (name) {
case Message.ELEMENT:
return parseMessage(parser);
case IQ.ELEMENT:
case IQ.IQ_ELEMENT:
return parseIQ(parser);
case Presence.ELEMENT:
return parsePresence(parser);