1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-18 20:25:59 +02:00
Commit graph

4693 commits

Author SHA1 Message Date
Florian Schmaus
8b9a9e0f3e [xdata] Fix NPE in FillableForm
Calling write() in FillableForm's constructor causes a NPE because
write() makes use of requiredFields which has not been set at this
time. Furthermore, write() makes use of missingRequiredFields, which
is also populated in that loop. Therefore, we have to delay the
invocation of write() until requiredFields got set.

Thanks to Dan Caseley for reporting this.

Reported-by: Dan Caseley <dan@caseley.me.uk>
2024-01-11 09:12:14 +01:00
cmeng-git
bd70d6abc5 [bosh] Fix BOSH debug send message not shown
Following logcat are captured with various PR fixes implemented:

// ===== Without any of the PR fixes ===== //
All the sent stanza are missing; fixed by
```
// Fix all BOSH sent debug messages not shown
  writer.flush();
```
```
2023-12-11 12:25:33.548 5470-5636/org.atalk.android D/SMACK: RECV (0):
    <body xmpp:version='1.0' authid='4867162268865181478' xmlns='http://jabber.org/protocol/httpbind' sid='53e66759d21e128cc1cba8d00aacb7421f1ea960' wait='60' ver='1.11' polling='2' inactivity='30' hold='1' xmpp:restartlogic='true' requests='2' secure='true' maxpause='120' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' from='atalk.sytes.net'>
      <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>
            PLAIN
          </mechanism>
          <mechanism>
            SCRAM-SHA-1
          </mechanism>
          <mechanism>
            X-OAUTH2
          </mechanism>
        </mechanisms>
        <register xmlns='http://jabber.org/features/iq-register'/>
      </stream:features>
    </body>
2023-12-11 12:25:33.748 5470-5636/org.atalk.android D/SMACK: RECV (0):
    <body xmlns='http://jabber.org/protocol/httpbind'/>
2023-12-11 12:25:33.925 5470-5636/org.atalk.android D/SMACK: RECV (0):
    <body xmlns='http://jabber.org/protocol/httpbind'>
      <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        cj1DI2QjJHE7JVs6LzElInQnPDhaK3JLMTUzPCtPVicvXmNuV204ei9kV1UzT1lsdCtzRW1ZTkE9PSxzPTdjNktCSnNaTHdTYjNZSytqdVRXb2c9PSxpPTQwOTY=
      </challenge>
    </body>
2023-12-11 12:25:33.939 5470-5636/org.atalk.android D/SMACK: RECV (0):
    <body xmlns='http://jabber.org/protocol/httpbind'>
      <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        dj1saEFrUzVKMFRBMEJVbTg1djd5dE4xTUpZaE09
      </success>
    </body>
```

// ===== With only PR fixes: writer.flush(); readerConsumer = null; but withoug the following fixes ===== //
// Initialize the debugger before addBOSHClientResponseListener(new BOSHPacketReader());
// BOSHPacketReader may hold and send response prior to display of the request i.e. \<response/> before \<challenge/>

