Commit Graph

324 Commits

Author SHA1 Message Date
Florian Schmaus 77e26fc575 Re-work data form API
Apply builder pattern to form fields and replace getVariable() with
getFieldName(). Refer to the field name as "field name" instead of
"variable" everyone, just as XEP-0004 does.

Improve the high-level form API: introduce FilledForm and FillableForm
which perform stronger validation and consistency checks.

Also add FormFieldRegistry to enable processing of 'submit' forms
where the form field types are omitted.

Smack also now does omit the form field type declaration on 'submit'
type forms, as it is allowed by XEP-0004.
2020-05-13 20:14:41 +02:00
Florian Schmaus 661b2743d9 mam: use new DataForm API in MamQueryIQ
Use the new API introduced with e58e6fa75 ("xdata: add more helper
methods to DataForm") in MamQueryIQ.
2020-04-18 19:03:00 +02:00
Florian Schmaus da5f59a996 Remove superfluous ' "" +' statements
Using

sed -i 's; "" +;;' <file>

to remove those.
2020-04-15 09:35:13 +02:00
Florian Schmaus 77d12d4758 fastening: set ENABLED_BY_DEFAULT to false
If it is announced as feature, entities sending fastened messages
expect the recipient to react somehow on those. And this is not the
case if this is just enabled in Smack.

Hence we disable it per default and require smack users to explicitly
enable it after they have setup the according stanza listeners.
2020-04-15 09:34:04 +02:00
Paul Schaub e0f7ddf5a8
Add support for XEP-0422: Message Fastening
SMACK-884
2020-04-13 18:17:26 +02:00
Paul Schaub 72a9cb65a6 OriginIdElement: Add proper equals() method 2020-04-13 17:38:47 +02:00
Florian Schmaus 7a57bb7c09 Rename Stanza.getExtension(String, String) to getExtensionElement() 2020-04-12 12:09:04 +02:00
Florian Schmaus 9879dea0bf Refer to static fields by their declaring type 2020-04-12 12:08:31 +02:00
Florian Schmaus 0479a75d1d Remove unnecessarily suppressed warnings 2020-04-12 12:07:59 +02:00
Florian Schmaus 8c4513a618 dox: make setDefaultDnsOverXmppResolver() static 2020-04-12 12:06:18 +02:00
Florian Schmaus c10a56dc84 mam: remove unused import 2020-04-12 12:06:00 +02:00
Florian Schmaus 516c68bdb4 test: remove InitExtensions
And replace it with SmackTestSuite.
2020-04-12 09:34:08 +02:00
Florian Schmaus 28e763f938 extensions/experimental: line separator according to import order 2020-04-12 09:33:14 +02:00
Florian Schmaus b5f9d4d7a3 Introduce test fixtures
This also removes the powermock dependency. Although powermock is a
fine library, it currently prevents dropping Junit4. And since we only
use the Whitebox API of powermock, this simply replaced powermock's
Whitebox with our own.
2020-04-11 22:05:36 +02:00
Florian Schmaus 390f7823e1 mam: add javadoc for parameter 2020-04-09 15:22:33 +02:00
Florian Schmaus b8b084970e mam: remove deprecated method in MamManager 2020-04-09 15:21:50 +02:00
Florian Schmaus 1e5ea1fdbe mam: remove dead code in MamManager 2020-04-09 15:20:00 +02:00
Florian Schmaus 353e43407f mam: support of advanced configuration
Fixes SMACK-822.

Co-authored-by: Jagmeet Singh <jagmeets@zeta.tech>
2020-04-09 15:18:02 +02:00
Florian Schmaus 10aee6c787 http-file-upload: make order of parameters more logical 2020-04-08 14:33:09 +02:00
Florian Schmaus 9c7f62ec07
Merge pull request #319 from adiaholic/SMACK-867
Extend HttpFileUploadManager with InputStream parameter
2020-04-08 14:30:35 +02:00
adiaholic dfa61c3058 Extend `HttpFileUploadManager` with InputStream parameter
Add support for InputStreams as Android is tending towards
inputStreams over file uploads.
Solves SMACK-867
2020-04-08 12:02:16 +05:30
Florian Schmaus 07da9ffb48 Do not have Stanza.getExtension(String, String) return a generic type
Returning a generic would allow for

List<ExtensionElement> list = stanza.getExtension("foo", "bar");

to compile (Note the we are calling getExtension(), not
getExtension*s*()).

Users are encouraged to use the type safe getExtension(Class<? extends
ExtensionElement) variant instead.

Fixes SMACK-825.
2020-04-05 22:10:05 +02:00
Florian Schmaus 12e20c2d6c Remove deprecated methods/fields scheduled for removal in Smack 4.4 2020-04-04 13:03:48 +02:00
Paul Schaub 3fb4438566 Reorder smack-extensions providers xml
Fix rfc number
2020-04-04 13:03:35 +02:00
Florian Schmaus 4dd3800d82 Remove Bouncycastle as direct dependency
By not directly depending on Bouncycastle (BC), we avoid conflicts between
different bouncycastle versions. It is also part of the developers job
to take care that all required security primitives are available. If
they are provide by BC or some other security provider should not be
up to Smack to decide.

We now only add BC as test dependency to satisfy this requirement when
the unit tests are executed.
2020-03-13 16:58:45 +01:00
Florian Schmaus 78be8f3a04 junit: bump to 5.6.0 2020-02-23 19:12:54 +01:00
Florian Schmaus eb4c2c5572 s/occured/occurred/ 2019-10-30 12:02:36 +01:00
Florian Schmaus e2223254cf Organize imports everywhere 2019-10-29 21:12:22 +01:00
Florian Schmaus 69767e9538 Rename AbstractIqBuilder subclasses to their designated names 2019-10-29 19:34:18 +01:00
Florian Schmaus 6e32305987 Apply builder pattern to DiscoverInfo
This is the first transformation of an IQ type to the builder type.
2019-10-29 11:14:55 +01:00
Florian Schmaus e2d206e741 Introduce XMPPConnection.add(Message|Presence)Interceptor
add deprecate addStanzaInterceptor().
2019-10-25 21:41:55 +02:00
Florian Schmaus 5db6191110 Introduce StanzaBuilder
As first step to immutable Stanza types.
2019-10-25 21:41:55 +02:00
Florian Schmaus eeb6c52f7e Move SASL logic into AbstractXMPPConnection
Besides the way the transport handles the stream after SASL
<success/>, the SASL logic is independend from the underlying
transport (BOSH, TCP, …). Hence move it up into
AbstractXMPPConnection.

This also has the benefit that we can make some more methods private
or package-private.

Also introduce XmlStringBuilder.optTextChild(), which causes some
associated changes.
2019-09-25 13:49:21 +02:00
Florian Schmaus a2acb7b66e
Merge pull request #345 from vanitasvitae/enableStanzaId
Make adding originId by default configurable
2019-09-16 17:40:16 +02:00
Florian Schmaus 2f667f95a8 gradle: Remove archives configuration
and FileTestUtil in favor of commons-io. This is required because
Eclipse won't put src/test code into the classpath of src/main
code (even though gradle was configured with an according
dependency).
2019-09-16 00:04:47 +02:00
Florian Schmaus 9b186f2541 Add support for XEP-0328: JID Prep
Fixes SMACK-878.
2019-09-08 18:29:46 +02:00
Florian Schmaus 34f1c2b79e errorprone: Enable MethodCanBeStatic 2019-09-07 23:01:39 +02:00
Florian Schmaus 65576cf3c2 Rework XML Element hierarchy and XmlStringBuilder
- Reduce the amount of types that are subtypes of NamedElement. See
javadoc of NamedElement for rationale.
- Work more with XmlEnvironment in XmlStringBuilder.
- Some minor changes to XmlStringBuilder API.
2019-09-07 18:17:08 +02:00
Florian Schmaus e9bcdf3e6d QueryArchiveTest: Call assertsEquals with the correct order of arguments
first expected, then actual.
2019-09-07 17:05:37 +02:00
Florian Schmaus e8819d31dd PagingTest: Call assertsEquals with the correct order of arguments
first expected, then actual.
2019-09-07 10:11:32 +02:00
Paul Schaub 80793910b8
Make adding originId by default configurable 2019-09-02 17:39:27 +02:00
Paul Schaub 3d0e5716e7
Add documentation 2019-08-31 19:36:17 +02:00
Paul Schaub 4d298e39e3
XEP-0359: Fix appending origin-ids 2019-08-31 19:36:10 +02:00
Florian Schmaus 5b23b9a6ae
Merge pull request #342 from fenek/fix-http-file-upload-header
Remove trailing semicolon in the header used in HttpFileUploadManager
2019-08-30 19:46:15 +02:00
Florian Schmaus 1a3067c89b Enable werror for javadoc and fix javadoc issues 2019-08-30 12:08:30 +02:00
Piotr Nosek 563dad08e8 Remove trailing semicolon in the header used in HttpFileUploadManager 2019-08-28 17:53:04 +02:00
Florian Schmaus 699905a1de Use HttpURLConnection.setFixedLengthStreamingMode(long)
now that we are on Android 19.
2019-08-04 23:04:00 +02:00
Florian Schmaus 8da954f7a4 OpenPGP: Bump Pgpainless to 0.0.1-alpha7
Also unify how new Security Providers are installed.

Thanks to Paul Schaub for helping with this.
2019-07-30 09:37:19 +02:00
Florian Schmaus 4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
Florian Schmaus 91ec6cc955 Javadoc changes for Java 11 compatibility 2019-07-19 23:05:46 +02:00
Florian Schmaus 178ae8abef Merge branch 'master' of github.com:igniterealtime/Smack 2019-07-04 16:57:07 +02:00
Paul Schaub 9072b78c76
Update XEP-0392 to 0.6.0 2019-06-30 16:01:08 +02:00
Florian Schmaus 01289e9682 Add support for XEP-0315: Data Forms XML Element
Fixes SMACK-872.
2019-06-12 22:32:24 +02:00
Florian Schmaus 818ee8a727 Make Objects.requireNonNull() throw IllegalArgumentException
and not NullPointerException. Altough this differs from
java.util.Objects behavior, throwing an IllegalArgumentException
appears more sensible and makes it easier to catch it in Smack's
parsing function.
2019-06-11 12:47:40 +02:00
Florian Schmaus 4d36e3b521 Introduce FormFieldChildElement and make FormField immutable 2019-06-11 12:47:39 +02:00
Florian Schmaus 619b8e6f4a Add secure(OnlineAttackSafe|Unique|OfflineAttackSafe)RandomString()
and replace usages of java.util.UUID in Smack with
secureUniqueRandomString() because it uses a thread-local secure random
number generator.
2019-06-02 20:08:03 +02:00
Florian Schmaus f7762c5db7 Add "whitespace after comma" checkstyle rule 2019-05-17 21:56:46 +02:00
Florian Schmaus d2f5efcb20 Use StandardCharsets.(UTF_8|US_ASCII)
This also gets rid of a ton of UnsupportedEncodingException s.
2019-05-08 12:44:48 +02:00
Florian Schmaus 7f0dc72dab Update errorprone(-plugin) and make Unused(Variable|Method) an error 2019-05-07 23:09:00 +02:00
Florian Schmaus e1ed035beb Remove xmlunit-lagacy and add xmlunit-assertj 2019-05-07 19:06:16 +02:00
Florian Schmaus 95dbf5bb36 Change JUnit API from 4 to 5 in smack-experimental 2019-05-07 18:51:22 +02:00
Florian Schmaus 505493d889 Add XmlStringBuilder.optAttribute(String, Number) 2019-05-07 10:18:55 +02:00
Florian Schmaus 4133eb175c Replace XPP3 by XmlPullParser interface wrapping StAX and XPP3
Introducing Smack's own XmlPullParser interface which tries to stay as
compatible as possible to XPP3. The interface is used to either wrap
StAX's XMLStreamReader if Smack is used on Java SE, and XPP3's
XmlPullParser if Smack is used on on Android.

Fixes SMACK-591.

Also introduce JUnit 5 and non-strict javadoc projects.
2019-05-06 22:10:50 +02:00
Florian Schmaus ae2c57f56b Fix XML in MamResultProviderTest
Add missing whitespace between XML attributes.
2019-04-29 13:56:16 +02:00
Florian Schmaus 9c30e4f3cc Merge branch '4.3' 2019-04-16 09:27:48 +02:00
Florian Schmaus 11775ed6b0 Add checkstyle rule for 'synchronized' on Manager.getInstanceFor() 2019-04-15 09:58:53 +02:00
Florian Schmaus 488055948d Add missing 'synchronized' keywords to Manager.getInstanceFor()
Fixes SMACK-865.
2019-04-15 09:48:52 +02:00
Florian Schmaus fc45e1b905 DoX: Ensure that the response message ID matches the query ID 2019-04-09 17:02:56 +02:00
Florian Schmaus 62fd897cf7 Add support for XEP-0418: DNS Queries over XMPP (DoX)
Fixes SMACK-862.
2019-04-09 10:56:47 +02:00
Florian Schmaus 9f8d13b8cd Do not explicitly select the Provider in HashManager
Note that we still setup the BouncyCastleProvider so all requested
MessageDigest instances should be avaialble.
2019-04-02 15:58:34 +02:00
Florian Schmaus d6a90942a4 Unify Bouncy Castle versions: Add bouncyCastleVersion variable 2019-04-02 15:58:34 +02:00
Florian Schmaus daab6039a1 Smack 4.3.3
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlyKV9tfFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFL4vQf/Qfg3VzNEnmk0+KjOtuvfAbhMfzE92gfo15vE0PPEIe9VA0Pzkvqhva4k
 Efw7BhD2zx8hWvo0d5FfkdII89hSYnOCiSmhiX1Ln9q/gUqFW0TDAKpsMfAl7jAK
 Fap8M7uUStP9T6fF/gq01djYCYoWA/4v1lGKv4J4b9gWCqzGIF2sK0M7of7VERnr
 pEXJSUM228rk6EYjVmX/9Ujo1Y+xaNMFFZZSbKYrirAqjP540v0OPBCRQyB8qFaI
 NTcNJ+qESe6Q80mw5V+y/kD6kX0LERSDB+pigzOOOlmfMtD1uADR84tAynuTKNAU
 7/5K/YSQxceRY6RTgD17Al5lHIH5nw==
 =ToR+
 -----END PGP SIGNATURE-----

Merge tag '4.3.3'

Smack 4.3.3
2019-03-14 18:23:33 +01:00
Florian Schmaus 3bdc1d30b1 Correctly name provider INSTANCE fields
and make them 'final' where possible.
2019-02-23 23:59:17 +01:00
Florian Schmaus 5f7cfd04bd Add further unit test to StableUniqueStanzaIdTest 2019-02-23 23:59:17 +01:00
Florian Schmaus 5a2109e73f Move cast in extra line in ADD_ORIGIN_ID_INTERCEPTOR 2019-02-23 23:40:27 +01:00
Florian Schmaus 4da4558b29 Make origin-id interceptor static and rename it 2019-02-23 23:39:58 +01:00
Florian Schmaus 27749b2137 Remove unused filter in StableUniqueStanzaIdManager 2019-02-23 23:39:41 +01:00
Florian Schmaus 8df69bd3ce Use XmlEnvironment in parsing/provider subsystem 2019-02-15 23:21:30 +01:00
Florian Schmaus 7fce6b5a98 Introduce SmackMessageException 2019-02-10 21:50:39 +01:00
Florian Schmaus 7dee3b88a2 Introduce SmackParsingException 2019-02-10 19:01:47 +01:00
Florian Schmaus 083dac8b83 Rework exceptions in the parsing / provider subsystem 2019-02-05 13:18:03 +01:00
Florian Schmaus fee3ed81ca Introduce XmlEnvironment 2019-02-05 13:18:03 +01:00
Florian Schmaus 658fd08d20 Use try-with-resources where possible
and make StanzaCollector implement AutoCloseable.
2019-02-05 13:18:03 +01:00
Florian Schmaus e98d42790a SmackReactor/NIO, Java8/Android19, Pretty print XML, FSM connections
This commit adds
- SmackReactor / NIO
- a framework for finite state machine connections
- support for Java 8
- pretty printed XML debug output

It also
- reworks the integration test framework
- raises the minimum Android API level to 19
- introduces XmppNioTcpConnection

Furthermore fixes SMACK-801 (at least partly). Java 8 language
features are available, but not all runtime library methods. For that
we would need to raise the Android API level to 24 or higher.
2019-02-05 13:18:03 +01:00
Florian Schmaus 7a3f6f29cc Merge branch '4.3' 2018-12-21 13:21:50 +01:00
Florian Schmaus d1c73eba8d Fix MamManager javadoc
of methods which have been renamed.
2018-12-20 17:00:00 +01:00
Florian Schmaus 273937199b Merge branch '4.3' 2018-11-29 22:55:38 +01:00
Tairs Rzajevs 0332fa54d1 Fix previous archive page requested incorrectly in MamManager
Previous page should be before the first message in the previous
result set, not the last.

Fixes SMACK-843.
2018-11-29 22:50:59 +01:00
Florian Schmaus 62a0c6f26e Merge branch '4.3' 2018-11-29 22:39:55 +01:00
Florian Schmaus dbfc123e5e Use ParserUtils.parseXmlBoolean() where appropriate 2018-11-29 22:29:21 +01:00
Florian Schmaus b7ea226c56 Bump "Error Prone" to 2.3.2
and gradle-errorprone-plugin to 0.6.
2018-10-31 16:06:31 +01:00
Florian Schmaus ab120691cb Smack 4.3.1
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlvDIBdfFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFKObAgApvEwstvSXhgzlrA46DM6fXezbPEnO1rh8rCPJEAsmfBSnyINSuuhelzw
 zN8L7GAU0jDeuDivxA12vQx5QB8wuCHKgc5pXDKNRi9eUdsyDUMKswcbMMAJWDvq
 I3bm7TOC1D9ZWmfhGmqfulrsVD1Q0wh+P2A1/CWVR5ZZUB5S4fESFZUrnCfJmeXe
 f+INXUiui3otAF6nPxKm782rSfHWvA32i4Obnagh3oPX/c9R7Ftb78Wukrsbaqfg
 +a5iTlBJXLG75/Yozq+JqmWlUvEKv7le0vkF5fF+oc76H4p1U1wqQyIMei/Pwaer
 H/SyMqLPzCiwpUHiunpWD13e5kkeLw==
 =47on
 -----END PGP SIGNATURE-----

Merge tag '4.3.1'

Smack 4.3.1
2018-10-14 14:31:31 +02:00
Simon Schuster f23f27aa75 Typo in CarbonManager.java
The listeners "were" registered...
2018-09-09 22:06:43 +02:00
Florian Schmaus 105192d7e7 Only announce support for ChatMarkers if there is a listener 2018-09-06 20:24:41 +02:00
Florian Schmaus 0fa6fb946c Remove broken methods in ChatMarkersManager 2018-09-06 20:24:41 +02:00
Florian Schmaus 0778485243 Deduplicate code ChatMarkersElements
by introducing ChatMarkerExtensionWithId.
2018-09-06 20:24:41 +02:00
Florian Schmaus 36bfa060a5 Ensure the ID is given in ChatMarkersElements 2018-09-06 20:24:41 +02:00
Florian Schmaus 3547fde91c Rename EligibleForChatMarker to EligibleForChatMarkerFilter 2018-09-06 20:24:41 +02:00
Florian Schmaus 3f1b18636e Use Message.hasStanzaIdSet() in EligibleForChatMarker filter 2018-09-06 20:24:41 +02:00
Florian Schmaus 0b9cce507d Use asEntityBareJidOrThrow() in ChatMarkersManager listener 2018-09-06 20:24:41 +02:00