Commit Graph

4634 Commits

Author SHA1 Message Date
Florian Schmaus e25be8fea4
Merge pull request #510 from Flowdalic/future-invoke-at-most-once
[SmackFuture] Invoke the callbacks at most once
2022-02-03 07:58:19 +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 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 5c46451cd2 [xdata] Add BooleanFormField.getValueAsBooleanOrNull()
This method is meant to provide 'raw' access to what has been sent
over the wire. It is assumed to be not of much use in the typically
case, but provided for completeness.
2021-12-27 21:24:19 +01:00
Florian Schmaus 940d7bf02a [xdata] Adjust behavior of BooleanFormField.getValueAsBoolean()
According to XEP-0004 § 3.3, the default value of a boolean form field
is 'false'. And since users are typically interested in getting the
value, and not potentially 'null' as result, we adjust the behavior of
the getValueAsBoolean() method consider the default value.
2021-12-27 21:17:57 +01:00
Florian Schmaus 178e82a3aa
Merge pull request #506 from Flowdalic/gssapi-no-password
Prevent password enforcement for SASL GSSAPI
2021-12-21 13:37:31 +01:00
Florian Schmaus 817dc0ed3a Prevent password enforcement for SASL GSSAPI
Similar fix as 9b339efbc1 ("Prevent password enforcement for SASL
anonymous") just for SASL GSSAPI. Fixes SMACK-920.

Fixes: 92f4aadfdc ("[sasl] Avoid mechanisms that need a password when none is available")
2021-12-21 12:53:10 +01:00
Florian Schmaus 993a307222 Add o.j.smackx.softwareinfo.form.SoftwareInfoForm to startup classes
This ensures that the form fields are registered.
2021-12-17 09:51:19 +01:00
Florian Schmaus 182d01a4b0 [softwareinfo] Register urn:xmpp:dataforms:softwareinfo's field types 2021-12-15 20:17:23 +01:00
Florian Schmaus e1845a52ca [formtypes] Add FormFieldRegistry.register(String, FormField.Type, String...) 2021-12-15 20:17:23 +01:00
Florian Schmaus fc7fc10c69 [pubsub] Allow for character data before <item/>'s payload
Fixes SMACK-918.
2021-12-13 21:50:10 +01:00
Florian Schmaus e39adff40f [muc] Only notify() about processed self-presence once
Since notify() is a rather expensive operation, we should only invoke
it once. Especially since some servers include 110 in all self
presences, not just the initially reflected one on MUC join.
2021-12-13 21:20:40 +01:00
Florian Schmaus d1273532ce [muc] Correctly processes self-presences
The change in 52a49769f9 ("[muc] Check for self-presence first in
presence listener") caused all self-presences (MUC user status 110) to
be ignored in the further processing chain eventually invoking
checkRoleModifications() and checkAffiliationModifications(). However,
some servers (e.g., ejabberd) include 110 not only in the initial
presence but in all following, and we ant to process these.

Fixes SMACK-918

Fixes: 52a49769f9
2021-12-13 21:15:30 +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 403890d988 Smack 4.4.5-SNAPSHOT 2021-11-01 18:10:35 +01:00
Florian Schmaus 5731e61782 Smack 4.4.4 2021-11-01 17:54:01 +01:00
Florian Schmaus 22cf7bace8 [resources] Rename get-contributors.sh to generate-notice-file 2021-11-01 17:53:01 +01:00
Florian Schmaus 22b2efc6a6 Update NOTICE file 2021-10-25 17:00:14 +02:00
Florian Schmaus 7fd300888e
Merge pull request #504 from JonathanLennox/StanzaBuilder-remove-extension
Add removeExtension methods to StanzaBuilder.
2021-10-25 16:58:49 +02:00
Jonathan Lennox 4ae3fbb073 Add removeExtension methods to StanzaBuilder. 2021-10-25 14:50:45 +00:00
Florian Schmaus 447c1304cf
Merge pull request #503 from jitsi/bugfix/4.4/bosh-connection2
Add missing stream namespace to xml declaration
2021-10-21 13:35:09 +02:00
Ingo Bauersachs d8ce2d335b Add missing stream namespace to xml declaration
Fixes 7199003f98
2021-10-21 09:14:52 +02:00
Florian Schmaus d0be6a6216 [build] Remove OSS Sonatype Snapshot repository
Having the OSS Sonatype Snapshot repository searched causes build
failures if there snapshot dependencies are resolved due the javadoc
linking:

javadoc: error - Error fetching URL: https://jxmpp.org/releases/1.0.3-SNAPSHOT/javadoc/
> Task :javadocAll
javadoc: error - Error fetching URL: https://minidns.org/releases/1.0.2-SNAPSHOT/javadoc/
2 errors
2021-10-20 19:02:19 +02:00
Florian Schmaus f03f2c75f8
Merge pull request #502 from abyss638/accept_empty_form_label_backport_from_master
Accept empty string as form field label value (backport to 4.4)
2021-10-20 16:29:14 +02:00
Simon Abykov 19270a2eca Accept an empty string as the label value 2021-10-20 10:12:29 +01: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 7199003f98
Merge pull request #498 from jitsi/bugfix/4.4/bosh-connection
Fix BOSH connection establishment
2021-10-19 14:10:44 +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 ad6e285346
Merge pull request #496 from damencho/fix-destroy-4.4
fix: Fixes processing destroy unavailable presence.
2021-10-19 14:09:27 +02:00
Florian Schmaus dac8b728b4
Merge pull request #492 from Flowdalic/start-local-socks5-proxy
Start local SOCKS5 proxy
2021-10-19 14:08:57 +02:00
Florian Schmaus 2ff53abef3
Merge pull request #494 from Flowdalic/mux-race-condition
[muc] Check for self-presence first
2021-10-19 14:08:32 +02:00
Florian Schmaus d25bd811dc
Merge pull request #491 from Flowdalic/assert-not-end-document
[core] Assert that 'event' is not END_DOCUMENT in forwardToEndTagOfDepth()
2021-10-19 14:08:16 +02:00
Florian Schmaus 6f67553fcf [jingle] Add unit test to check that there are no redundant namespaces
Related to SMACK-917.
2021-10-19 11:34:07 +02:00
Florian Schmaus 453ca6aeb0 [jingle] Make Jingle.Builder extend IqBuilder
This makes Jingle.Builder to follow the new IqBuilder pattern,
allowing to construct Jingle IQs with a given stanza ID (mostly
useful for unit tests).
2021-10-19 11:32:51 +02:00
Florian Schmaus a3840659aa [jingle] Mimic Manager.connection() in JingleTransportManager
Eventually JingleTransportManager should be a subclass of Manager (or
be replaced by Manager), as JingleTransportManager holds a strong
reference to the XMPPConnection. This could cause memory leaks. But
for now, we mimic the Manager API in JingleTransportManger to make a
future transition to Manager easier.
2021-10-19 11:31:08 +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
Florian Schmaus 585bcb4dc8 [jingle] Add empty element optimization for <content/> 2021-10-19 11:16:35 +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 8074ddd60a Fix BOSH connection establishment
AbstractXMPPConnection waits for the flag lastFeaturesReceived since
57961a8cc1, but it is never set from
BOSH connections. Use parseFeaturesAndNotify instead of
parseFeatures to set the signal.

Similarly the XmlEnvironment is not set from bosh, but required in
ParserUtils.getXmlLang.
2021-10-17 15:00:04 +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
Дамян Минков 820adf8865 [muc] Also process destory message if it contains <status/>
Fixes SMACK-915
2021-10-13 07:04:32 -07:00
Florian Schmaus 105c74b22b [muc] Call userHasLeft() *after* the leave presence was sent
Calling userHasLeft before sending the leave presence may result in
invalid state as the MUC presence lister may modify the MUCs local
state, e.g., occupantsMap, conurrently with the leave operation.

If we reset it after the leave presence was send and acknowledged,
then this can not happen as the server will not longer send any MUC
related presences to us.

Also fixes SMACK-914. In theory 52a49769f9 ("[muc] Check for
self-presence first in presence listener") alone would fix SMACK-914,
but this also fixes it indepentendly of 52a49769f9. Both commits are
sensible, so both are applied.
2021-10-11 09:09:20 +02:00
Florian Schmaus 52a49769f9 [muc] Check for self-presence first in presence listener
Fixes SMACK-914
2021-10-11 09:08:44 +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
Florian Schmaus ae4ff244a3 [muc] Check mucServicedDiscoInfo for null in serviceSupportsStableIds()
Fixes SMACK-913.
2021-09-27 13:56:15 +02:00