1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-16 01:02:06 +01:00
Commit graph

943 commits

Author SHA1 Message Date
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
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
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
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
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
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
Дамян Минков
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
Florian Schmaus
09710b3203 [socks5] Fix javadoc of getLocalStreamHost()
The method does no longer return null.

Reported-by: Simon Abykov <simon.abykov@gmail.com>
2021-09-13 18:24:54 +02:00
Florian Schmaus
8ae5ef1f51 [socks5] Ensure that the local SOCKS5 proxy is running (if enabled)
In 9352225f44 ("Rework SOCKS5 unit tests so that they can be run in
parallel") the call to getSocks5Proxy() in
Socks5BytestreamManager.getLocalStreamHost() was removed. Since
getSocks5Proxy() does also start the local proxy, if it is not already
running, this caused Smack to no longer automatically start the local
proxy.

This commit re-adds the call to getSocks5Proxy() and fixes SMACK-912.
2021-09-13 09:58:15 +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
0d73c21945 [pubsub] FormNode(Provider) should not fail if there is no DataForm
Error IQ respones may not contain a data form, e.g.

<iq type="error" id="6LXNC-48" from="pubsub.openfire.xmpp.test" to="anno@openfire.xmpp.test/5dsi4g084a">
  <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
    <configure node="fdp/submitted/spot_report"/>
  </pubsub>
  <error code="403" type="auth">
    <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
  </error>
</iq>

Also FormNode's toXML() already handled the case where submitForm was
'null'. Only the constructor threw a IAE if submitForm was 'null'.

Fixes SMACK-910.

Closes: https://github.com/igniterealtime/Smack/pull/471
2021-08-23 17:39:59 +02:00
Florian Schmaus
b9be45ae2c [xdata] Fix ProtectedMembersInFinalClass Error Prone warning 2021-08-03 22:07:04 +02:00