1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 05:22:06 +01:00

Compare commits

...

30 commits

Author SHA1 Message Date
Florian Schmaus
44ad01a346
Merge pull request #532 from Flowdalic/gradlew
Add gradle wrapper
2022-06-07 08:56:27 +02:00
Florian Schmaus
4f72eca21c Add gradle wrapper
I am not happy with the concept of a build system wrapper, not to say
that I despise it. There is no reason why a single machine couldn't
have multiple versions of a build system-wide installed, and there is
no reason why each developer should download an individual copy of a
build system into the developers home directory. But here we are…
2022-06-07 08:46:18 +02:00
Florian Schmaus
6be3eb194a Merge branch '4.4' 2022-06-07 08:41:46 +02:00
Florian Schmaus
382ec723a8
Merge pull request #531 from Flowdalic/truely-async-sends
[core] Add AbstractXMPPConnection.TRUELY_ASYNC_SENDS
2022-06-06 10:01:28 +02:00
Florian Schmaus
66370c7ef5 [core] Add SmackConfiguration.TRUELY_ASYNC_SENDS
This option is meant a quick and dirty hack until
XMPPConnection.sendStanza() throws a dedicated Exception in case the
connection's outgoing queue is full.
2022-06-06 09:52:57 +02:00
Florian Schmaus
52a3490e07
Merge pull request #530 from Flowdalic/fix-bosh-url
[bosh] Fix BOSHConfiguration.getURI()
2022-05-26 20:21:14 +02:00
Florian Schmaus
8ebe453363 [bosh] Fix BOSHConfiguration.getURI()
Reported-by: Damian Minkov <damencho@jitsi.org>
Fixes: aa441d743c ("[bosh] Use ConnectionConfiguration.getHostString() in BOSHConfiguration")
2022-05-26 19:53:06 +02:00
Florian Schmaus
70d0843dd8 Merge branch '4.4' 2022-05-26 18:13:29 +02:00
Florian Schmaus
c9af6576c0
Merge pull request #529 from Flowdalic/fix-sd-memleak
[disco] Fix memory leak in ServiceDiscoveryManager
2022-05-26 18:11:54 +02:00
Florian Schmaus
69e81b748e [disco] Only perform entity capabilities work if there are any listeners 2022-05-26 18:03:36 +02:00
Florian Schmaus
5b6dd8e3f7 [disco] Fix memory leak in ServiceDiscoveryManager
The lambda we schedule in 25ms captures a strong reference to the
XMPPConnection. However the lambda is part of the scheduled action,
which we save in the renewEntityCapsScheduledAction field. This causes
a memory leak, since the ServiceDiscoveryManager now holds a strong
reference to its XMPPConnection.

Fix this by obtaining the strong reference to the XMPPConnection, if
one still exists, within the lambda.

Fixes SMACK-926.

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-05-26 15:39:41 +02:00
Florian Schmaus
c84ac4b2ae Merge branch '4.4' 2022-05-23 12:32:29 +02:00
Florian Schmaus
f402a9d12d
Merge pull request #528 from Flowdalic/fix-mux-presence-interceptor
[muc] Fix Presence interceptors
2022-05-23 12:30:58 +02:00
Florian Schmaus
60fee7b318 [muc] Fix Presence interceptors
Presence interceptors where hooked into stanza sending listeners,
which are called *after* the stanza has been put on the wire, i.e., to
late for interceptors that any modifications, they may perform, to
take effect.

Fixes SMACK-925.

We now also dynamically add the MUC's main presence interceptor to the
connection.

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-05-22 10:51:45 +02:00
Florian Schmaus
e51bfb1dbe Merge branch '4.4' 2022-05-18 21:46:19 +02:00
Florian Schmaus
aa441d743c [bosh] Use ConnectionConfiguration.getHostString() in BOSHConfiguration 2022-05-18 21:45:32 +02:00
Florian Schmaus
00bcbff5ee [core] Add ConnectionConfiguration.getHostString() 2022-05-18 21:45:00 +02:00
Florian Schmaus
9b6e209b5f
Merge pull request #526 from damencho/fix-bosh-ip-address-4.4
fix: Bosh configuration when bosh URI contains IP address.
2022-05-18 16:50:16 +02:00
Дамян Минков
d0db485c24 fix: Bosh configuration when bosh URI contains IP address. 2022-05-18 08:08:47 -05:00
Florian Schmaus
70abd8a182 Merge branch '4.4' 2022-04-30 15:16:24 +02:00
Florian Schmaus
881ebe731d [core] Fix typo in javadoc 2022-04-30 15:15:51 +02:00
Florian Schmaus
1f5326abb2 [core] Inline waitForConditionOrConnectionException
Using any of the two methods is error prone, see 0e0c0a4093 ("[tcp]
Fix handling in connection exceptions when resuming a stream"), as one
can easily forget to check for connection exceptions after it
returned. There are also no longer any call sites of those methods.

Let's inline both variants of this method.
2022-04-30 15:15:42 +02:00
Florian Schmaus
0e0c0a4093 [tcp] Fix handling in connection exceptions when resuming a stream
Smack would previous run into "assert smResumptionFailed != null;" at
line 407, since if a connection exception was encountered,
waitForConditionOrConnectionException() would return, but we afterards
just assumed that either SM resumption was successful or not.
2022-04-30 15:06:15 +02:00
Florian Schmaus
ef003bbc5c
Merge pull request #523 from jitsi/remove-legacy-iqprovider
Replace legacy IQProvider with IqProvider
2022-04-03 11:58:48 +02:00
Ingo Bauersachs
4efa707028 Replace legacy IQProvider with IqProvider 2022-04-02 16:02:46 +02:00
Florian Schmaus
78ffcae880 Merge branch '4.4' 2022-03-06 21:46:10 +01:00
Florian Schmaus
95ff591c14 [xdata] Only emit warning about unregistered fields once per field 2022-03-06 21:44:33 +01:00
Florian Schmaus
2ae4c4410a
Merge pull request #521 from vanitasvitae/bumpPGPainless
Bump PGPainless to 1.1.1, Bouncy Castle to 1.70
2022-03-04 07:55:47 +01:00
b769be516e
Bump PGPainless to 1.1.1, Bouncy Castle to 1.70 2022-03-03 10:31:04 +01:00
Florian Schmaus
162d8ba30b Smack 4.4.6-SNAPSHOT 2022-03-02 22:22:16 +01:00
108 changed files with 768 additions and 330 deletions

View file

@ -1,8 +1,5 @@
name: CI
env:
GRADLE_VERSION: 6.7.1
on: [push, pull_request]
jobs:
@ -41,12 +38,6 @@ jobs:
key: gradle-caches-${{ hashFiles('**/build.gradle') }}
restore-keys:
gradle-caches
- name: Cache Gradle Binary
uses: actions/cache@v2
with:
path: |
~/gradle-bin-${GRADLE_VERSION}/
key: gradle-bin-${GRADLE_VERSION}
- name: Cache Android SDK
uses: actions/cache@v2
with:
@ -57,11 +48,6 @@ jobs:
android-
# Pre-reqs
- name: Grab gradle wrapper
run: |
wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
unzip gradle-${GRADLE_VERSION}-all.zip
echo "PATH_TO_GRADLE=./gradle-${GRADLE_VERSION}/bin/gradle" >> $GITHUB_ENV
- name: Install GraphViz
run: sudo apt update && sudo apt install graphviz
- name: Install Android SDK Manager
@ -72,21 +58,21 @@ jobs:
# Testing
- name: Gradle Check
run: ${PATH_TO_GRADLE} check --stacktrace
run: ./gradlew check --stacktrace
# Test local publish
- name: Gradle publish
run: ${PATH_TO_GRADLE} publishToMavenLocal --stacktrace
run: ./gradlew publishToMavenLocal --stacktrace
# Javadoc
- name: Javadoc
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
run: ${PATH_TO_GRADLE} javadocAll --stacktrace
run: ./gradlew javadocAll --stacktrace
# Test Coverage Report
- name: Jacoco Test Coverage
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
run: ${PATH_TO_GRADLE} jacocoRootReport coveralls
run: ./gradlew jacocoRootReport coveralls
env:
COVERALLS_REPO_TOKEN: S2ecSJja2cKJa9yv45C8ZFPohXuRrTXKd

View file

@ -148,7 +148,7 @@ allprojects {
smackMinAndroidSdk = 19
junitVersion = '5.7.1'
commonsIoVersion = '2.6'
bouncyCastleVersion = '1.69'
bouncyCastleVersion = '1.70'
guavaVersion = '30.1-jre'
mockitoVersion = '3.7.7'
orgReflectionsVersion = '0.9.11'

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Executable file
View file

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View file

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View file

@ -77,7 +77,8 @@ public final class BOSHConfiguration extends ConnectionConfiguration {
}
public URI getURI() throws URISyntaxException {
return new URI((https ? "https://" : "http://") + this.host + ":" + this.port + file);
String uri = (https ? "https://" : "http://") + getHostString() + ":" + this.port + file;
return new URI(uri);
}
public Map<String, String> getHttpHeaders() {

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2009 Jive Software, 2018-2021 Florian Schmaus.
* Copyright 2009 Jive Software, 2018-2022 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -694,10 +694,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
/**
* We use an extra object for {@link #notifyWaitingThreads()} and {@link #waitForConditionOrConnectionException(Supplier)}, because all state
* We use an extra object for {@link #notifyWaitingThreads()} and {@link #waitFor(Supplier)}, because all state
* changing methods of the connection are synchronized using the connection instance as monitor. If we now would
* also use the connection instance for the internal process to wait for a condition, the {@link Object#wait()}
* would leave the monitor when it waites, which would allow for another potential call to a state changing function
* would leave the monitor when it waits, which would allow for another potential call to a state changing function
* to proceed.
*/
private final Object internalMonitor = new Object();
@ -722,22 +722,18 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return true;
}
protected final boolean waitForConditionOrConnectionException(Supplier<Boolean> condition) throws InterruptedException {
return waitFor(() -> condition.get().booleanValue() || hasCurrentConnectionException());
}
protected final void waitForConditionOrConnectionException(Supplier<Boolean> condition, String waitFor) throws InterruptedException, NoResponseException {
boolean success = waitForConditionOrConnectionException(condition);
if (!success) {
throw NoResponseException.newWith(this, waitFor);
}
}
protected final void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) throws InterruptedException, SmackException, XMPPException {
waitForConditionOrConnectionException(condition, waitFor);
boolean success = waitFor(() -> condition.get().booleanValue() || hasCurrentConnectionException());
if (hasCurrentConnectionException()) {
throwCurrentConnectionException();
}
// If there was no connection exception and we still did not successfully wait for the condition to hold, then
// we ran into a no-response timeout.
if (!success) {
throw NoResponseException.newWith(this, waitFor);
}
// Otherwise we successfully awaited the condition.
}
protected Resourcepart bindResourceAndEstablishSession(Resourcepart resource)
@ -2010,12 +2006,19 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}, timeout, TimeUnit.MILLISECONDS);
addAsyncStanzaListener(stanzaListener, replyFilter);
Runnable sendOperation = () -> {
try {
sendStanza(stanza);
}
catch (NotConnectedException | InterruptedException exception) {
future.setException(exception);
}
};
if (SmackConfiguration.TRUELY_ASYNC_SENDS) {
Async.go(sendOperation);
} else {
sendOperation.run();
}
return future;
}

