1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-30 10:12:06 +01:00

1. Username and password are optional in Registration. SMACK-62

2. Added try/catch block when invoking packet listeners.


git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2504 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-06-17 22:29:33 +00:00 committed by gaston
parent 2271ca730e
commit 2b22cde400

View file

@ -68,7 +68,12 @@ class PacketReader {
listenerThread = new Thread() { listenerThread = new Thread() {
public void run() { public void run() {
processListeners(); try {
processListeners();
}
catch (Exception e) {
e.printStackTrace();
}
} }
}; };
listenerThread.setName("Smack Listener Processor"); listenerThread.setName("Smack Listener Processor");
@ -499,15 +504,9 @@ class PacketReader {
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("username")) { // Any element that's in the jabber:iq:register namespace,
registration.setUsername(parser.nextText());
}
else if (parser.getName().equals("password")) {
registration.setPassword(parser.nextText());
}
// Else if any other element that's in the jabber:iq:register namespace,
// attempt to parse it if it's in the form <name>value</name>. // attempt to parse it if it's in the form <name>value</name>.
else if (parser.getNamespace().equals("jabber:iq:register")) { if (parser.getNamespace().equals("jabber:iq:register")) {
String name = parser.getName(); String name = parser.getName();
String value = ""; String value = "";
if (fields == null) { if (fields == null) {