```
2023-12-11 12:33:54.915 6162-6310/org.atalk.android D/SMACK: SENT (0):
    <body ver='1.8' wait='60' xmpp:version='1.0' rid='6195788493952909' xmlns:xmpp='urn:xmpp:xbosh' hold='1' xml:lang='en' ack='1' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'>
    </body>
2023-12-11 12:33:55.198 6162-6314/org.atalk.android D/SMACK: RECV (0):
    <body xmpp:version='1.0' authid='1477509259581416251' xmlns='http://jabber.org/protocol/httpbind' sid='796ae552c9fea53ff10a1979429396d19745d430' wait='60' ver='1.11' polling='2' inactivity='30' hold='1' xmpp:restartlogic='true' requests='2' secure='true' maxpause='120' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' from='atalk.sytes.net'>
      <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>
            PLAIN
          </mechanism>
          <mechanism>
            SCRAM-SHA-1
          </mechanism>
          <mechanism>
            X-OAUTH2
          </mechanism>
        </mechanisms>
        <register xmlns='http://jabber.org/features/iq-register'/>
      </stream:features>
    </body>
2023-12-11 12:33:55.301 6162-6310/org.atalk.android D/SMACK: SENT (0):
    <body rid='6195788493952910' sid='796ae552c9fea53ff10a1979429396d19745d430' xmlns='http://jabber.org/protocol/httpbind'>
      <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'>
        bixhPXN3YW5AYXRhbGsuc3l0ZXMubmV0LG49c3dhbixyPUJwMTZzKG9dd0xmb1lnN0haRkAjKko7PiReIXhbKiou
      </auth>
    </body>
2023-12-11 12:33:55.534 6162-6313/org.atalk.android D/SMACK: SENT (0):
    <body rid='6195788493952911' ack='6195788493952909' sid='796ae552c9fea53ff10a1979429396d19745d430' xmlns='http://jabber.org/protocol/httpbind'>
      <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        Yz1iaXhoUFhOM1lXNUFZWFJoYkdzdWMzbDBaWE11Ym1WMExBPT0scj1CcDE2cyhvXXdMZm9ZZzdIWkZAIypKOz4kXiF4WyoqLlV4eTcvUVBCQUNKbjg1TWdRZHhjQnc9PSxwPVZlT3pkVzExN0tMc3k4THZpQWJZWDlpcW84az0=
      </response>
    </body>
2023-12-11 12:33:55.538 6162-6314/org.atalk.android D/SMACK: RECV (0):
    <body xmlns='http://jabber.org/protocol/httpbind'>
      <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        cj1CcDE2cyhvXXdMZm9ZZzdIWkZAIypKOz4kXiF4WyoqLlV4eTcvUVBCQUNKbjg1TWdRZHhjQnc9PSxzPTdjNktCSnNaTHdTYjNZSytqdVRXb2c9PSxpPTQwOTY=
      </challenge>
    </body>
2023-12-11 12:33:55.558 6162-6310/org.atalk.android D/SMACK: SENT (0):
    <body xmpp:restart='true' rid='6195788493952912' xmlns:xmpp='urn:xmpp:xbosh' sid='796ae552c9fea53ff10a1979429396d19745d430' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'>
    </body>
2023-12-11 12:33:55.560 6162-6314/org.atalk.android D/SMACK: RECV (0):
    <body xmlns='http://jabber.org/protocol/httpbind'>
      <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        dj1mcFdSekE1SXltdTBrNys4K1hML3JncTVEd2s9
      </success>
    </body>
```

// ===== With the full PR fixes ===== //
```
2023-12-11 12:21:16.435 4703-5344/org.atalk.android D/SMACK: SENT (4):
    <body ver='1.8' wait='60' xmpp:version='1.0' rid='949729322134413' xmlns:xmpp='urn:xmpp:xbosh' hold='1' xml:lang='en' ack='1' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'>
    </body>
2023-12-11 12:21:16.637 4703-5348/org.atalk.android D/SMACK: RECV (4):
    <body xmpp:version='1.0' authid='1761920914298566866' xmlns='http://jabber.org/protocol/httpbind' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' wait='60' ver='1.11' polling='2' inactivity='30' hold='1' xmpp:restartlogic='true' requests='2' secure='true' maxpause='120' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' from='atalk.sytes.net'>
      <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>
            PLAIN
          </mechanism>
          <mechanism>
            SCRAM-SHA-1
          </mechanism>
          <mechanism>
            X-OAUTH2
          </mechanism>
        </mechanisms>
        <register xmlns='http://jabber.org/features/iq-register'/>
      </stream:features>
    </body>
2023-12-11 12:21:16.667 4703-5344/org.atalk.android D/SMACK: SENT (4):
    <body rid='949729322134414' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' xmlns='http://jabber.org/protocol/httpbind'>
      <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'>
        bixhPXN3YW5AYXRhbGsuc3l0ZXMubmV0LG49c3dhbixyPTdiSVxeVnVMU0ZoWT8zVVlSa2psdkVMeks/e3BaQUwp
      </auth>
    </body>
2023-12-11 12:21:16.683 4703-5348/org.atalk.android D/SMACK: RECV (4):
    <body xmlns='http://jabber.org/protocol/httpbind'>
      <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        cj03YklcXlZ1TFNGaFk/M1VZUmtqbHZFTHpLP3twWkFMKUhqVjVlVFUvdzJFaW9yQjlGdHh3T3c9PSxzPTdjNktCSnNaTHdTYjNZSytqdVRXb2c9PSxpPTQwOTY=
      </challenge>
    </body>
2023-12-11 12:21:16.689 4703-5347/org.atalk.android D/SMACK: SENT (4):
    <body rid='949729322134415' ack='949729322134413' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' xmlns='http://jabber.org/protocol/httpbind'>
      <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        Yz1iaXhoUFhOM1lXNUFZWFJoYkdzdWMzbDBaWE11Ym1WMExBPT0scj03YklcXlZ1TFNGaFk/M1VZUmtqbHZFTHpLP3twWkFMKUhqVjVlVFUvdzJFaW9yQjlGdHh3T3c9PSxwPXdNb2c5N3UzQktON1FHaFVQRzQ3MHVjZXdldz0=
      </response>
    </body>
2023-12-11 12:21:16.702 4703-5348/org.atalk.android D/SMACK: RECV (4):
    <body xmlns='http://jabber.org/protocol/httpbind'>
      <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        dj0yTzRqVzJXWHdEUDdvNjdJSkdNU3Rmc0NMTkk9
      </success>
    </body>
2023-12-11 12:21:16.704 4703-5344/org.atalk.android D/SMACK: SENT (4):
    <body xmpp:restart='true' rid='949729322134416' xmlns:xmpp='urn:xmpp:xbosh' sid='25ba67c4b943796418a2b7c064085327ab9c35ac' to='atalk.sytes.net' xmlns='http://jabber.org/protocol/httpbind'>
    </body>
```

