mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22:05 +01:00
Refactoring work.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3179 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
647d6323ca
commit
38f7e5bba7
1 changed files with 18 additions and 13 deletions
|
@ -79,14 +79,7 @@ class PacketReader {
|
|||
listenerThread.setName("Smack Listener Processor");
|
||||
listenerThread.setDaemon(true);
|
||||
|
||||
try {
|
||||
parser = new MXParser();
|
||||
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
||||
parser.setInput(connection.reader);
|
||||
}
|
||||
catch (XmlPullParserException xppe) {
|
||||
xppe.printStackTrace();
|
||||
}
|
||||
resetParser();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,9 +217,16 @@ class PacketReader {
|
|||
* when the plain connection has been secured or when a new opening stream element is going
|
||||
* to be sent by the server.
|
||||
*/
|
||||
private void resetParser() throws XmlPullParserException {
|
||||
private void resetParser() {
|
||||
try {
|
||||
parser = new MXParser();
|
||||
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
||||
parser.setInput(connection.reader);
|
||||
}
|
||||
catch (XmlPullParserException xppe) {
|
||||
xppe.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process listeners.
|
||||
|
@ -335,12 +335,17 @@ class PacketReader {
|
|||
connection.getSASLAuthentication().challengeReceived(parser.nextText());
|
||||
}
|
||||
else if (parser.getName().equals("success")) {
|
||||
// The SASL authentication with the server was successful. The next step
|
||||
// will be to bind the resource
|
||||
connection.getSASLAuthentication().authenticated();
|
||||
// We now need to bind a resource for the connection
|
||||
// Open a new stream and wait for the response
|
||||
connection.packetWriter.openStream();
|
||||
|
||||
// Reset the state of the parser since a new stream element is going
|
||||
// to be sent by the server
|
||||
resetParser();
|
||||
|
||||
// The SASL authentication with the server was successful. The next step
|
||||
// will be to bind the resource
|
||||
connection.getSASLAuthentication().authenticated();
|
||||
}
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
|
|
Loading…
Reference in a new issue