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

Improve parsing. Add method for de-serializing Strings

Move some duplicate code from XMPP(TCP|BOSH)Connection to
PacketParserUtils. Remove TestUtils as the method now part of Smack's
public API in PacketParserUtils.
This commit is contained in:
Florian Schmaus 2014-05-25 23:31:58 +02:00
parent beecb8a675
commit 3647a7fce5
24 changed files with 215 additions and 291 deletions

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smack.bosh;
import java.io.StringReader;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.sasl.SASLMechanism.Challenge;
import org.jivesoftware.smack.sasl.SASLMechanism.SASLFailure;
import org.jivesoftware.smack.sasl.SASLMechanism.Success;
@ -75,14 +76,9 @@ public class BOSHPacketReader implements BOSHClientResponseListener {
do {
eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("body")) {
// ignore the container root element
} else if (parser.getName().equals("message")) {
connection.processPacket(PacketParserUtils.parseMessage(parser));
} else if (parser.getName().equals("iq")) {
connection.processPacket(PacketParserUtils.parseIQ(parser, connection));
} else if (parser.getName().equals("presence")) {
connection.processPacket(PacketParserUtils.parsePresence(parser));
Packet packet = PacketParserUtils.parseStanza(parser, connection);
if (packet != null) {
connection.processPacket(packet);
} else if (parser.getName().equals("challenge")) {
// The server is challenging the SASL authentication
// made by the client