mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-14 15:01:07 +01:00
Rework Smack Provider design
this is the first stop towards fixing "SMACK-65: parsing should look for depth", by providing the initial parsing depth to the provider. Some methods (.e.g parseMessage) now use the depth as abort condition, instead of a unclean String equals check. parseIQ() and parseExtension() where both renamed to parse. This also restricts the Exceptions thrown by the parse method, to just XmlPullParserException, IOException and SmackException (not really a big victory, but nevertheless a slight improvement). StreamFeatureProvider is now gone, we simply use PacketExtensionProvider for stream features.
This commit is contained in:
parent
d04517cd08
commit
6980c8e63d
137 changed files with 1101 additions and 841 deletions
|
|
@ -19,17 +19,15 @@ package org.jivesoftware.smackx.caps.provider;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||
import org.jivesoftware.smack.provider.StreamFeatureProvider;
|
||||
import org.jivesoftware.smackx.caps.EntityCapsManager;
|
||||
import org.jivesoftware.smackx.caps.packet.CapsExtension;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
public class CapsExtensionProvider implements PacketExtensionProvider, StreamFeatureProvider {
|
||||
public class CapsExtensionProvider extends PacketExtensionProvider<CapsExtension> {
|
||||
|
||||
public PacketExtension parseExtension(XmlPullParser parser) throws XmlPullParserException, IOException,
|
||||
public CapsExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException,
|
||||
SmackException {
|
||||
String hash = null;
|
||||
String version = null;
|
||||
|
|
@ -57,9 +55,4 @@ public class CapsExtensionProvider implements PacketExtensionProvider, StreamFea
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketExtension parseStreamFeature(XmlPullParser parser) throws XmlPullParserException,
|
||||
IOException, SmackException {
|
||||
return parseExtension(parser);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue