Commit Graph

4672 Commits

Author SHA1 Message Date
Boris Grozev 6da9773bbf Add null check for mucUser.
XEP-0045 requires "unavailable" presence to contain extended presence, but Smack shouldn't throw an exception if it doesn't.
2023-02-17 11:40:04 -06:00
Florian Schmaus 5295a856e4
Merge pull request #541 from Flowdalic/drop-in-ordered-listener
[core] Replace AbstractXMPPConnection.inOrderListeners
2022-10-05 11:44:11 +02:00
Florian Schmaus 92f253cc74 [core] Replace AbstractXMPPConnection.inOrderListeners
Using AsyncButOrdered for the receive listeners means that a listener
may not have been yet run once
invokeStanzaCollectorsAndNotifyRecvListeners() returnes. This can lead
to deadlocks as reported by Boris Grozev [1].

Fixes SMACK-927.

1: https://discourse.igniterealtime.org/t/thread-stuck-in-multiuserchat-enter-forever/92090
2022-10-05 11:28:48 +02:00
Florian Schmaus 9486fd6176 [muc] Remove stale comment from MultiUserChat.userHashLeft()
Set started with Smack 4.4 to set myRoomJid to null, introduced by
ab2822be3e ("muc: also set myRoomJid to null if we have left the
room"), however the code comment still states that we "do not reset
nickname here" (and myRoomJid contains the nickname as its
resourcepart).

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-09-02 16:13:49 +02:00
Florian Schmaus c081585c26
Merge pull request #539 from tharkum/4.4
[muc] Fix removal of the MUC's main presence interceptor
2022-08-30 22:53:36 +03:00
Andrey Volykhin fbd5761296 [muc] Fix removal of the MUC's main presence interceptor
On dinamically remove the last existed presence interceptor
we also should to remove the MUC's main presence interceptor from the connection.

Fixes: 60fee7b ("[muc] Fix Presence interceptors")
2022-08-30 11:57:23 +00:00
Florian Schmaus 8c359eed16 Smack 4.4.7-SNAPSHOT 2022-06-29 10:18:40 +02:00
Florian Schmaus a82ae41c22 Smack 4.4.6 2022-06-29 09:31:08 +02:00
Florian Schmaus 382ec723a8
Merge pull request #531 from Flowdalic/truely-async-sends
[core] Add AbstractXMPPConnection.TRUELY_ASYNC_SENDS
2022-06-06 10:01:28 +02:00
Florian Schmaus 66370c7ef5 [core] Add SmackConfiguration.TRUELY_ASYNC_SENDS
This option is meant a quick and dirty hack until
XMPPConnection.sendStanza() throws a dedicated Exception in case the
connection's outgoing queue is full.
2022-06-06 09:52:57 +02:00
Florian Schmaus 52a3490e07
Merge pull request #530 from Flowdalic/fix-bosh-url
[bosh] Fix BOSHConfiguration.getURI()
2022-05-26 20:21:14 +02:00
Florian Schmaus 8ebe453363 [bosh] Fix BOSHConfiguration.getURI()
Reported-by: Damian Minkov <damencho@jitsi.org>
Fixes: aa441d743c ("[bosh] Use ConnectionConfiguration.getHostString() in BOSHConfiguration")
2022-05-26 19:53:06 +02:00
Florian Schmaus c9af6576c0
Merge pull request #529 from Flowdalic/fix-sd-memleak
[disco] Fix memory leak in ServiceDiscoveryManager
2022-05-26 18:11:54 +02:00
Florian Schmaus 69e81b748e [disco] Only perform entity capabilities work if there are any listeners 2022-05-26 18:03:36 +02:00
Florian Schmaus 5b6dd8e3f7 [disco] Fix memory leak in ServiceDiscoveryManager
The lambda we schedule in 25ms captures a strong reference to the
XMPPConnection. However the lambda is part of the scheduled action,
which we save in the renewEntityCapsScheduledAction field. This causes
a memory leak, since the ServiceDiscoveryManager now holds a strong
reference to its XMPPConnection.

Fix this by obtaining the strong reference to the XMPPConnection, if
one still exists, within the lambda.

