Commit Graph

866 Commits

Author SHA1 Message Date
Florian Schmaus c9a9982cef Migrate markdown documentation to javadoc
While markdown is easier to write, Smack's markdown documentation was
never tightly coupled with the source. For example, the markdown
documentation never provided links to the actual Java classes and
methods. This poses the risk that the documentation and the code
diverge over time. Furthermore, javadoc is constantly improving (for
example @snippet annotations) and I expect that one will be able to
write javadoc in markdown.

Fixes SMACK-928.
2023-02-03 09:50:35 +01:00
Florian Schmaus 875fb7fcfd Merge branch '4.4' 2022-09-02 16:17:12 +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 5455cfb3d2 Merge branch '4.4' 2022-08-30 21:54:49 +02: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 9eee3b8d76 [muc] Fix GroupChatInviation's constructor
Fixes: 5e1cd62021 ("[muc] Null-check GroupChatInviation's 'roomAddress' argument")
2022-08-07 17:03:05 +02:00
Florian Schmaus 5e1cd62021 [muc] Null-check GroupChatInviation's 'roomAddress' argument 2022-08-03 17:39:30 +02:00
Florian Schmaus 711d7d92bd [muc] Use EntityBareJid instead of String in GroupChatInvitation
Also factor provider in extra file.
2022-08-01 21:54:37 +02:00
Florian Schmaus 70d0843dd8 Merge branch '4.4' 2022-05-26 18:13:29 +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 c84ac4b2ae Merge branch '4.4' 2022-05-23 12:32:29 +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
Ingo Bauersachs 4efa707028 Replace legacy IQProvider with IqProvider 2022-04-02 16:02:46 +02:00
Florian Schmaus 78ffcae880 Merge branch '4.4' 2022-03-06 21:46:10 +01:00
Florian Schmaus 95ff591c14 [xdata] Only emit warning about unregistered fields once per field 2022-03-06 21:44:33 +01:00
Florian Schmaus a15110694a Merge branch '4.4' 2022-02-18 21:30:42 +01:00
cmeng-git 4d026d8ae8 [jingle] Add element and text to JingleReason's XML 2022-02-18 21:29:32 +01:00
Florian Schmaus ad9867ebdf Merge branch '4.4' 2022-02-03 08:43:32 +01:00
Florian Schmaus 7fad14ac0c [jingle] Improve Jingle <reason/> support
Fixes SMACK-922.
2022-02-02 12:10:53 +01:00
Florian Schmaus 5f75d141ff Merge branch '4.4' 2021-12-27 21:25:24 +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 e530db2e6d [muc] Add MultiUserChat.getMyRoomJid() 2021-12-20 22:40:37 +01:00
Dan Caseley e51cf47b29 [sinttest] Additional tests for § 6 of XEP-0045
Modified-by: Florian Schmaus <flo@geekplace.eu>
2021-12-20 21:11:31 +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 89ef46525e Merge branch '4.4' 2021-12-13 21:51:42 +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
Guus der Kinderen fdffd58d25 Add method to remove registered CAPS listener
ServiceDiscoveryManager allows a listener for CAPS changes to be
registered. It should also allow to remove a previously registered
listener.
2021-11-04 12:29:27 +01:00
Florian Schmaus f2c2f45f18 [jiveproperties] Use DoOnce utility to log "JavaObject not enabled" 2021-11-01 19:28:15 +01:00
Simon Abykov 19270a2eca Accept an empty string as the label value 2021-10-20 10:12:29 +01:00
Florian Schmaus bd528d2c32
Merge pull request #493 from abyss638/accept_empty_form_label
Accept empty string as form field label value
2021-10-19 20:46:55 +02:00
Simon Abykov 1956048811 Accept an empty string as the label value 2021-10-19 17:34:13 +01: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 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 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
Дамян Минков 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 ae4ff244a3 [muc] Check mucServicedDiscoInfo for null in serviceSupportsStableIds()
Fixes SMACK-913.
2021-09-27 13:56:15 +02:00
Florian Schmaus 49ad8c0954 [disco] Add DisocverInfo.nullSafeContainsFuture(DiscoverInfo, CharSequence) 2021-09-27 13:55:52 +02:00
Florian Schmaus b57cf8375f [socks5] Remove stale null check
The method getLocalStreamHost() does no longer return 'null', hence
the null check is unnecessary.
2021-09-13 18:25:44 +02:00