View file

@ -302,6 +302,16 @@ public abstract class ConnectionConfiguration {
return new SmackTlsContext(context, daneVerifier);
}
public String getHostString() {
if (hostAddress != null) {
return hostAddress.toString();
}
if (host != null) {
return host.toString();
}
return xmppServiceDomain.toString();
}
public DnsName getHost() {
return host;
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2003-2007 Jive Software, 2018-2021 Florian Schmaus.
* Copyright 2003-2007 Jive Software, 2018-2022 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -386,4 +386,14 @@ public final class SmackConfiguration {
}
}
}
/**
* If enabled, causes {@link AbstractXMPPConnection} to create a thread for every asynchronous send operation. This
* is meant to work-around a shortcoming of Smack 4.4, where certain send operations are not asynchronous even if
* they should be. This is an expert setting, do not toggle if you do not understand the consequences or have been
* told to do so. Note that it is expected that this will not be needed in future Smack versions.
*
* @since 4.4.6
*/
public static boolean TRUELY_ASYNC_SENDS = false;
}

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smack.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.Bind;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -27,10 +28,10 @@ import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Resourcepart;
public class BindIQProvider extends IQProvider<Bind> {
public class BindIQProvider extends IqProvider<Bind> {
@Override
public Bind parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public Bind parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String name;
Bind bind = null;
outerloop: while (true) {

View file

@ -28,7 +28,7 @@ import org.jivesoftware.smack.packet.IQ;
public final class IQProviderInfo extends AbstractProviderInfo {
/**
* Defines an IQ provider which implements the <code>IQProvider</code> interface.
* Defines an IQ provider which implements the {@link IqProvider} interface.
*
* @param elementName Element that provider parses.
* @param namespace Namespace that provider parses.

View file

@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTargetException;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -42,7 +43,7 @@ public class IntrospectionProvider{
*/
// TODO: Remove in Smack 4.6.
@Deprecated
public abstract static class IQIntrospectionProvider<I extends IQ> extends IQProvider<I> {
public abstract static class IQIntrospectionProvider<I extends IQ> extends IqProvider<I> {
private final Class<I> elementClass;
protected IQIntrospectionProvider(Class<I> elementClass) {
@ -51,7 +52,7 @@ public class IntrospectionProvider{
@SuppressWarnings("unchecked")
@Override
public I parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public I parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
try {
return (I) parseWithIntrospection(elementClass, parser, initialDepth);
}

View file

@ -23,9 +23,17 @@ import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
/**
* An abstract class for parsing custom {@link IQ} packets. Each IqProvider must be registered with the {@link
* ProviderManager} for it to be used. Every implementation of this abstract class <b>must</b> have a public,
* no-argument constructor.
*
* @param <I> the {@link IQ} that is parsed by implementations.
*/
public abstract class IqProvider<I extends IQ> extends AbstractProvider<I> {
public final I parse(XmlPullParser parser, IqData iqCommon)
@ -40,6 +48,8 @@ public abstract class IqProvider<I extends IQ> extends AbstractProvider<I> {
I i = wrapExceptions(() -> parse(parser, initialDepth, iqData, xmlEnvironment));
// Parser should be at end tag of the consumed/parsed element
ParserUtils.forwardToEndTagOfDepth(parser, initialDepth);
return i;
}

View file

@ -37,8 +37,11 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
* abstract class <b>must</b> have a public, no-argument constructor.
*
* @author Matt Tucker
* @deprecated Use {@link IqProvider} instead
*/
public abstract class IQProvider<I extends IQ> extends IqProvider<I> {
@Deprecated
// TODO: Remove in Smack 4.6.
public abstract class LegacyIQProvider<I extends IQ> extends IqProvider<I> {
public final I parse(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException {
return parse(parser, (XmlEnvironment) null);

View file

@ -30,7 +30,7 @@ import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
/**
* Loads the {@link IQProvider} and {@link ExtensionElementProvider} information from a standard provider file in preparation
* Loads the {@link IqProvider} and {@link ExtensionElementProvider} information from a standard provider file in preparation
* for loading into the {@link ProviderManager}.
*
* @author Robin Collier
@ -76,7 +76,7 @@ public class ProviderFileLoader implements ProviderLoader {
switch (typeName) {
case "iqProvider":
// Attempt to load the provider class and then create
// a new instance if it's an IQProvider. Otherwise, if it's
// a new instance if it's an IqProvider. Otherwise, if it's
// an IQ class, add the class object itself, then we'll use
// reflection later to create instances of the class.
// Add the provider to the map.
@ -85,7 +85,7 @@ public class ProviderFileLoader implements ProviderLoader {
iqProviders.add(new IQProviderInfo(elementName, namespace, iqProvider));
}
else {
exceptions.add(new IllegalArgumentException(className + " is not a IQProvider"));
exceptions.add(new IllegalArgumentException(className + " is not a IqProvider"));
}
break;
case "extensionProvider":

View file

@ -34,11 +34,11 @@ import org.jivesoftware.smack.util.XmppElementUtil;
/**
* Manages providers for parsing custom XML sub-documents of XMPP packets. Two types of
* providers exist:<ul>
* <li>IQProvider -- parses IQ requests into Java objects.
* <li>IqProvider -- parses IQ requests into Java objects.
* <li>PacketExtension -- parses XML sub-documents attached to packets into
* PacketExtension instances.</ul>
*
* <b>IQProvider</b><p>
* <b>IqProvider</b><p>
*
* By default, Smack only knows how to process IQ packets with sub-packets that
* are in a few namespaces such as:<ul>
@ -63,8 +63,8 @@ import org.jivesoftware.smack.util.XmppElementUtil;
*
* Each IQ provider is associated with an element name and a namespace. If multiple provider
* entries attempt to register to handle the same namespace, the first entry loaded from the
* classpath will take precedence. The IQ provider class can either implement the IQProvider
* interface, or extend the IQ class. In the former case, each IQProvider is responsible for
* classpath will take precedence. The IQ provider class can either implement the IqProvider
* interface, or extend the IQ class. In the former case, each IqProvider is responsible for
* parsing the raw XML stream to create an IQ instance. In the latter case, bean introspection
* is used to try to automatically set properties of the IQ instance using the values found
* in the IQ stanza XML. For example, an XMPP time stanza resembles the following:
@ -173,11 +173,11 @@ public final class ProviderManager {
}
/**
* Returns an unmodifiable collection of all IQProvider instances. Each object
* in the collection will either be an IQProvider instance, or a Class object
* that implements the IQProvider interface.
* Returns an unmodifiable collection of all IqProvider instances. Each object
* in the collection will either be an IqProvider instance, or a Class object
* that implements the IqProvider interface.
*
* @return all IQProvider instances.
* @return all IqProvider instances.
*/
public static List<IqProvider<IQ>> getIQProviders() {
List<IqProvider<IQ>> providers = new ArrayList<>(iqProviders.size());
@ -186,7 +186,7 @@ public final class ProviderManager {
}
/**
* Adds an IQ provider (must be an instance of IQProvider or Class object that is an IQ)
* Adds an IQ provider (must be an instance of IqProvider or Class object that is an IQ)
* with the specified element name and name space. The provider will override any providers
* loaded through the classpath.
*

View file

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Collection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.FileUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -60,10 +61,10 @@ public class ProviderConfigTest {
Assert.assertNotNull(ProviderManager.getIQProvider("provider", "test:file_provider"));
}
public static class TestIQProvider extends IQProvider<IQ> {
public static class TestIQProvider extends IqProvider<IQ> {
@Override
public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public IQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
return null;
}

View file

@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -37,10 +38,10 @@ public class ProviderManagerTest {
assertTrue(SmackConfiguration.isSmackInitialized());
}
public static class TestIQProvider extends IQProvider<IQ> {
public static class TestIQProvider extends IqProvider<IQ> {
@Override
public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public IQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
return null;
}

View file

@ -18,18 +18,19 @@ package org.jivesoftware.smackx.dox.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.dox.element.DnsIq;
public class DnsIqProvider extends IQProvider<DnsIq> {
public class DnsIqProvider extends IqProvider<DnsIq> {
@Override
public DnsIq parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public DnsIq parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException, SmackParsingException {
String base64DnsMessage = parser.nextText();
return new DnsIq(base64DnsMessage);

View file

@ -20,7 +20,7 @@ import java.io.IOException;
import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -35,7 +35,7 @@ import org.jivesoftware.smackx.shim.provider.HeadersProvider;
* @author Andriy Tsykholyas
* @see <a href="http://xmpp.org/extensions/xep-0332.html">XEP-0332: HTTP over XMPP transport</a>
*/
public abstract class AbstractHttpOverXmppProvider<H extends AbstractHttpOverXmpp> extends IQProvider<H> {
public abstract class AbstractHttpOverXmppProvider<H extends AbstractHttpOverXmpp> extends IqProvider<H> {
private static final String ELEMENT_DATA = "data";
private static final String ELEMENT_TEXT = "text";

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.ParserUtils;
@ -40,7 +41,7 @@ public class HttpOverXmppReqProvider extends AbstractHttpOverXmppProvider<HttpOv
private static final String ATTRIBUTE_MAX_CHUNK_SIZE = "maxChunkSize";
@Override
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
public HttpOverXmppReq parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
HttpOverXmppReq.Builder builder = HttpOverXmppReq.builder();
builder.setResource(parser.getAttributeValue("", ATTRIBUTE_RESOURCE));
builder.setVersion(parser.getAttributeValue("", ATTRIBUTE_VERSION));

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -39,7 +40,7 @@ public class HttpOverXmppRespProvider extends AbstractHttpOverXmppProvider<HttpO
private static final String ATTRIBUTE_STATUS_CODE = "statusCode";
@Override
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
String version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
String statusMessage = parser.getAttributeValue("", ATTRIBUTE_STATUS_MESSAGE);
String statusCodeString = parser.getAttributeValue("", ATTRIBUTE_STATUS_CODE);

View file

@ -21,8 +21,9 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -38,10 +39,10 @@ import org.jivesoftware.smackx.httpfileupload.element.Slot_V0_2;
* @author Grigory Fedorov
* @see <a href="http://xmpp.org/extensions/xep-0363.html">XEP-0363: HTTP File Upload</a>
*/
public class SlotProvider extends IQProvider<Slot> {
public class SlotProvider extends IqProvider<Slot> {
@Override
public Slot parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public Slot parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
final String namespace = parser.getNamespace();
final UploadService.Version version = HttpFileUploadManager.namespaceToVersion(namespace);

View file

@ -20,8 +20,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -32,10 +33,10 @@ import org.jivesoftware.smackx.iot.control.element.SetDoubleData;
import org.jivesoftware.smackx.iot.control.element.SetIntData;
import org.jivesoftware.smackx.iot.control.element.SetLongData;
public class IoTSetRequestProvider extends IQProvider<IoTSetRequest> {
public class IoTSetRequestProvider extends IqProvider<IoTSetRequest> {
@Override
public IoTSetRequest parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public IoTSetRequest parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<SetData> data = new ArrayList<>(4);
outerloop: while (true) {
final XmlPullParser.Event eventType = parser.next();

View file

@ -16,16 +16,17 @@
*/
package org.jivesoftware.smackx.iot.control.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.control.element.IoTSetResponse;
public class IoTSetResponseProvider extends IQProvider<IoTSetResponse> {
public class IoTSetResponseProvider extends IqProvider<IoTSetResponse> {
@Override
public IoTSetResponse parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public IoTSetResponse parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
return new IoTSetResponse();
}

View file

@ -18,17 +18,18 @@ package org.jivesoftware.smackx.iot.data.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.data.element.IoTDataReadOutAccepted;
public class IoTDataReadOutAcceptedProvider extends IQProvider<IoTDataReadOutAccepted> {
public class IoTDataReadOutAcceptedProvider extends IqProvider<IoTDataReadOutAccepted> {
@Override
public IoTDataReadOutAccepted parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
public IoTDataReadOutAccepted parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws IOException {
int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request <accepted/> without sequence number");
boolean queued = ParserUtils.getBooleanAttribute(parser, "queued", false);
return new IoTDataReadOutAccepted(seqNr, queued);

View file

@ -18,17 +18,18 @@ package org.jivesoftware.smackx.iot.data.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.data.element.IoTDataRequest;
public class IoTDataRequestProvider extends IQProvider<IoTDataRequest> {
public class IoTDataRequestProvider extends IqProvider<IoTDataRequest> {
@Override
public IoTDataRequest parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
public IoTDataRequest parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws IOException {
int seqNr = ParserUtils.getIntegerAttributeOrThrow(parser, "seqnr", "IoT data request without sequence number");
boolean momentary = ParserUtils.getBooleanAttribute(parser, "momentary", false);
return new IoTDataRequest(seqNr, momentary);

View file

@ -16,8 +16,9 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -28,10 +29,10 @@ import org.jivesoftware.smackx.iot.parser.NodeInfoParser;
import org.jxmpp.jid.Jid;
import org.jxmpp.stringprep.XmppStringprepException;
public class IoTClaimedProvider extends IQProvider<IoTClaimed> {
public class IoTClaimedProvider extends IqProvider<IoTClaimed> {
@Override
public IoTClaimed parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
public IoTClaimed parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTClaimed(jid, nodeInfo);

View file

@ -16,8 +16,9 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -28,10 +29,10 @@ import org.jivesoftware.smackx.iot.parser.NodeInfoParser;
import org.jxmpp.jid.Jid;
import org.jxmpp.stringprep.XmppStringprepException;
public class IoTDisownProvider extends IQProvider<IoTDisown> {
public class IoTDisownProvider extends IqProvider<IoTDisown> {
@Override
public IoTDisown parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
public IoTDisown parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTDisown(jid, nodeInfo);

View file

@ -16,18 +16,19 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.discovery.element.IoTDisowned;
import org.jivesoftware.smackx.iot.element.NodeInfo;
import org.jivesoftware.smackx.iot.parser.NodeInfoParser;
public class IoTDisownedProvider extends IQProvider<IoTDisowned> {
public class IoTDisownedProvider extends IqProvider<IoTDisowned> {
@Override
public IoTDisowned parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public IoTDisowned parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTDisowned(nodeInfo);
}

View file

@ -20,8 +20,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -31,10 +32,10 @@ import org.jivesoftware.smackx.iot.discovery.element.Tag;
import org.jivesoftware.smackx.iot.element.NodeInfo;
import org.jivesoftware.smackx.iot.parser.NodeInfoParser;
public class IoTRegisterProvider extends IQProvider<IoTRegister> {
public class IoTRegisterProvider extends IqProvider<IoTRegister> {
@Override
public IoTRegister parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public IoTRegister parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
boolean selfOwned = ParserUtils.getBooleanAttribute(parser, "selfOwned", false);
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
List<Tag> tags = new ArrayList<>();

View file

@ -18,8 +18,9 @@ package org.jivesoftware.smackx.iot.discovery.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -30,10 +31,10 @@ import org.jivesoftware.smackx.iot.parser.NodeInfoParser;
import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.Jid;
public class IoTRemoveProvider extends IQProvider<IoTRemove> {
public class IoTRemoveProvider extends IqProvider<IoTRemove> {
@Override
public IoTRemove parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws IOException {
public IoTRemove parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws IOException {
Jid jid = ParserUtils.getJidAttribute(parser);
if (jid.hasResource()) {
// TODO: Should be SmackParseException.

View file

@ -16,18 +16,19 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.discovery.element.IoTRemoved;
import org.jivesoftware.smackx.iot.element.NodeInfo;
import org.jivesoftware.smackx.iot.parser.NodeInfoParser;
public class IoTRemovedProvider extends IQProvider<IoTRemoved> {
public class IoTRemovedProvider extends IqProvider<IoTRemoved> {
@Override
public IoTRemoved parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public IoTRemoved parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTRemoved(nodeInfo);
}

View file

@ -16,18 +16,19 @@
*/
package org.jivesoftware.smackx.iot.discovery.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.discovery.element.IoTUnregister;
import org.jivesoftware.smackx.iot.element.NodeInfo;
import org.jivesoftware.smackx.iot.parser.NodeInfoParser;
public class IoTUnregisterProvider extends IQProvider<IoTUnregister> {
public class IoTUnregisterProvider extends IqProvider<IoTUnregister> {
@Override
public IoTUnregister parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public IoTUnregister parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
NodeInfo nodeInfo = NodeInfoParser.parse(parser);
return new IoTUnregister(nodeInfo);
}

View file

@ -16,16 +16,17 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.provisioning.element.ClearCache;
public class ClearCacheProvider extends IQProvider<ClearCache> {
public class ClearCacheProvider extends IqProvider<ClearCache> {
@Override
public ClearCache parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public ClearCache parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
return new ClearCache();
}

View file

@ -16,16 +16,17 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.iot.provisioning.element.ClearCacheResponse;
public class ClearCacheResponseProvider extends IQProvider<ClearCacheResponse> {
public class ClearCacheResponseProvider extends IqProvider<ClearCacheResponse> {
@Override
public ClearCacheResponse parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public ClearCacheResponse parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
return new ClearCacheResponse();
}

View file

@ -16,8 +16,9 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -26,10 +27,10 @@ import org.jivesoftware.smackx.iot.provisioning.element.IoTIsFriend;
import org.jxmpp.jid.Jid;
import org.jxmpp.stringprep.XmppStringprepException;
public class IoTIsFriendProvider extends IQProvider<IoTIsFriend> {
public class IoTIsFriendProvider extends IqProvider<IoTIsFriend> {
@Override
public IoTIsFriend parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
public IoTIsFriend parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
return new IoTIsFriend(jid);
}

View file

@ -16,8 +16,9 @@
*/
package org.jivesoftware.smackx.iot.provisioning.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -27,10 +28,10 @@ import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.Jid;
import org.jxmpp.stringprep.XmppStringprepException;
public class IoTIsFriendResponseProvider extends IQProvider<IoTIsFriendResponse> {
public class IoTIsFriendResponseProvider extends IqProvider<IoTIsFriendResponse> {
@Override
public IoTIsFriendResponse parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
public IoTIsFriendResponse parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmppStringprepException {
Jid jid = ParserUtils.getJidAttribute(parser);
BareJid bareJid = jid.asBareJid();
boolean result = ParserUtils.getBooleanAttribute(parser, "result");

View file

@ -18,18 +18,19 @@ package org.jivesoftware.smackx.jid_prep.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.jid_prep.element.JidPrepIq;
public class JidPrepIqProvider extends IQProvider<JidPrepIq> {
public class JidPrepIqProvider extends IqProvider<JidPrepIq> {
@Override
public JidPrepIq parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public JidPrepIq parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException, SmackParsingException {
String jid = parser.nextText();

View file

@ -18,9 +18,10 @@ package org.jivesoftware.smackx.mam.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -38,10 +39,10 @@ import org.jivesoftware.smackx.rsm.provider.RSMSetProvider;
* @author Fernando Ramirez
*
*/
public class MamFinIQProvider extends IQProvider<MamFinIQ> {
public class MamFinIQProvider extends IqProvider<MamFinIQ> {
@Override
public MamFinIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public MamFinIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
MamElementFactory elementFactory = MamElementFactory.forParser(parser);
String queryId = parser.getAttributeValue("", "queryid");
boolean complete = ParserUtils.getBooleanAttribute(parser, "complete", false);

View file

@ -20,8 +20,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -40,12 +41,12 @@ import org.jxmpp.jid.impl.JidCreate;
* @author Fernando Ramirez
*
*/
public class MamPrefsIQProvider extends IQProvider<MamPrefsIQ> {
public class MamPrefsIQProvider extends IqProvider<MamPrefsIQ> {
public static final MamPrefsIQProvider INSTANCE = new MamPrefsIQProvider();
@Override
public MamPrefsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public MamPrefsIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
MamElementFactory elementFactory = MamElementFactory.forParser(parser);
String defaultBehaviorString = parser.getAttributeValue("", "default");
DefaultBehavior defaultBehavior = null;

View file

@ -18,9 +18,10 @@ package org.jivesoftware.smackx.mam.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -37,10 +38,10 @@ import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
* @author Fernando Ramirez
*
*/
public class MamQueryIQProvider extends IQProvider<MamQueryIQ> {
public class MamQueryIQProvider extends IqProvider<MamQueryIQ> {
@Override
public MamQueryIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public MamQueryIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException, SmackParsingException {
MamElementFactory elementFactory = MamElementFactory.forParser(parser);
DataForm dataForm = null;

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -36,10 +37,10 @@ import org.jxmpp.jid.impl.JidCreate;
* @author Fernando Ramirez
*
*/
public class MUCLightAffiliationsIQProvider extends IQProvider<MUCLightAffiliationsIQ> {
public class MUCLightAffiliationsIQProvider extends IqProvider<MUCLightAffiliationsIQ> {
@Override
public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public MUCLightAffiliationsIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String version = null;
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();

View file

@ -20,8 +20,9 @@ import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -37,10 +38,10 @@ import org.jxmpp.stringprep.XmppStringprepException;
* @author Fernando Ramirez
*
*/
public class MUCLightBlockingIQProvider extends IQProvider<MUCLightBlockingIQ> {
public class MUCLightBlockingIQProvider extends IqProvider<MUCLightBlockingIQ> {
@Override
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
HashMap<Jid, Boolean> rooms = null;
HashMap<Jid, Boolean> users = null;

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -33,10 +34,10 @@ import org.jivesoftware.smackx.muclight.element.MUCLightConfigurationIQ;
* @author Fernando Ramirez
*
*/
public class MUCLightConfigurationIQProvider extends IQProvider<MUCLightConfigurationIQ> {
public class MUCLightConfigurationIQProvider extends IqProvider<MUCLightConfigurationIQ> {
@Override
public MUCLightConfigurationIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public MUCLightConfigurationIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String version = null;
String roomName = null;
String subject = null;

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -37,10 +38,10 @@ import org.jxmpp.jid.impl.JidCreate;
* @author Fernando Ramirez
*
*/
public class MUCLightInfoIQProvider extends IQProvider<MUCLightInfoIQ> {
public class MUCLightInfoIQProvider extends IqProvider<MUCLightInfoIQ> {
@Override
public MUCLightInfoIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public MUCLightInfoIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String version = null;
String roomName = null;
String subject = null;

View file

@ -63,7 +63,7 @@ public class AbstractHttpOverXmppProviderTest {
HttpOverXmppRespProvider provider = new HttpOverXmppRespProvider();
XmlPullParser parser = PacketParserUtils.getParserFor(string);
IQ iq = provider.parse(parser);
IQ iq = provider.parse(parser, null);
assertTrue(iq instanceof HttpOverXmppResp);
HttpOverXmppResp body = (HttpOverXmppResp) iq;
@ -83,7 +83,7 @@ public class AbstractHttpOverXmppProviderTest {
HttpOverXmppReqProvider provider = new HttpOverXmppReqProvider();
XmlPullParser parser = PacketParserUtils.getParserFor(string);
IQ iq = provider.parse(parser);
IQ iq = provider.parse(parser, null);
assertTrue(iq instanceof HttpOverXmppReq);
HttpOverXmppReq body = (HttpOverXmppReq) iq;
@ -205,7 +205,7 @@ public class AbstractHttpOverXmppProviderTest {
HttpOverXmppRespProvider provider = new HttpOverXmppRespProvider();
XmlPullParser parser = SmackTestUtil.getParserFor(string, tag, parserKind);
IQ iq = provider.parse(parser);
IQ iq = provider.parse(parser, null);
assertTrue(iq instanceof HttpOverXmppResp);
return (HttpOverXmppResp) iq;
}

View file

@ -70,7 +70,7 @@ public class HttpOverXmppReqProviderTest {
private static HttpOverXmppReq parseReq(String string) throws Exception {
HttpOverXmppReqProvider provider = new HttpOverXmppReqProvider();
XmlPullParser parser = PacketParserUtils.getParserFor(string);
IQ iq = provider.parse(parser);
IQ iq = provider.parse(parser, null);
assertTrue(iq instanceof HttpOverXmppReq);
return (HttpOverXmppReq) iq;
}

View file

@ -39,7 +39,7 @@ public class HttpOverXmppRespProviderTest {
HttpOverXmppRespProvider provider = new HttpOverXmppRespProvider();
XmlPullParser parser = PacketParserUtils.getParserFor(string);
IQ iq = provider.parse(parser);
IQ iq = provider.parse(parser, null);
assertTrue(iq instanceof HttpOverXmppResp);
HttpOverXmppResp resp = (HttpOverXmppResp) iq;
@ -54,7 +54,7 @@ public class HttpOverXmppRespProviderTest {
HttpOverXmppRespProvider provider = new HttpOverXmppRespProvider();
XmlPullParser parser = PacketParserUtils.getParserFor(string);
IQ iq = provider.parse(parser);
IQ iq = provider.parse(parser, null);
assertTrue(iq instanceof HttpOverXmppResp);
HttpOverXmppResp resp = (HttpOverXmppResp) iq;

View file

@ -40,7 +40,7 @@ public class MamFinProviderTest extends MamTest {
@Test
public void checkMamFinProvider() throws Exception {
XmlPullParser parser = PacketParserUtils.getParserFor(exmapleMamFinXml);
MamFinIQ mamFinIQ = new MamFinIQProvider().parse(parser);
MamFinIQ mamFinIQ = new MamFinIQProvider().parse(parser, null);
assertFalse(mamFinIQ.isComplete());
assertTrue(mamFinIQ.isStable());

View file

@ -60,21 +60,21 @@ public class MamPrefIQProviderTest extends MamTest {
public void checkMamPrefsIQProvider(XmlPullParserKind parserKind)
throws XmlPullParserException, IOException, SmackParsingException {
XmlPullParser parser1 = SmackTestUtil.getParserFor(exampleMamPrefsIQ1, parserKind);
MamPrefsIQ mamPrefIQ1 = MamPrefsIQProvider.INSTANCE.parse(parser1);
MamPrefsIQ mamPrefIQ1 = MamPrefsIQProvider.INSTANCE.parse(parser1, null);
assertEquals(IQ.Type.set, mamPrefIQ1.getType());
assertEquals(mamPrefIQ1.getAlwaysJids().get(0).toString(), "romeo@montague.lit");
assertEquals(mamPrefIQ1.getNeverJids().get(0).toString(), "montague@montague.lit");
XmlPullParser parser2 = SmackTestUtil.getParserFor(exampleMamPrefsIQ2, parserKind);
MamPrefsIQ mamPrefIQ2 = MamPrefsIQProvider.INSTANCE.parse(parser2);
MamPrefsIQ mamPrefIQ2 = MamPrefsIQProvider.INSTANCE.parse(parser2, null);
assertEquals(IQ.Type.set, mamPrefIQ2.getType());
assertEquals(mamPrefIQ2.getAlwaysJids().get(0).toString(), "romeo@montague.lit");
assertEquals(mamPrefIQ2.getAlwaysJids().get(1).toString(), "montague@montague.lit");
assertTrue(mamPrefIQ2.getNeverJids().isEmpty());
XmlPullParser parser3 = SmackTestUtil.getParserFor(exampleMamPrefsIQ3, parserKind);
MamPrefsIQ mamPrefIQ3 = MamPrefsIQProvider.INSTANCE.parse(parser3);
MamPrefsIQ mamPrefIQ3 = MamPrefsIQProvider.INSTANCE.parse(parser3, null);
assertEquals(IQ.Type.set, mamPrefIQ3.getType());
}

View file

@ -20,8 +20,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -37,10 +38,10 @@ import org.jxmpp.jid.Jid;
* @see <a href="http://xmpp.org/extensions/xep-0191.html">XEP-0191: Blocking
* Command</a>
*/
public class BlockContactsIQProvider extends IQProvider<BlockContactsIQ> {
public class BlockContactsIQProvider extends IqProvider<BlockContactsIQ> {
@Override
public BlockContactsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public BlockContactsIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<Jid> jids = new ArrayList<>();
outerloop: while (true) {

View file

@ -21,8 +21,9 @@ import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -38,10 +39,10 @@ import org.jxmpp.jid.Jid;
* @see <a href="http://xmpp.org/extensions/xep-0191.html">XEP-0191: Blocking
* Command</a>
*/
public class BlockListIQProvider extends IQProvider<BlockListIQ> {
public class BlockListIQProvider extends IqProvider<BlockListIQ> {
@Override
public BlockListIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public BlockListIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<Jid> jids = null;
outerloop: while (true) {

View file

@ -20,8 +20,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -37,10 +38,10 @@ import org.jxmpp.jid.impl.JidCreate;
* @see <a href="http://xmpp.org/extensions/xep-0191.html">XEP-0191: Blocking
* Command</a>
*/
public class UnblockContactsIQProvider extends IQProvider<UnblockContactsIQ> {
public class UnblockContactsIQProvider extends IqProvider<UnblockContactsIQ> {
@Override
public UnblockContactsIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public UnblockContactsIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
List<Jid> jids = null;
outerloop: while (true) {

View file

@ -18,8 +18,9 @@ package org.jivesoftware.smackx.bob.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.Pair;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -35,10 +36,10 @@ import org.jivesoftware.smackx.bob.element.BoBIQ;
* @see <a href="http://xmpp.org/extensions/xep-0231.html">XEP-0231: Bits of
* Binary</a>
*/
public class BoBIQProvider extends IQProvider<BoBIQ> {
public class BoBIQProvider extends IqProvider<BoBIQ> {
@Override
public BoBIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public BoBIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
Pair<ContentId, BoBData> parserResult = BoBProviderUtil.parseContentIdAndBobData(parser, initialDepth,
xmlEnvironment);

View file

@ -16,8 +16,9 @@
*/
package org.jivesoftware.smackx.bytestreams.ibb.provider;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
@ -27,10 +28,10 @@ import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
*
* @author Henning Staib
*/
public class CloseIQProvider extends IQProvider<Close> {
public class CloseIQProvider extends IqProvider<Close> {
@Override
public Close parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
public Close parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) {
String sid = parser.getAttributeValue("", "sid");
return new Close(sid);
}

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.bytestreams.ibb.provider;
import java.io.IOException;
import org.jivesoftware.smack.datatypes.UInt16;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.RequiredAttributeMissingException;
@ -37,12 +38,12 @@ import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
*/
public class DataPacketProvider {
public static class IQProvider extends org.jivesoftware.smack.provider.IQProvider<Data> {
public static class IQProvider extends org.jivesoftware.smack.provider.IqProvider<Data> {
private static final PacketExtensionProvider packetExtensionProvider = new PacketExtensionProvider();
@Override
public Data parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public Data parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws IOException, XmlPullParserException, SmackParsingException {
DataPacketExtension data = packetExtensionProvider.parse(parser);
return new Data(data);

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.bytestreams.ibb.provider;
import java.io.IOException;
import java.util.Locale;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -32,10 +33,10 @@ import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
*
* @author Henning Staib
*/
public class OpenIQProvider extends IQProvider<Open> {
public class OpenIQProvider extends IqProvider<Open> {
@Override
public Open parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public Open parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
String sessionID = parser.getAttributeValue("", "sid");
int blockSize = Integer.parseInt(parser.getAttributeValue("", "block-size"));

View file

@ -18,8 +18,9 @@ package org.jivesoftware.smackx.bytestreams.socks5.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -34,10 +35,10 @@ import org.jxmpp.jid.Jid;
*
* @author Alexander Wenckus
*/
public class BytestreamsProvider extends IQProvider<Bytestream> {
public class BytestreamsProvider extends IqProvider<Bytestream> {
@Override
public Bytestream parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public Bytestream parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
boolean done = false;

View file

@ -19,11 +19,12 @@ package org.jivesoftware.smackx.commands.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -39,10 +40,10 @@ import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
*
* @author Gabriel Guardincerri
*/
public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
public class AdHocCommandDataProvider extends IqProvider<AdHocCommandData> {
@Override
public AdHocCommandData parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public AdHocCommandData parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
boolean done = false;
AdHocCommandData adHocCommandData = new AdHocCommandData();
DataFormProvider dataFormProvider = new DataFormProvider();

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2003-2007 Jive Software, 2018-2020 Florian Schmaus.
* Copyright 2003-2007 Jive Software, 2018-2022 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -937,6 +937,10 @@ public final class ServiceDiscoveryManager extends Manager {
* Notify the {@link EntityCapabilitiesChangedListener} about changed capabilities.
*/
private synchronized void renewEntityCapsVersion() {
if (entityCapabilitiesChangedListeners.isEmpty()) {
return;
}
renewEntityCapsRequested++;
if (renewEntityCapsScheduledAction != null) {
boolean canceled = renewEntityCapsScheduledAction.cancel();
@ -945,9 +949,12 @@ public final class ServiceDiscoveryManager extends Manager {
}
}
final XMPPConnection connection = connection();
renewEntityCapsScheduledAction = scheduleBlocking(() -> {
final XMPPConnection connection = connection();
if (connection == null) {
return;
}
renewEntityCapsPerformed.incrementAndGet();
DiscoverInfoBuilder discoverInfoBuilder = DiscoverInfo.builder("synthetized-disco-info-response")

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.disco.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -34,10 +35,10 @@ import org.jxmpp.jid.Jid;
*
* @author Gaston Dombiak
*/
public class DiscoverItemsProvider extends IQProvider<DiscoverItems> {
public class DiscoverItemsProvider extends IqProvider<DiscoverItems> {
@Override
public DiscoverItems parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public DiscoverItems parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
DiscoverItems discoverItems = new DiscoverItems();
boolean done = false;

View file

@ -20,8 +20,9 @@ package org.jivesoftware.smackx.iqlast.packet;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -100,10 +101,10 @@ public class LastActivity extends IQ {
*
* @author Derek DeMoro
*/
public static class Provider extends IQProvider<LastActivity> {
public static class Provider extends IqProvider<LastActivity> {
@Override
public LastActivity parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public LastActivity parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
LastActivity lastActivity = new LastActivity();
String seconds = parser.getAttributeValue("", "seconds");
if (seconds != null) {

View file

@ -31,9 +31,10 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.StanzaError.Condition;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -234,10 +235,10 @@ public final class PrivateDataManager extends Manager {
/**
* An IQ provider to parse IQ results containing private data.
*/
public static class PrivateDataIQProvider extends IQProvider<PrivateDataIQ> {
public static class PrivateDataIQProvider extends IqProvider<PrivateDataIQ> {
@Override
public PrivateDataIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public PrivateDataIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
PrivateData privateData = null;
boolean done = false;

View file

@ -23,20 +23,21 @@ import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.iqregister.packet.Registration;
public class RegistrationProvider extends IQProvider<Registration> {
public class RegistrationProvider extends IqProvider<Registration> {
@Override
public Registration parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public Registration parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
String instruction = null;
Map<String, String> fields = new HashMap<>();
List<XmlElement> packetExtensions = new LinkedList<>();

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2003-2007 Jive Software. 2020-2021 Florian Schmaus
* Copyright 2003-2007 Jive Software. 2020-2022 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,6 +25,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -59,7 +60,9 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.MessageBuilder;
import org.jivesoftware.smack.packet.MessageView;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.PresenceBuilder;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.Consumer;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
@ -124,7 +127,7 @@ public class MultiUserChat {
private final Set<ParticipantStatusListener> participantStatusListeners = new CopyOnWriteArraySet<ParticipantStatusListener>();
private final Set<MessageListener> messageListeners = new CopyOnWriteArraySet<MessageListener>();
private final Set<PresenceListener> presenceListeners = new CopyOnWriteArraySet<PresenceListener>();
private final Set<PresenceListener> presenceInterceptors = new CopyOnWriteArraySet<PresenceListener>();
private final Set<Consumer<PresenceBuilder>> presenceInterceptors = new CopyOnWriteArraySet<>();
/**
* This filter will match all stanzas send from the groupchat or from one if
@ -138,7 +141,16 @@ public class MultiUserChat {
*/
private final StanzaFilter fromRoomGroupchatFilter;
private final StanzaListener presenceInterceptor;
private final AtomicInteger presenceInterceptorCount = new AtomicInteger();
// We want to save the presence interceptor in a variable, using a lambda, (and not use a method reference) to be
// able to dynamically add and remove it from the connection.
@SuppressWarnings("UnnecessaryLambda")
private final Consumer<PresenceBuilder> presenceInterceptor = presenceBuilder -> {
for (Consumer<PresenceBuilder> interceptor : presenceInterceptors) {
interceptor.accept(presenceBuilder);
}
};
private final StanzaListener messageListener;
private final StanzaListener presenceListener;
private final StanzaListener subjectListener;
@ -316,16 +328,6 @@ public class MultiUserChat {
fireInvitationRejectionListeners(message, rejection);
}
};
presenceInterceptor = new StanzaListener() {
@Override
public void processStanza(Stanza packet) {
Presence presence = (Presence) packet;
for (PresenceListener interceptor : presenceInterceptors) {
interceptor.processPresence(presence);
}
}
};
}
@ -379,8 +381,6 @@ public class MultiUserChat {
);
// @formatter:on
connection.addStanzaListener(declinesListener, new AndFilter(fromRoomFilter, DECLINE_FILTER));
connection.addStanzaSendingListener(presenceInterceptor, new AndFilter(ToMatchesFilter.create(room),
StanzaTypeFilter.PRESENCE));
messageCollector = connection.createStanzaCollector(fromRoomGroupchatFilter);
// Wait for a presence packet back from the server.
@ -1133,8 +1133,13 @@ public class MultiUserChat {
*
* @param presenceInterceptor the new stanza interceptor that will intercept presence packets.
*/
public void addPresenceInterceptor(PresenceListener presenceInterceptor) {
presenceInterceptors.add(presenceInterceptor);
public void addPresenceInterceptor(Consumer<PresenceBuilder> presenceInterceptor) {
boolean added = presenceInterceptors.add(presenceInterceptor);
if (!added) return;
int currentCount = presenceInterceptorCount.incrementAndGet();
if (currentCount == 1) {
connection.addPresenceInterceptor(this.presenceInterceptor, ToMatchesFilter.create(room).asPredicate(Presence.class));
}
}
/**
@ -1144,8 +1149,13 @@ public class MultiUserChat {
*
* @param presenceInterceptor the stanza interceptor to remove.
*/
public void removePresenceInterceptor(PresenceListener presenceInterceptor) {
presenceInterceptors.remove(presenceInterceptor);
public void removePresenceInterceptor(Consumer<PresenceBuilder> presenceInterceptor) {
boolean removed = presenceInterceptors.remove(presenceInterceptor);
if (!removed) return;
int currentCount = presenceInterceptorCount.decrementAndGet();
if (currentCount == 0) {
connection.removePresenceInterceptor(presenceInterceptor);
}
}
/**
@ -2211,7 +2221,7 @@ public class MultiUserChat {
connection.removeStanzaListener(presenceListener);
connection.removeStanzaListener(subjectListener);
connection.removeStanzaListener(declinesListener);
connection.removeStanzaSendingListener(presenceInterceptor);
connection.removePresenceInterceptor(presenceInterceptor);
if (messageCollector != null) {
messageCollector.cancel();
messageCollector = null;

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.muc.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -31,10 +32,10 @@ import org.jivesoftware.smackx.muc.packet.MUCAdmin;
*
* @author Gaston Dombiak
*/
public class MUCAdminProvider extends IQProvider<MUCAdmin> {
public class MUCAdminProvider extends IqProvider<MUCAdmin> {
@Override
public MUCAdmin parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public MUCAdmin parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
MUCAdmin mucAdmin = new MUCAdmin();
boolean done = false;

View file

@ -19,9 +19,10 @@ package org.jivesoftware.smackx.muc.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -33,10 +34,10 @@ import org.jivesoftware.smackx.muc.packet.MUCOwner;
*
* @author Gaston Dombiak
*/
public class MUCOwnerProvider extends IQProvider<MUCOwner> {
public class MUCOwnerProvider extends IqProvider<MUCOwner> {
@Override
public MUCOwner parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public MUCOwner parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
MUCOwner mucOwner = new MUCOwner();
boolean done = false;
while (!done) {

View file

@ -23,8 +23,9 @@ import java.util.Collections;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -197,11 +198,11 @@ public class OfflineMessageRequest extends IQ {
}
}
public static class Provider extends IQProvider<OfflineMessageRequest> {
public static class Provider extends IqProvider<OfflineMessageRequest> {
@Override
public OfflineMessageRequest parse(XmlPullParser parser,
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException {
OfflineMessageRequest request = new OfflineMessageRequest();
boolean done = false;

View file

@ -18,17 +18,18 @@ package org.jivesoftware.smackx.ping.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.ping.packet.Ping;
public class PingProvider extends IQProvider<Ping> {
public class PingProvider extends IqProvider<Ping> {
@Override
public Ping parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public Ping parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
// No need to use the ping constructor with arguments. IQ will already
// have filled out all relevant fields ('from', 'to', 'id').
return new Ping();

View file

@ -20,8 +20,9 @@ import java.io.IOException;
import java.util.ArrayList;
import org.jivesoftware.smack.datatypes.UInt32;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -37,10 +38,10 @@ import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
*
* @author Francisco Vives
*/
public class PrivacyProvider extends IQProvider<Privacy> {
public class PrivacyProvider extends IqProvider<Privacy> {
@Override
public Privacy parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public Privacy parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
Privacy privacy = new Privacy();
boolean done = false;

View file

@ -19,9 +19,10 @@ package org.jivesoftware.smackx.pubsub.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -35,9 +36,9 @@ import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
*
* @author Robin Collier
*/
public class PubSubProvider extends IQProvider<PubSub> {
public class PubSubProvider extends IqProvider<PubSub> {
@Override
public PubSub parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public PubSub parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
String namespace = parser.getNamespace();
PubSubNamespace pubSubNamespace = PubSubNamespace.valueOfFromXmlns(namespace);
PubSub pubsub = new PubSub(pubSubNamespace);

View file

@ -23,10 +23,11 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -124,11 +125,11 @@ public class UserSearch extends SimpleIQ {
/**
* Internal Search service Provider.
*/
public static class Provider extends IQProvider<IQ> {
public static class Provider extends IqProvider<IQ> {
// FIXME this provider does return two different types of IQs
@Override
public IQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public IQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
UserSearch search = null;
SimpleUserSearch simpleUserSearch = new SimpleUserSearch();

View file

@ -21,8 +21,9 @@ import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -67,10 +68,10 @@ public class SharedGroupsInfo extends IQ {
/**
* Internal Search service Provider.
*/
public static class Provider extends IQProvider<SharedGroupsInfo> {
public static class Provider extends IqProvider<SharedGroupsInfo> {
@Override
public SharedGroupsInfo parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public SharedGroupsInfo parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
SharedGroupsInfo groupsInfo = new SharedGroupsInfo();

View file

@ -22,9 +22,10 @@ import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -41,11 +42,11 @@ import org.jxmpp.util.XmppDateTime;
* @author Alexander Wenckus
*
*/
public class StreamInitiationProvider extends IQProvider<StreamInitiation> {
public class StreamInitiationProvider extends IqProvider<StreamInitiation> {
private static final Logger LOGGER = Logger.getLogger(StreamInitiationProvider.class.getName());
@Override
public StreamInitiation parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public StreamInitiation parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
// si
String id = parser.getAttributeValue("", "id");
String mimeType = parser.getAttributeValue("", "mime-type");

View file

@ -18,8 +18,9 @@ package org.jivesoftware.smackx.vcardtemp.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -33,7 +34,7 @@ import org.jivesoftware.smackx.vcardtemp.packet.VCard;
* @author Derek DeMoro
* @author Chris Deering
*/
public class VCardProvider extends IQProvider<VCard> {
public class VCardProvider extends IqProvider<VCard> {
// @formatter:off
private static final String[] ADR = new String[] {
@ -68,7 +69,7 @@ public class VCardProvider extends IQProvider<VCard> {
// @formatter:on
@Override
public VCard parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public VCard parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
VCard vCard = new VCard();
String name = null;

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2003-2007 Jive Software 2020-2021 Florian Schmaus.
* Copyright 2003-2007 Jive Software 2020-2022 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -21,6 +21,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
@ -30,6 +32,8 @@ import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.roster.packet.RosterPacket;
import org.jivesoftware.smack.roster.provider.RosterPacketProvider;
import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -111,7 +115,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
// See XEP-133 Example 32 for a corner case where the data form contains this extension.
case RosterPacket.ELEMENT:
if (namespace.equals(RosterPacket.NAMESPACE)) {
dataForm.addExtensionElement(RosterPacketProvider.INSTANCE.parse(parser));
dataForm.addExtensionElement(RosterPacketProvider.INSTANCE.parse(parser, null));
}
break;
// See XEP-141 Data Forms Layout
@ -140,6 +144,37 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
return parseField(parser, xmlEnvironment, formType, null);
}
private static final class FieldNameAndFormType {
private final String fieldName;
private final String formType;
private FieldNameAndFormType(String fieldName, String formType) {
this.fieldName = fieldName;
this.formType = formType;
}
private final HashCode.Cache hashCodeCache = new HashCode.Cache();
@Override
public int hashCode() {
return hashCodeCache.getHashCode(b ->
b.append(fieldName)
.append(formType)
.build()
);
}
@Override
public boolean equals(Object other) {
return EqualsUtil.equals(this, other, (e, o) ->
e.append(fieldName, o.fieldName)
.append(formType, o.formType)
);
}
}
private static final Set<FieldNameAndFormType> UNKNOWN_FIELDS = new CopyOnWriteArraySet<>();
private static FormField parseField(XmlPullParser parser, XmlEnvironment xmlEnvironment, String formType, DataForm.ReportedData reportedData)
throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
@ -212,8 +247,12 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
// field's type in the registry.
type = FormFieldRegistry.lookup(formType, fieldName);
if (type == null) {
FieldNameAndFormType fieldNameAndFormType = new FieldNameAndFormType(fieldName, formType);
if (!UNKNOWN_FIELDS.contains(fieldNameAndFormType)) {
LOGGER.warning("The Field '" + fieldName + "' from FORM_TYPE '" + formType
+ "' is not registered. Field type is unknown, assuming text-single.");
UNKNOWN_FIELDS.add(fieldNameAndFormType);
}
// As per XEP-0004, text-single is the default form field type, which we use as emergency fallback here.
type = FormField.Type.text_single;
}

View file

@ -53,7 +53,7 @@ public class OpenIQProviderTest extends SmackTestSuite {
OpenIQProvider oip = new OpenIQProvider();
XmlPullParser parser = PacketParserUtils.getParserFor(control);
Open open = oip.parse(parser);
Open open = oip.parse(parser, null);
assertEquals(StanzaType.IQ, open.getStanza());
}
@ -69,7 +69,7 @@ public class OpenIQProviderTest extends SmackTestSuite {
OpenIQProvider oip = new OpenIQProvider();
XmlPullParser parser = PacketParserUtils.getParserFor(control);
Open open = oip.parse(parser);
Open open = oip.parse(parser, null);
assertEquals(StanzaType.MESSAGE, open.getStanza());
}

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smack.roster.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.roster.packet.RosterPacket;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -29,12 +30,12 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.impl.JidCreate;
public class RosterPacketProvider extends IQProvider<RosterPacket> {
public class RosterPacketProvider extends IqProvider<RosterPacket> {
public static final RosterPacketProvider INSTANCE = new RosterPacketProvider();
@Override
public RosterPacket parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public RosterPacket parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
RosterPacket roster = new RosterPacket();
String version = parser.getAttributeValue("", "ver");
roster.setVersion(version);

View file

@ -19,7 +19,7 @@ import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.StanzaTypeFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.test.SmackTestCase;
import org.jivesoftware.smackx.jingle.packet.Jingle;

View file

@ -30,8 +30,9 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -330,10 +331,10 @@ public class RTPBridge extends IQ {
*
* @author Thiago Rocha
*/
public static class Provider extends IQProvider<RTPBridge> {
public static class Provider extends IqProvider<RTPBridge> {
@Override
public RTPBridge parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public RTPBridge parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException,
IOException {

View file

@ -27,9 +27,10 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -118,10 +119,10 @@ public class STUN extends SimpleIQ {
*
* @author Thiago Rocha
*/
public static class Provider extends IQProvider<STUN> {
public static class Provider extends IqProvider<STUN> {
@Override
public STUN parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public STUN parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException,
IOException {

View file

@ -19,10 +19,11 @@ package org.jivesoftware.smackx.jingleold.provider;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -41,7 +42,7 @@ import org.jxmpp.jid.Jid;
*
* @author Alvaro Saurin
*/
public class JingleProvider extends IQProvider<Jingle> {
public class JingleProvider extends IqProvider<Jingle> {
/**
* Parse a iq/jingle element.
@ -50,7 +51,7 @@ public class JingleProvider extends IQProvider<Jingle> {
* @throws SmackParsingException if the Smack parser (provider) encountered invalid input.
*/
@Override
public Jingle parse(XmlPullParser parser, int intialDepth, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
public Jingle parse(XmlPullParser parser, int intialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
Jingle jingle = new Jingle();
String sid;

View file

@ -22,9 +22,10 @@ import java.io.IOException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -61,10 +62,10 @@ public class OfferConfirmation extends SimpleIQ {
con.sendStanza(packet);
}
public static class Provider extends IQProvider<OfferConfirmation> {
public static class Provider extends IqProvider<OfferConfirmation> {
@Override
public OfferConfirmation parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public OfferConfirmation parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
final OfferConfirmation confirmation = new OfferConfirmation();

View file

@ -19,10 +19,11 @@ package org.jivesoftware.smackx.workgroup.ext.forms;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -48,10 +49,10 @@ public class WorkgroupForm extends SimpleIQ {
*
* @author Derek DeMoro
*/
public static class InternalProvider extends IQProvider<WorkgroupForm> {
public static class InternalProvider extends IqProvider<WorkgroupForm> {
@Override
public WorkgroupForm parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public WorkgroupForm parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
WorkgroupForm answer = new WorkgroupForm();
boolean done = false;

View file

@ -24,8 +24,9 @@ import java.util.Date;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -91,10 +92,10 @@ public class AgentChatHistory extends IQ {
/**
* Stanza extension provider for AgentHistory packets.
*/
public static class InternalProvider extends IQProvider<AgentChatHistory> {
public static class InternalProvider extends IqProvider<AgentChatHistory> {
@Override
public AgentChatHistory parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public AgentChatHistory parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
if (parser.getEventType() != XmlPullParser.Event.START_ELEMENT) {
throw new IllegalStateException("Parser not in proper position, or bad XML.");
}

View file

@ -23,8 +23,9 @@ import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -81,10 +82,10 @@ public class ChatMetadata extends IQ {
*
* @author Derek DeMoro
*/
public static class Provider extends IQProvider<ChatMetadata> {
public static class Provider extends IqProvider<ChatMetadata> {
@Override
public ChatMetadata parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public ChatMetadata parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
final ChatMetadata chatM = new ChatMetadata();

View file

@ -20,8 +20,9 @@ package org.jivesoftware.smackx.workgroup.ext.macros;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -96,10 +97,10 @@ public class Macros extends IQ {
*
* @author Derek DeMoro
*/
public static class InternalProvider extends IQProvider<Macros> {
public static class InternalProvider extends IqProvider<Macros> {
@Override
public Macros parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public Macros parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
Macros macroGroup = new Macros();
boolean done = false;

View file

@ -20,8 +20,9 @@ package org.jivesoftware.smackx.workgroup.ext.notes;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -81,10 +82,10 @@ public class ChatNotes extends IQ {
*
* @author Derek DeMoro
*/
public static class Provider extends IQProvider<ChatNotes> {
public static class Provider extends IqProvider<ChatNotes> {
@Override
public ChatNotes parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public ChatNotes parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
ChatNotes chatNotes = new ChatNotes();
boolean done = false;

View file

@ -20,8 +20,9 @@ package org.jivesoftware.smackx.workgroup.packet;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -104,10 +105,10 @@ public class AgentInfo extends IQ {
*
* @author Gaston Dombiak
*/
public static class Provider extends IQProvider<AgentInfo> {
public static class Provider extends IqProvider<AgentInfo> {
@Override
public AgentInfo parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public AgentInfo parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
AgentInfo answer = new AgentInfo();
boolean done = false;

View file

@ -24,8 +24,9 @@ import java.util.Iterator;
import java.util.Set;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -111,10 +112,10 @@ public class AgentStatusRequest extends IQ {
/**
* Stanza extension provider for AgentStatusRequest packets.
*/
public static class Provider extends IQProvider<AgentStatusRequest> {
public static class Provider extends IqProvider<AgentStatusRequest> {
@Override
public AgentStatusRequest parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public AgentStatusRequest parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
AgentStatusRequest statusRequest = new AgentStatusRequest();
boolean done = false;

View file

@ -24,8 +24,9 @@ import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -103,10 +104,10 @@ public class AgentWorkgroups extends IQ {
*
* @author Gaston Dombiak
*/
public static class Provider extends IQProvider<AgentWorkgroups> {
public static class Provider extends IqProvider<AgentWorkgroups> {
@Override
public AgentWorkgroups parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public AgentWorkgroups parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
final Jid agentJID = ParserUtils.getJidAttribute(parser);
List<String> workgroups = new ArrayList<>();

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.workgroup.packet;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -75,10 +76,10 @@ public class MonitorPacket extends IQ {
/**
* Stanza extension provider for Monitor Packets.
*/
public static class InternalProvider extends IQProvider<MonitorPacket> {
public static class InternalProvider extends IqProvider<MonitorPacket> {
@Override
public MonitorPacket parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public MonitorPacket parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
MonitorPacket packet = new MonitorPacket();
boolean done = false;

View file

@ -27,8 +27,9 @@ import java.util.Set;
import java.util.TimeZone;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -132,10 +133,10 @@ public class OccupantsInfo extends IQ {
/**
* Stanza extension provider for AgentStatusRequest packets.
*/
public static class Provider extends IQProvider<OccupantsInfo> {
public static class Provider extends IqProvider<OccupantsInfo> {
@Override
public OccupantsInfo parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public OccupantsInfo parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException, ParseException {
OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID"));

View file

@ -23,9 +23,10 @@ import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
@ -45,14 +46,14 @@ import org.jxmpp.jid.Jid;
*
* @author loki der quaeler
*/
public class OfferRequestProvider extends IQProvider<IQ> {
public class OfferRequestProvider extends IqProvider<IQ> {
// FIXME It seems because OfferRequestPacket is also defined here, we can
// not add it as generic to the provider, the provider and the packet should
// be split, but since this is legacy code, I don't think that this will
// happen anytime soon.
@Override
public OfferRequestPacket parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public OfferRequestPacket parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
XmlPullParser.Event eventType = parser.getEventType();
String sessionID = null;
int timeout = -1;

View file

@ -20,8 +20,9 @@ package org.jivesoftware.smackx.workgroup.packet;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -33,10 +34,10 @@ import org.jxmpp.jid.Jid;
*
* @author loki der quaeler
*/
public class OfferRevokeProvider extends IQProvider<IQ> {
public class OfferRevokeProvider extends IqProvider<IQ> {
@Override
public OfferRevokePacket parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
public OfferRevokePacket parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
// The parser will be positioned on the opening IQ tag, so get the JID attribute.
Jid userJID = ParserUtils.getJidAttribute(parser);
// Default the userID to the JID.

View file

@ -21,10 +21,11 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -34,10 +35,10 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
*
* @author Gaston Dombiak
*/
public class TranscriptProvider extends IQProvider<Transcript> {
public class TranscriptProvider extends IqProvider<Transcript> {
@Override
public Transcript parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public Transcript parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
String sessionID = parser.getAttributeValue("", "sessionID");
List<Stanza> packets = new ArrayList<>();

View file

@ -19,10 +19,11 @@ package org.jivesoftware.smackx.workgroup.packet;
import java.io.IOException;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.SimpleIQ;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -54,10 +55,10 @@ public class TranscriptSearch extends SimpleIQ {
*
* @author Gaston Dombiak
*/
public static class Provider extends IQProvider<TranscriptSearch> {
public static class Provider extends IqProvider<TranscriptSearch> {
@Override
public TranscriptSearch parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
public TranscriptSearch parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
TranscriptSearch answer = new TranscriptSearch();
boolean done = false;

View file

@ -25,8 +25,9 @@ import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -38,7 +39,7 @@ import org.jxmpp.jid.Jid;
*
* @author Gaston Dombiak
*/
public class TranscriptsProvider extends IQProvider<Transcripts> {
public class TranscriptsProvider extends IqProvider<Transcripts> {
@SuppressWarnings("DateFormatConstant")
private static final SimpleDateFormat UTC_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
@ -47,7 +48,7 @@ public class TranscriptsProvider extends IQProvider<Transcripts> {
}
@Override
public Transcripts parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
public Transcripts parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException, TextParseException, ParseException {
Jid userID = ParserUtils.getJidAttribute(parser, "userID");
List<Transcripts.TranscriptSummary> summaries = new ArrayList<>();

Some files were not shown because too many files have changed in this diff Show more