Commit Graph

1092 Commits

Author SHA1 Message Date
Florian Schmaus 4a83d2957e Merge branch '4.4' 2022-02-06 17:48:08 +01:00
Boris Grozev 67a5c3a41a [core] Correctly handle due time of '0' in SmackReactor
Scheduled actions that are due in 0 milliseconds are due
immediately. Otherwise we would invoke select() with 0.

Fixes SMACK-923.
2022-02-06 17:38:50 +01:00
Florian Schmaus ad9867ebdf Merge branch '4.4' 2022-02-03 08:43:32 +01:00
Florian Schmaus 5cd7a6c60e
Merge pull request #509 from Flowdalic/jingle-reason-extension-element
Jingle reason extension element
2022-02-03 07:58:29 +01:00
Florian Schmaus 3ff553549a [SmackFuture] Invoke the callbacks at most once
Previously, if a SmackFuture both was successful and unsuccessful, it
was possible that the onSuccess() callback was invoked twice.

Reported-by: Boris Grozev <boris@jitsi.org>
2022-02-02 20:47:31 +01:00
cmeng-git 4cdb4acf26 [core] Fix IQProvider javadoc
It is IqProvider that should be used instead.
2022-02-02 12:13:25 +01:00
Florian Schmaus c06cf72337 [core] Support IqProvider in SmackTestUtil 2022-02-02 10:41:00 +01:00
Florian Schmaus 0e637068e6 [core] Factor PacketParserUtils.parseIqData() in extra method 2022-02-02 10:41:00 +01:00
Florian Schmaus 1dae0c0c32 [core] Use Enum.toString() in XmlStringBuilder.attribute(String, Enum<?>)
All other enum-using methods of XmlStringBuilder already use
Enum.toString(), as opposed to Enum.name(), this was the only left. I
do not remember why I did not to change this method too, probably
because of its plenty call sites.

But since this method already broke Jingle XML serializaton,
JingleAction was e.g., 'session_accept' when it should be
'session-accept', we change it now.

Fixes SMACK-921.
2022-01-22 11:08:35 +01:00
Florian Schmaus 1a727c152e [core] Improve warning message of ExceptionThrowingCallbackWithHint 2022-01-22 10:24:01 +01:00
Florian Schmaus 10a2687ff1 [sinttest] Allow the selection of individual test *methods* 2021-12-13 21:08:45 +01:00
Florian Schmaus 11cc2d8d77 [core] Align behavior of getParserFor(InputStream) and getParserFor(Reader)
Reported-by: Ingo Bauersachs <ingo@jitsi.org>
2021-11-30 10:49:55 +01:00
Florian Schmaus cad63bc107 Merge branch '4.4' 2021-11-09 15:30:02 +01:00
Florian Schmaus 8736e3e434 [core] Remove erroneous "assert !connected" in connect()
Connections like XMPPTCPConnection may still reported connected, if
they are, for example disconnected but resumable. This is already
accounted for in throwAlreadyConnectedExceptionIfAppropriate(), hence
the assert is unnecessary and leads to false negatives for
XMPPTCPConnection.

For the sake of completeness, the right condition, assuming
XMPPTCPConnection is used, for the assert would be:

	assert !connected || disconnectedButResumable;
2021-11-05 10:19:26 +01:00
Florian Schmaus 7dc8cc176e [core] Add DoOnce utility 2021-11-01 19:27:09 +01:00
Florian Schmaus fa88f78232 Merge branch '4.4' 2021-10-25 17:05:12 +02:00
Jonathan Lennox 4ae3fbb073 Add removeExtension methods to StanzaBuilder. 2021-10-25 14:50:45 +00:00
Florian Schmaus e842195b71 Merge branch '4.4' 2021-10-19 14:33:21 +02:00
Florian Schmaus ab92bc4b40
Merge pull request #501 from Flowdalic/fix-redundant-namespaces
Fix redundant namespaces
2021-10-19 14:29:18 +02:00
Florian Schmaus 0fa6d88575
Merge pull request #500 from jitsi/bugfix/4.4/error-stanzagetter
Add getter for the stanza associated with the exception
2021-10-19 14:29:11 +02:00
Florian Schmaus a0f97707d8
Merge pull request #499 from jitsi/feature/4.4/osgi
Make Smack jars OSGi bundles
2021-10-19 14:28:59 +02:00
Florian Schmaus 9fb7d6d97c
Merge pull request #497 from jitsi/bugfix/4.4/sasl-anonymous
Prevent password enforcement for SASL anonymous
2021-10-19 14:09:39 +02:00
Florian Schmaus b243a40e26 [core] Pass down the XML environment in IQChildElementXmlStringBuilder
This allows to avoid redundant XML namespaces within IQs, like for
example here:

