1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 15:32:06 +01:00

Refer to constants statically (from Nuno).

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1868 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-04-08 15:32:26 +00:00 committed by mtucker
parent af4ea681ee
commit 7e110a954f

View file

@ -53,6 +53,7 @@
package org.jivesoftware.smack; package org.jivesoftware.smack;
import org.xmlpull.v1.*; import org.xmlpull.v1.*;
import java.util.*; import java.util.*;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -250,7 +251,7 @@ class PacketReader {
try { try {
int eventType = parser.getEventType(); int eventType = parser.getEventType();
do { do {
if (eventType == parser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("message")) { if (parser.getName().equals("message")) {
processPacket(parseMessage(parser)); processPacket(parseMessage(parser));
} }
@ -278,13 +279,13 @@ class PacketReader {
} }
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("stream")) { if (parser.getName().equals("stream")) {
connection.close(); connection.close();
} }
} }
eventType = parser.next(); eventType = parser.next();
} while (eventType != parser.END_DOCUMENT && !done); } while (eventType != XmlPullParser.END_DOCUMENT && !done);
} }
catch (Exception e) { catch (Exception e) {
if (!done) { if (!done) {
@ -348,7 +349,7 @@ class PacketReader {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == parser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("query")) { if (parser.getName().equals("query")) {
String namespace = parser.getNamespace(); String namespace = parser.getNamespace();
if (namespace.equals("jabber:iq:auth")) { if (namespace.equals("jabber:iq:auth")) {
@ -370,7 +371,7 @@ class PacketReader {
properties = parseProperties(parser); properties = parseProperties(parser);
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("iq")) { if (parser.getName().equals("iq")) {
done = true; done = true;
} }
@ -401,7 +402,7 @@ class PacketReader {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == parser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("username")) { if (parser.getName().equals("username")) {
authentication.setUsername(parser.nextText()); authentication.setUsername(parser.nextText());
} }
@ -415,7 +416,7 @@ class PacketReader {
authentication.setResource(parser.nextText()); authentication.setResource(parser.nextText());
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("query")) { if (parser.getName().equals("query")) {
done = true; done = true;
} }
@ -430,7 +431,7 @@ class PacketReader {
RosterPacket.Item item = null; RosterPacket.Item item = null;
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == parser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("item")) { if (parser.getName().equals("item")) {
String jid = parser.getAttributeValue("", "jid"); String jid = parser.getAttributeValue("", "jid");
String name = parser.getAttributeValue("", "name"); String name = parser.getAttributeValue("", "name");
@ -443,7 +444,7 @@ class PacketReader {
item.addGroupName(groupName); item.addGroupName(groupName);
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("item")) { if (parser.getName().equals("item")) {
roster.addRosterItem(item); roster.addRosterItem(item);
} }
@ -461,7 +462,7 @@ class PacketReader {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == parser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("username")) { if (parser.getName().equals("username")) {
registration.setUsername(parser.nextText()); registration.setUsername(parser.nextText());
} }
@ -480,7 +481,7 @@ class PacketReader {
} }
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("query")) { if (parser.getName().equals("query")) {
done = true; done = true;
} }
@ -506,7 +507,7 @@ class PacketReader {
} }
String message = parser.nextText(); String message = parser.nextText();
while (true) { while (true) {
if (parser.getEventType() == parser.END_TAG && parser.getName().equals("error")) { if (parser.getEventType() == XmlPullParser.END_TAG && parser.getName().equals("error")) {
break; break;
} }
} }
@ -536,7 +537,7 @@ class PacketReader {
Map properties = null; Map properties = null;
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == parser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("subject")) { if (parser.getName().equals("subject")) {
if (subject == null) { if (subject == null) {
subject = parser.nextText(); subject = parser.nextText();
@ -561,7 +562,7 @@ class PacketReader {
properties = parseProperties(parser); properties = parseProperties(parser);
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("message")) { if (parser.getName().equals("message")) {
done = true; done = true;
} }
@ -605,7 +606,7 @@ class PacketReader {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == parser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("status")) { if (parser.getName().equals("status")) {
presence.setStatus(parser.nextText()); presence.setStatus(parser.nextText());
} }
@ -633,7 +634,7 @@ class PacketReader {
} }
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("presence")) { if (parser.getName().equals("presence")) {
done = true; done = true;
} }
@ -657,7 +658,7 @@ class PacketReader {
Map properties = new HashMap(); Map properties = new HashMap();
while (true) { while (true) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == parser.START_TAG && parser.getName().equals("property")) { if (eventType == XmlPullParser.START_TAG && parser.getName().equals("property")) {
// Advance to name element. // Advance to name element.
parser.next(); parser.next();
String name = parser.nextText(); String name = parser.nextText();
@ -697,7 +698,7 @@ class PacketReader {
properties.put(name, value); properties.put(name, value);
} }
} }
else if (eventType == parser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("x")) { if (parser.getName().equals("x")) {
break; break;
} }