Fixes SMACK-926.

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-05-26 15:39:41 +02:00
Florian Schmaus f402a9d12d
Merge pull request #528 from Flowdalic/fix-mux-presence-interceptor
[muc] Fix Presence interceptors
2022-05-23 12:30:58 +02:00
Florian Schmaus 60fee7b318 [muc] Fix Presence interceptors
Presence interceptors where hooked into stanza sending listeners,
which are called *after* the stanza has been put on the wire, i.e., to
late for interceptors that any modifications, they may perform, to
take effect.

Fixes SMACK-925.

We now also dynamically add the MUC's main presence interceptor to the
connection.

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-05-22 10:51:45 +02:00
Florian Schmaus aa441d743c [bosh] Use ConnectionConfiguration.getHostString() in BOSHConfiguration 2022-05-18 21:45:32 +02:00
Florian Schmaus 00bcbff5ee [core] Add ConnectionConfiguration.getHostString() 2022-05-18 21:45:00 +02:00
Florian Schmaus 9b6e209b5f
Merge pull request #526 from damencho/fix-bosh-ip-address-4.4
fix: Bosh configuration when bosh URI contains IP address.
2022-05-18 16:50:16 +02:00
Дамян Минков d0db485c24 fix: Bosh configuration when bosh URI contains IP address. 2022-05-18 08:08:47 -05:00
Florian Schmaus 881ebe731d [core] Fix typo in javadoc 2022-04-30 15:15:51 +02:00
Florian Schmaus 1f5326abb2 [core] Inline waitForConditionOrConnectionException
Using any of the two methods is error prone, see 0e0c0a4093 ("[tcp]
Fix handling in connection exceptions when resuming a stream"), as one
can easily forget to check for connection exceptions after it
returned. There are also no longer any call sites of those methods.

Let's inline both variants of this method.
2022-04-30 15:15:42 +02:00
Florian Schmaus 0e0c0a4093 [tcp] Fix handling in connection exceptions when resuming a stream
Smack would previous run into "assert smResumptionFailed != null;" at
line 407, since if a connection exception was encountered,
waitForConditionOrConnectionException() would return, but we afterards
just assumed that either SM resumption was successful or not.
2022-04-30 15:06:15 +02:00
Florian Schmaus 95ff591c14 [xdata] Only emit warning about unregistered fields once per field 2022-03-06 21:44:33 +01:00
Florian Schmaus 162d8ba30b Smack 4.4.6-SNAPSHOT 2022-03-02 22:22:16 +01:00
Florian Schmaus cccf3ce5f3 Smack 4.4.5 2022-03-02 19:30:01 +01:00
Florian Schmaus 229a6edb1b Switch to CHANGELOG.md
Bye Bye changelog.html. You have served us good old friend. But JIRA
does no longer create compatible HTML changelogs. And markdown seems
to be the better alternative anyway.
2022-03-02 18:48:31 +01:00
cmeng-git 4d026d8ae8 [jingle] Add element and text to JingleReason's XML 2022-02-18 21:29:32 +01:00
Florian Schmaus 3885153ea1
Merge pull request #518 from Flowdalic/ssl-context-config
SSLContext config
2022-02-18 21:28:31 +01:00
Florian Schmaus ba2e36dbc3 [core] Deprecate some SSLContext config options and add KeyManager option
Smack historically provided fine-grained options for the
SSLContext. This is however not flexible enough, as an option to
specifiy the KeyManager(s) was missing.

This deprecated the options for keystore path, keystore type, and
PKCS#11 library, in favor of an option to set the KeyManager, which
could be aware of the keystore path and type, and the PKCS#11
library. At some point, Smack may provide some high-level methods to
create a KeyManager from provided keystore path, keytsore type and
PKCS#11 library.
2022-02-17 12:17:54 +01:00
Florian Schmaus 4622d00d9e [tcp] Unravel SSLSocketFactory.createSocket() invocation 2022-02-17 11:58:02 +01:00
Florian Schmaus 4e715a35e5
Merge pull request #512 from bgrozev/fix-smack-reactor-select
fix: Correctly handle the case when the action due time is 0.
2022-02-06 17:47:50 +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 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 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 7fad14ac0c [jingle] Improve Jingle <reason/> support
Fixes SMACK-922.
2022-02-02 12:10:53 +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 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