mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22:05 +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:
parent
2271ca730e
commit
2b22cde400
1 changed files with 8 additions and 9 deletions
|
@ -68,8 +68,13 @@ class PacketReader {
|
||||||
|
|
||||||
listenerThread = new Thread() {
|
listenerThread = new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
try {
|
||||||
processListeners();
|
processListeners();
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
listenerThread.setName("Smack Listener Processor");
|
listenerThread.setName("Smack Listener Processor");
|
||||||
listenerThread.setDaemon(true);
|
listenerThread.setDaemon(true);
|
||||||
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue