mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 18:29:45 +02:00
Use XmlEnvironment in parsing/provider subsystem
This commit is contained in:
parent
43bb418d99
commit
8df69bd3ce
188 changed files with 486 additions and 264 deletions
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.ox.provider;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smackx.ox.element.CryptElement;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class CryptElementProvider extends OpenPgpContentElementProvider<CryptEle
|
|||
public static final CryptElementProvider INSTANCE = new CryptElementProvider();
|
||||
|
||||
@Override
|
||||
public CryptElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
|
||||
public CryptElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||
OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth);
|
||||
|
||||
return new CryptElement(data.to, data.rpad, data.timestamp, data.payload);
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.provider.ProviderManager;
|
||||
|
@ -79,7 +80,7 @@ public abstract class OpenPgpContentElementProvider<O extends OpenPgpContentElem
|
|||
}
|
||||
|
||||
@Override
|
||||
public abstract O parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException;
|
||||
public abstract O parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException;
|
||||
|
||||
protected static OpenPgpContentElementData parseOpenPgpContentElementData(XmlPullParser parser, int initialDepth)
|
||||
throws XmlPullParserException, IOException, SmackParsingException {
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.ox.provider;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smackx.ox.element.OpenPgpElement;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class OpenPgpElementProvider extends ExtensionElementProvider<OpenPgpElem
|
|||
public static final OpenPgpElementProvider TEST_INSTANCE = new OpenPgpElementProvider();
|
||||
|
||||
@Override
|
||||
public OpenPgpElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
|
||||
public OpenPgpElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
|
||||
String base64EncodedOpenPgpMessage = parser.nextText();
|
||||
return new OpenPgpElement(base64EncodedOpenPgpMessage);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
|||
import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
|
@ -38,7 +39,7 @@ public class PubkeyElementProvider extends ExtensionElementProvider<PubkeyElemen
|
|||
public static final PubkeyElementProvider TEST_INSTANCE = new PubkeyElementProvider();
|
||||
|
||||
@Override
|
||||
public PubkeyElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackTextParseException {
|
||||
public PubkeyElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackTextParseException {
|
||||
String dateString = parser.getAttributeValue(null, PubkeyElement.ATTR_DATE);
|
||||
Date date = ParserUtils.getDateFromOptionalXep82String(dateString);
|
||||
while (true) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import static org.xmlpull.v1.XmlPullParser.START_TAG;
|
|||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
|
@ -36,7 +37,7 @@ public final class PublicKeysListElementProvider extends ExtensionElementProvide
|
|||
public static final PublicKeysListElementProvider TEST_INSTANCE = new PublicKeysListElementProvider();
|
||||
|
||||
@Override
|
||||
public PublicKeysListElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackTextParseException {
|
||||
public PublicKeysListElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackTextParseException {
|
||||
|
||||
PublicKeysListElement.Builder builder = PublicKeysListElement.builder();
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.ox.provider;
|
|||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smackx.ox.element.SecretkeyElement;
|
||||
|
||||
|
@ -33,7 +34,7 @@ public class SecretkeyElementProvider extends ExtensionElementProvider<Secretkey
|
|||
public static final SecretkeyElementProvider TEST_INSTANCE = new SecretkeyElementProvider();
|
||||
|
||||
@Override
|
||||
public SecretkeyElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
|
||||
public SecretkeyElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
|
||||
String data = parser.nextText();
|
||||
return new SecretkeyElement(data.getBytes(Charset.forName("UTF-8")));
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.ox.provider;
|
|||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.ox.element.SignElement;
|
||||
|
@ -35,7 +36,7 @@ public class SignElementProvider extends OpenPgpContentElementProvider<SignEleme
|
|||
public static final SignElementProvider INSTANCE = new SignElementProvider();
|
||||
|
||||
@Override
|
||||
public SignElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
|
||||
public SignElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||
OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth);
|
||||
|
||||
if (StringUtils.isNotEmpty(data.rpad)) {
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.ox.provider;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smackx.ox.element.SigncryptElement;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class SigncryptElementProvider extends OpenPgpContentElementProvider<Sign
|
|||
public static final SigncryptElementProvider INSTANCE = new SigncryptElementProvider();
|
||||
|
||||
@Override
|
||||
public SigncryptElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackParsingException {
|
||||
public SigncryptElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||
OpenPgpContentElementData data = parseOpenPgpContentElementData(parser, initialDepth);
|
||||
return new SigncryptElement(data.to, data.rpad, data.timestamp, data.payload);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue