mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Moved resource binding parsing as a core IQ packet. SMACK-124
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3492 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
74ca03f5b3
commit
5247fce7ca
3 changed files with 28 additions and 36 deletions
|
@ -20,9 +20,6 @@
|
|||
|
||||
package org.jivesoftware.smack.packet;
|
||||
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
/**
|
||||
* IQ packet used by Smack to bind a resource and to obtain the jid assigned by the server.
|
||||
* There are two ways to bind a resource. One is simply sending an empty Bind packet where the
|
||||
|
@ -71,29 +68,4 @@ public class Bind extends IQ {
|
|||
buf.append("</bind>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static class Provider implements IQProvider {
|
||||
|
||||
public IQ parseIQ(XmlPullParser parser) throws Exception {
|
||||
Bind bind = new Bind();
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
if (parser.getName().equals("resource")) {
|
||||
bind.setResource(parser.nextText());
|
||||
}
|
||||
else if (parser.getName().equals("jid")) {
|
||||
bind.setJid(parser.nextText());
|
||||
}
|
||||
} else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("bind")) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bind;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue