Commit Graph

4990 Commits

Author SHA1 Message Date
Florian Schmaus ccfbf9f346 [caps] Use a synchronous listener for incoming presence stanzas
Fixes SMACK-937.
2023-11-24 12:15:32 +01:00
Guus der Kinderen 8c1fa1cc91 [websocket] Reduce fragility
Replace string-based comparison with a XML parsing when checking for 'open' and 'close' elements.
2023-11-13 16:03:41 +01:00
Guus der Kinderen 6244a213c8 [websocket] Improve handling of expanded 'open' element
Prior to this fix, Smack requires the 'open' element send on a websocket connection to be collapsed. With the change in
this commit, an expanded (eg: `<open ...></open>`) element can also be used.

fixes SMACK-935
2023-10-27 13:33:04 +02:00
Florian Schmaus c7f3e231d0
Merge pull request #568 from guusdk/intellij-icon
Add icon to IntelliJ metadata
2023-10-26 19:08:35 +00:00
Guus der Kinderen e2d136d992 Add icon to IntelliJ metadata 2023-10-05 10:31:41 +02:00
Guus der Kinderen 92d4cf5c77 [sinttest] Trim externally-provided configuration
Smack integration test configuration is provided externally. Guard against accidental whitespace inclusion by trimming values.
2023-09-29 20:37:03 +02:00
Paul Schaub 38844ee340
Bump libsignal-protocol-java to 2.8.1 2023-06-24 11:28:53 +02:00
Paul Schaub 430795bb9e
Bump PGPainless to 1.5.3 2023-06-24 11:10:24 +02:00
Paul Schaub 9bfaf674b1
Bump BC to 1.73 2023-06-24 11:10:10 +02:00
Florian Schmaus 19b20fefec
Merge pull request #537 from MF1-MS/mf1-ms/use_xmpp_connection_as_local_socks5_address
Use XMPP connection as local socks5 address
2023-04-26 11:35:04 +00:00
Martin Fidczuk ffd027cc7d
Use XMPP connection as local SOCKS5 address
The default local address is often just "the first address found in the list of addresses read from the OS" and this might mean an internal IP address that cannot reach external servers. So wherever possible use the same IP address being used to connect to the XMPP server because this local address has a better chance of being suitable.

This MR adds the above behaviour, and two UTs to test that we use the local XMPP connection IP when connected, and the previous behaviour when not.
2023-04-26 10:00:23 +01:00
Florian Schmaus 50eb94850d
Merge pull request #535 from MF1-MS/mf1-ms/xep_0249_support
Add partial support for XEP-0249 Direct MUC Invitations
2023-04-24 10:10:08 +00:00
Martin Fidczuk 9e9c233468
Add partial support for XEP-0249 Direct MUC Invitations.
Exposes a method for a MUC to invite a user to the room, and adds a listener to the MultiUserChat listener to inform users of direct invitations they have received.

Fixes SMACK-932.
2023-04-24 10:47:06 +01:00
Florian Schmaus f6c85d9fb3
Merge pull request #561 from Flowdalic/github-ci
[github ci] Java 15 → 17
2023-03-18 09:03:35 +00:00
Florian Schmaus e3425706d9 [github ci] Remove Java 15, as its no longer provided
It appears github's ubuntu-22.04 image does not provide java
15. However, since Smack uses Gradle 6.8, we can not use any higher
version than Java 15.
2023-03-18 09:54:20 +01:00
Florian Schmaus 24782558d6 [sinttest] Properly handle AbstractSmackSpecificLowLevelIntegrationTest
Subclasses of AbstractSmackSpecificLowLevelIntegrationTest have test
methods with no parameters. This was, after the refactoring in
c5bb15c631 ("[sinttest] Add UnconnectedConnectionSource for
low-level tests") not handled properly.

Fixes: c5bb15c631 ("[sinttest] Add UnconnectedConnectionSource for low-level tests")
2023-03-17 20:28:14 +01:00
Florian Schmaus 6d2216858c [sinttest] Cleanup method signature in ModularXmppClientToServerConnectionLowLevelIntegrationTest 2023-03-17 20:25:34 +01:00
Florian Schmaus f78eade4da Merge branch '4.4' 2023-03-17 18:20:20 +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 6a90300ef6
Merge pull request #550 from Flowdalic/break-loop-in-webscoket-disconnect
[websocket-java11] Prevent infinite recursion in disconnect()
2023-02-11 15:18:29 +00:00
Florian Schmaus 507345ed7a
Merge pull request #549 from Flowdalic/sinttest-uncon-con-source
[sinttest] Add UnconnectedConnectionSource for low-level tests
2023-02-11 15:18:24 +00:00
Florian Schmaus 324e54b81b [websocket-java11] Prevent infinite recursion in disconnect()
Guus reports the following infinite recursing causing a
StackOverflowError:

Exception in thread "main" java.lang.StackOverflowError
	at org.jivesoftware.smack.websocket.java11.Java11WebSocket.disconnect(Java11WebSocket.java:142)
	at org.jivesoftware.smack.websocket.XmppWebSocketTransportModule$XmppWebSocketTransport.disconnect(XmppWebSocketTransportModule.java:265)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection$CloseConnectionState.transitionInto(ModularXmppClientToServerConnection.java:1086)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.attemptEnterState(ModularXmppClientToServerConnection.java:472)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.walkStateGraphInternal(ModularXmppClientToServerConnection.java:399)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.walkStateGraph(ModularXmppClientToServerConnection.java:339)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.shutdown(ModularXmppClientToServerConnection.java:551)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.instantShutdown(ModularXmppClientToServerConnection.java:530)
	at org.jivesoftware.smack.AbstractXMPPConnection.notifyConnectionError(AbstractXMPPConnection.java:1024)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.access$100(ModularXmppClientToServerConnection.java:134)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection$1.notifyConnectionError(ModularXmppClientToServerConnection.java:185)
	at org.jivesoftware.smack.websocket.impl.AbstractWebSocket.onWebSocketFailure(AbstractWebSocket.java:128)
	at org.jivesoftware.smack.websocket.java11.Java11WebSocket.onWebSocketFailure(Java11WebSocket.java:162)
	at org.jivesoftware.smack.websocket.java11.Java11WebSocket.disconnect(Java11WebSocket.java:146)
	at org.jivesoftware.smack.websocket.XmppWebSocketTransportModule$XmppWebSocketTransport.disconnect(XmppWebSocketTransportModule.java:265)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection$CloseConnectionState.transitionInto(ModularXmppClientToServerConnection.java:1086)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.attemptEnterState(ModularXmppClientToServerConnection.java:472)
...

This is because sendClose() in Java11WebSocket.disconnect() throws,
potentially because the output stream is already closed. We previously
would feed the exception into the onWebSocketFailure(Exception)
machinery, which would then again attempt a disconnect.

Since a failed sendClose() is nothing that needs special handling, we
simply log the exception as error. Furthermore, we only issue
sendClose() if the WebSocket's output is still open, i.e., if there is
a chance that it actually works.

Reported-by: Guus der Kinderen <guus@goodbytes.nl>
2023-02-11 16:13:07 +01:00
Florian Schmaus a2a22883d2 [websocket] Override AbstractWebSocket.toString() 2023-02-11 16:12:26 +01:00
Florian Schmaus c5bb15c631 [sinttest] Add UnconnectedConnectionSource for low-level tests
Previously low-level tests where run, potentially multiple times, with
the default connection descriptor.

Reported-by: Guus der Kinderen <guus@goodbytes.nl>
2023-02-11 13:02:23 +01:00
Florian Schmaus 92f1fe647b [websocket] Factor out known websocket ports in private static fields 2023-02-03 20:57:27 +01:00
Florian Schmaus ae2c53f78c
Merge pull request #543 from guusdk/websocket-default-port
Websocket implicit discovery should use common ports
2023-02-03 20:54:32 +01:00
Guus der Kinderen 3a84a1ff47 s/ the the / the /g 2023-02-03 20:53:14 +01:00
Florian Schmaus 07f157b00f
Merge pull request #547 from Flowdalic/docs-to-javadoc
Migrate markdown documentation to javadoc
2023-02-03 20:43:35 +01:00
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
Guus der Kinderen 3f13d90a56 Websocket implicit discovery should use common ports
When enabled, the websocket implementation will attempt to use two implicit endpoints, using these URLs:
- `wss://[host]:5443/ws`
- `ws://[host]:5443/ws`

These endpoints should include ports that are used by default by known implementations, such as 5280/5281 (Prosody) and 7070/7443 (Openfire).
2023-01-19 13:09:20 +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 f65cf45b5c [README] Fix MUC badge 2022-09-02 16:48:57 +02: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 c232ca5cb0 Update README 2022-08-30 22:05:51 +02:00
Florian Schmaus 5455cfb3d2 Merge branch '4.4' 2022-08-30 21:54: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 9eee3b8d76 [muc] Fix GroupChatInviation's constructor
Fixes: 5e1cd62021 ("[muc] Null-check GroupChatInviation's 'roomAddress' argument")
2022-08-07 17:03:05 +02:00