Commit Graph

315 Commits

Author SHA1 Message Date
Florian Schmaus e842195b71 Merge branch '4.4' 2021-10-19 14:33:21 +02:00
Florian Schmaus ec456399b5 [carbons] Remove erroneous assert statement in connectionClosed()
The assert statement in CarbonManager's connectionClosed() connection
listener callback was erroneous. A connection may be connected, but
never was authenticated. If now the connection is closed, then
carbonsListener was never setup (via the authenticated() callback),
causing the assert to throw an exception.
2021-09-27 14:14:01 +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 31e4e1faf2 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 13:37:57 +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 39b211cde3 [muc] Use StanzaCollector.nextResultBlockForever() in MultiUserChat.nextMessage() 2021-05-12 10:18:17 +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 5493a22e44 Merge branch '4.4' 2021-04-18 17:25:14 +02:00
Florian Schmaus 961882ff7f Add more QNAME fields to extension element classes 2021-04-18 17:23:34 +02:00
Florian Schmaus fbddd074bc [gradle] Do not use deprecated 'compile' directive 2021-04-14 20:30:51 +02:00
Florian Schmaus e6433a6870 Merge branch '4.4' 2021-03-31 12:26:25 +02:00
Florian Schmaus 8c57d34b97
Merge pull request #466 from Vshnv/master
Added proxy support for XEP-0363
2021-03-29 18:15:40 +02:00
Vshnv 4736d080a1 Added proxy support for XEP-0363 2021-03-29 19:01:58 +05:30
Florian Schmaus ed807d5954 Merge branch '4.4' 2021-03-23 21:41:25 +01:00
Florian Schmaus 64a2db3f19 [sid] Add <origin-id/> to MUC messages if not muc#stable_id 2021-03-23 21:27:10 +01:00
Florian Schmaus b8f23eb371 [sid] Do not enable StableUniqueStanzaIdManager per default 2021-03-23 21:27:10 +01:00
Florian Schmaus 800c771700 [sid] Check if there is already a <origin-id/> in addOriginId() 2021-03-23 21:27:09 +01: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 c1b32f8e11 [carbons] Throw SmackParsingException instead of IOException 2020-09-23 17:47:04 +02:00
Florian Schmaus b7824f008d Introduce and use XmlStringBuilder.text()
Smack currently does unnecessary escaping of XML text, where it
escapes e.g. '"' to '&quot;'. This bloats the stanza size, especially
if JSON payloads are involved.

Fixes SMACK-892 (although there are probably still places where
XmlStringBuilder.escape() is used when XmlStringBuild.text() could
have been used).
2020-09-17 14:20:11 +02:00
Florian Schmaus 99297e5a76 [mam] Improve MamResultExtension: use MessageView in from() and add QNAME 2020-08-28 09:47:54 +02:00
Paul Schaub 78f37a909e
Add support for XEP-0420: Stanza Content Encryption 2020-07-23 11:02:28 +02:00
Paul Schaub 00acdfcb9e
Add QName field in OriginIdElement 2020-07-03 00:24:05 +02:00
Florian Schmaus 18c2c37ad0 Rename XmlUnitUtils to XmlAssertUtil 2020-06-14 16:53:21 +02:00
Florian Schmaus f5448c5faa [core] Rework TLS logic
This moves the logic in AbstractXMPPConnection.getSmackTlsContext()
into the ConnectionConfiguration constructor.

Also introduce SslContextFactory and use it in
ConnectionConfiguration.
2020-05-25 15:41:57 +02:00
Florian Schmaus d65f2c932e Bump Error Prone version to 2.3.4 and fix new bug patterns 2020-05-24 21:10:01 +02:00
Florian Schmaus 1c0bdfae40 [experimental] Delcare methods as static when possible 2020-05-24 18:01:00 +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 ebe5c49e92 [checkstyle] Tighten JavadocMethod checkstyle rule 2020-05-23 22:43:29 +02:00
Florian Schmaus ca85b8326a [test] Use correct class StanzaBuilder for static call to buildMessage() 2020-05-21 22:44:51 +02:00
Florian Schmaus c4ad857c0d [carbons] Add CarbonExtension.Private.addTo(MessageBuilder), deprecate old 2020-05-21 22:44:14 +02:00
Florian Schmaus 4cb214ef8f
Merge pull request #367 from vanitasvitae/carbonEnable
Allow for offline configuration of CarbonManager
2020-05-15 11:31:23 +02:00
Paul Schaub 429c89d59a Add support for XEP-0424: Message Retraction
SMACK-886
2020-05-14 17:48:20 +02:00
Florian Schmaus bdedf5a0a2
Merge pull request #368 from vanitasvitae/fallbackIndication
XEP-0428: Fallback Indication
2020-05-14 17:45:06 +02:00
Paul Schaub ffb8729ba7 Allow for offline configuration of CarbonManager 2020-05-13 22:28:48 +02:00
Paul Schaub 39a6e7e888
Add support for XEP-0428: Fallback Indication
Fixes SMACK-889
2020-05-13 22:18:09 +02:00
Florian Schmaus ab2d3a2b79 [core] Deprecate AbstractConnectionListener 2020-05-13 22:14:43 +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 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