<iq xmlns='jabber:client' id='EKP8I-1' type='set'>
    <jingle xmlns='urn:xmpp:jingle:1' action='content-accept' sid='MySession'>
        <content xmlns='urn:xmpp:jingle:1' creator='initiator' name='Hello world'>
        </content>
    </jingle>
</iq>

Fixes SMACK-917

Reported-by: Jonathan Lennox
2021-10-19 11:29:23 +02:00
Ingo Bauersachs 27ff37fa98 Add getter for the stanza associated with the exception
Fixes SMACK-916
2021-10-17 16:06:41 +02:00
Ingo Bauersachs b675aac81b Make Smack jars OSGi bundles
Fixes SMACK-343 by using bnd instead of the deprecated Gradle
plugin that was previously used and removed in commit
d06f533bb9.
2021-10-17 15:57:48 +02:00
Ingo Bauersachs 9b339efbc1 Prevent password enforcement for SASL anonymous
requirePassword from 92f4aadfdc
already excludes SASL external, but missed SASL anonymous.
2021-10-16 21:09:01 +02:00
Florian Schmaus 55299fb7e7 [core] Assert that 'event' is not END_DOCUMENT in forwardToEndTagOfDepth() 2021-09-13 10:10:55 +02:00
Jonathan Lennox f0a0796d33 Update documentation of default SecurityMode. 2021-09-09 17:28:25 +00:00
Florian Schmaus 3f2418dec7 [core] Fix spelling errors in code comment within PacketParserUtils 2021-08-25 22:54:23 +02:00
Florian Schmaus 001985647a Merge branch '4.4'
This also fixes a errornous merge where the same branch with different
commit was merged into master and 4.4

The conflicting commits are

4.4:
8f760eaeb3  getRawValueCharSequences
e626580f68

master:
b47225c2c1  getRawValues
097d245358
2021-08-23 18:02:00 +02:00
Florian Schmaus 32a38c4e77 [core] Check if the successor vertex exists in StateDescriptorGraph
If the successor's module is disabled then the vertex may be null. In
this case, we can simple continue with the next successor in the list.

Previously, due to d33a5a23c3 ("[core] Introduce
Builder.failOnUnknownStates() and unit tests") this would trigger an
assert in addOutgoingEdge().

Fixes: d33a5a23c3 ("[core] Introduce Builder.failOnUnknownStates() and unit tests")
2021-08-22 16:30:30 +02:00
Florian Schmaus 59d3d75a71 Merge branch '4.4' 2021-08-03 21:54:50 +02:00
Florian Schmaus e626580f68 [xdata] Safe the raw character data of form field values
Related to SMACK-909.
2021-07-19 15:38:42 +02:00
Florian Schmaus 097d245358 [xdata] Safe the raw character data of form field values 2021-07-18 17:21:50 +02:00
Florian Schmaus d33a5a23c3 [core] Introduce Builder.failOnUnknownStates() and unit tests
The previous approach of emitting a severe log message when a
state (descriptor) was unknown was misleading. There are valid cases
where some states are not known, if, for example, a module was
explicitly disabled.

Using Builder.failOnUnknownStates() in unit tests is far cleaner, as
the existence of unknown states is tested in a controlled environment:
one where are states are supposed to be known.
2021-07-06 14:06:39 +02:00
Florian Schmaus 8cd0a9f5ce [core] Mark IntrospectionProvider as deprecated 2021-05-02 17:16:58 +02:00
Florian Schmaus a806595a77 [core] Move IqData construction API to the right place
AbstractIqBuilder is the wrong place for those methods, they belong in
IqData.
2021-05-02 17:16:58 +02:00
Florian Schmaus ba5c2e46d8 [smack-core] Fix javadoc of EmbeddedExtensionProvider 2021-04-27 17:01:50 +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 533695c1b4 [core] Properly reply to IQ requests
Properly reply to IQ requests with feature-not-implemented or
service-unavailable. In case there is no IQ request handler but the IQ
namespace is known, we reply with feature-not-implemented, otherwise
with service-unavailable.
2021-04-01 13:57:36 +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 525db827a9 Added support for Java's Proxy class in ProxyInfo 2021-03-29 19:01:42 +05:30
Florian Schmaus e04a3877fb Merge branch '4.4' 2021-03-25 19:28:58 +01:00
Florian Schmaus 92f4aadfdc [sasl] Avoid mechanisms that need a password when none is available 2021-03-25 15:01:15 +01:00
Florian Schmaus 33d735a42e [core] Make Smack.getNoticeStream() more robust
Appearently simply calling ClassLoader.getSystemResourceAsStream()
works on Java SE but not on Android. But our FileUtils are able to
load the resource stream on Android.
2021-03-25 14:58:44 +01:00
Florian Schmaus b58511d624 [core] Also provide incoming Nonzas to SmackDebugger 2021-03-25 14:51:25 +01:00