Link: https://github.com/igniterealtime/Smack/pull/554
2023-12-11 11:16:45 +01:00
Florian Schmaus
390f6f0fa7 [core] Fix busy-loop in SmackReactor
Fixes SMACK-938.
2023-12-07 11:22:38 +01:00
Florian Schmaus
0fb8bfdf6c [CHANGELOG] fix markdown listing 2023-11-26 17:52:32 +01:00
Florian Schmaus
84ec2c8c2f Smack 4.4.8-SNAPSHOT 2023-11-25 19:30:49 +01:00
Florian Schmaus
6d99ba7ffb Smack 4.4.7 2023-11-25 19:07:40 +01:00
Florian Schmaus
2e8f83c579
Merge pull request #572 from Flowdalic/sync-entity-caps
[caps] Use a synchronous listener for incoming presence stanzas
2023-11-25 13:26:12 +01:00
Florian Schmaus
5560fb4752 [chatmarkers] Deprecate ChatMarkers.isSupportedByServer()
Fixes SMACK-934.
2023-11-25 11:24:37 +01:00
Florian Schmaus
a270542397 [core] Improve javadoc for listeners
With 92f253cc74 ("[core] Replace
AbstractXMPPConnection.inOrderListeners") we changes the behavior of
listeners. This commit documents the expectations to the user.
2023-11-24 12:59:04 +01:00
Florian Schmaus
f593b6d0a0 [core] Whitespace fix in XMPPConnection's javadoc 2023-11-24 12:18:19 +01:00
Florian Schmaus
ccfbf9f346 [caps] Use a synchronous listener for incoming presence stanzas
Fixes SMACK-937.
2023-11-24 12:15:32 +01:00
Florian Schmaus
2e79a6b718
Merge pull request #558 from Flowdalic/iq-error-with-child-element
[core] Fix ErrorIQ displaying potential child elements
2023-03-17 18:18:28 +01:00
Florian Schmaus
bf3a27df9a [core] Fix ErrorIQ not showing potential original IQ child
Also delete StanzaIdTest since the test was fundamentally weak and
flawed. It does not work anyway, since TestIQ has a fixed stanza ID.

Fixes SMACK-931.
2023-03-17 18:03:57 +01:00
Florian Schmaus
9ec67611a0
Merge pull request #560 from Flowdalic/ubuntu-22.04
[github ci]: Bump to Ubuntu 22.04
2023-03-17 18:01:51 +01:00
Florian Schmaus
3ba1aba2e3 [github ci]: Disable Java 8 (potentially temprorary)
We currently run into
https://github.com/android-actions/setup-android/issues/378
2023-03-17 17:52:35 +01:00
cmeng-git
ef0fc01505 Rename ELEMENT 'candidate-activated' to 'activated' per XEP-0260
Fixes SMACK-930.
2023-03-17 17:48:15 +01:00
Florian Schmaus
d93fbacc35
Merge pull request #546 from bgrozev/fix-npe-when-missing-x
Add null check for mucUser.
2023-03-17 17:45:43 +01:00
Florian Schmaus
27c8016522
Merge pull request #551 from Flowdalic/internet-address-ignore-zone-id
Internet address ignore zone ID
2023-03-17 17:45:09 +01:00
Florian Schmaus
d565354dea [jingle] Ignore IP Zone ID is transport candidates
Fixes SMACK-929.
2023-03-17 17:40:15 +01:00
Florian Schmaus
f00e585f3d [github ci]: Bump to Ubuntu 22.04 2023-03-10 09:25:05 +01:00
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
dee34b5efc [core] Add InternetAddress.fromIgnoringZoneId(String) 2023-02-12 16:06:53 +01: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