Commit Graph

68 Commits

Author SHA1 Message Date
Ingo Bauersachs 4efa707028 Replace legacy IQProvider with IqProvider 2022-04-02 16:02:46 +02:00
Frank Matheron 5b857a1b82 [mam] Support multiple versions of MAM
Support multiple version of MAM and do discovery of the version of MAM supported by
the archive. Currently supported MAM versions are v1 and v2.

Fixes SMACK-911

See https://discourse.igniterealtime.org/t/mam-support-of-multiple-mam-versions/90136
2021-08-26 16:49:06 +02:00
Florian Schmaus c13f4ccac3 [mam] Fix MamPrfsIQProviderTest
Parsers handed over to IQ providers should be positioned at the IQ
child element when being invoked. Therefore we remove the wrapping
<iq> in some test XML.

Also make checkMamPrefsIQProvider() a paramterized test.
2021-08-25 22:52:26 +02:00
Florian Schmaus 613f1afcab [mam] Delete unused local variable 'iqType' in MamPrefsIQProvider 2021-08-25 22:48:31 +02:00
Florian Schmaus 5eef31e49c Do not call XmlPullParser.getName() when the event is unknown
XmlPullParser.getName() only returns a result if the current parser
event is START_ELEMENT or END_ELEMENT. If this is not the case, then
the method may throw (if StAX is used).
2021-07-06 12:33:11 +02:00
Florian Schmaus aab48570c9 Call XMPPConnection.sendIqRequestAndWaitForResponse(IQ) where possible
Refactored using

find . -type f -name "*.java" |\
	 xargs sed -i -E |\
		's/\.createStanzaCollectorAndSend\((\w+)\)\.nextResultOrThrow\(\);/.sendIqRequestAndWaitForResponse(\1);/'

and some manual refactoring.
2021-05-12 10:12:40 +02:00
Florian Schmaus 3d4e7938a7 Make ExtensionElement marker interface wrt. QNAME field
ExtensionElement is now a marker interface that requires all
implementation non-abstract classes to carry a static final QNAME
field (of type QName). This is verified by a new unit test.

Also FullyQualifiedElement is renamed to simply XmlElement. XmlElement
is used over ExtensionElement when implementing classes do not
statically know the qualified name of the XML elements they
represent. In general, XmlElement should be used sparingly, and every
XML element should be modeled by its own Java class (implementing
ExtensionElement).
2021-04-18 21:07:19 +02:00
Florian Schmaus a7b3303f3e Bump ErrorProne to 2.5.1 and refactor Providers a bit
This also resulted in a refactoring of the Providers and parsing
Exceptions. NumberFormatException and ParseException can now be thrown
directly, the wrapping in a SmackParsingException is down at a higher
layer, i.e. in AbstractProvider.
2021-01-29 09:26:15 +01:00
Florian Schmaus fe7d3bec30 Make Forwarded a generic type
Fixes SMACK-821.
2020-09-23 17:48:04 +02:00
Florian Schmaus 99297e5a76 [mam] Improve MamResultExtension: use MessageView in from() and add QNAME 2020-08-28 09:47:54 +02:00
Florian Schmaus f045c0dd08 Update Message Archive Management (XEP-0313) support to urn:xmpp:mam:2
Fixes SMACK-890.
2020-05-24 12:42:58 +02:00
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 7a57bb7c09 Rename Stanza.getExtension(String, String) to getExtensionElement() 2020-04-12 12:09:04 +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 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 78be8f3a04 junit: bump to 5.6.0 2020-02-23 19:12:54 +01: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 1a3067c89b Enable werror for javadoc and fix javadoc issues 2019-08-30 12:08:30 +02:00
Florian Schmaus 4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +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 7f0dc72dab Update errorprone(-plugin) and make Unused(Variable|Method) an error 2019-05-07 23:09:00 +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 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 8df69bd3ce Use XmlEnvironment in parsing/provider subsystem 2019-02-15 23:21:30 +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 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 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
Florian Schmaus 158103c918 Add javadoc for MamQueryArgs.Builder.queryLastPage() 2018-08-16 15:35:59 +02:00
Florian Schmaus a4f1039a06 Fix example in MamManager's javadoc: s/queryRecentPage/queryLastPage/ 2018-08-16 15:35:38 +02:00
Florian Schmaus 9f786fc70d Remove deprecated methods in MamManager 2018-06-14 10:00:24 +02:00
Florian Schmaus 9161ba9e7d Improve MamManager API 2018-06-12 08:53:18 +02:00
Florian Schmaus a3cf1ab0ca Fix MamManager.isSupported(): Use archive address 2018-06-06 08:45:13 +02:00
Florian Schmaus fb5d7ff7d4 Add MamManager.getInstanceFor(MultiUserChat) 2018-05-31 18:37:31 +02:00
Florian Schmaus cb97b5032c Improve javadoc for MamManager.getInstanceFor(XMPPConnection) 2018-05-31 18:27:54 +02:00
Florian Schmaus 50e98fe31d Improve javadoc for MamManager.isSupported() 2018-05-31 18:27:34 +02:00