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

4685 commits

Author SHA1 Message Date
Florian Schmaus
b857f33ac3 Merge branch '4.4' 2020-09-20 14:12:37 +02:00
Florian Schmaus
02341f6330 Smack 4.4.0-beta3-SNAPSHOT 2020-09-20 14:10:53 +02:00
Florian Schmaus
6837c305e8 Smack 4.4.0-beta2 2020-09-20 13:57:09 +02:00
Florian Schmaus
4db7d787f7 [tcp] Add code comment why we have to copy the ByteBuffer 2020-09-20 13:53:13 +02:00
Florian Schmaus
08fc0ba0b4 [tcp] Improve pendingWriteInterestAfterRead code comment 2020-09-20 13:06:02 +02:00
Florian Schmaus
525ee09ea1 [tcp] Do not send SM ack after we send a </stream:stream>
Do net put an ack to the queue if it has already been shutdown. Some
servers, like ejabberd, like to request an ack even after we have send
a stream close (and hance the queue was shutdown). If we would not
check here, then the ack would dangle around in the queue, and be send
on the next re-connection attempt even before the stream open.

See the following trace of the MUC bookmarks integration test. The
fact that it is a MUC test does not matter, but this test does
disconnect the connection and reconnect it. Not how the server,
ejabberd in this case, requests an SM ack by sending an <r/> even
though we already send the </stream:stream>:

22:22:05 SENT (4):
<iq id='MD4UC-61' type='set'>
  <query xmlns='jabber:iq:private'>
    <storage xmlns='storage:bookmarks'>
      <conference name='Smack Inttest: 7in7j' autojoin='true' jid='y9jcn5@conference.salem.geekplace.eu'>
        <nick>
          Nick-P2VXD7
        </nick>
      </conference>
    </storage>
  </query>
</iq>
22:22:05 RECV (4):
<r xmlns='urn:xmpp:sm:3'/>
22:22:05 SENT (4):
<a xmlns='urn:xmpp:sm:3' h='29'/>
22:22:05 RECV (4):
<message to='sinttest-7in7j-4@salem.geekplace.eu' from='sinttest-7in7j-4@salem.geekplace.eu' type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='storage:bookmarks'>
      <item id='current'>
        <storage xmlns='storage:bookmarks'>
          <conference name='Smack Inttest: 7in7j' autojoin='true' jid='y9jcn5@conference.salem.geekplace.eu'>
            <nick>
              Nick-P2VXD7
            </nick>
          </conference>
        </storage>
      </item>
    </items>
  </event>
  <addresses xmlns='http://jabber.org/protocol/address'>
    <address jid='sinttest-7in7j-4@salem.geekplace.eu/1415073683806426185213090' type='replyto'/>
  </addresses>
</message>
22:22:05 RECV (4):
<iq xml:lang='en-US' to='sinttest-7in7j-4@salem.geekplace.eu/1415073683806426185213090' from='sinttest-7in7j-4@salem.geekplace.eu' type='result' id='MD4UC-61'/>
22:22:05 SENT (4):
<presence id='6MS6J-20' type='unavailable'/>
<a xmlns='urn:xmpp:sm:3' h='31'/>
<!-- We have closed the stream -->
</stream:stream>
<!-- But the server still requests an SM ack -->
22:22:05 RECV (4):
<r xmlns='urn:xmpp:sm:3'/>
22:22:05 RECV (4):
</stream:stream>
22:22:05 XMPPConnection closed (XMPPTCPConnection[sinttest-7in7j-4@salem.geekplace.eu/1415073683806426185213090] (4))
22:22:05 SENT (4):
<a xmlns='urn:xmpp:sm:3' h='31'/>
22:22:05 SENT (4):
<stream:stream xmlns='jabber:client' to='salem.geekplace.eu' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='sinttest-7in7j-4@salem.geekplace.eu' xml:lang='en-US'>
22:22:05 RECV (4): ?xml version='1.0'?>
<stream:stream id='3379123514446782311' ver
22:22:05 RECV (4): sion='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'>
<stream:error>
  <invalid-xml xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</stream:stream>
22:22:05 XMPPConnection closed due to an exception (XMPPTCPConnection[sinttest-7in7j-4@salem.geekplace.eu/1415073683806426185213090] (4))
org.jivesoftware.smack.XMPPException$StreamErrorException: invalid-xml You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions
<stream:error><invalid-xml xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:981)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:913)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:936)
	at java.base/java.lang.Thread.run(Thread.java:834)
2020-09-18 14:36:26 +02:00
Florian Schmaus
488d01796a [tcp] Fix TlsState by aborting the channel selected callback
Instead of breaking in case the SSLEngine signals NEED_WRAP, which
leads to an endless loop while holding the
channelSelectedCallbackLock, we have to return, so that the
asynchronously invoked callback can aquire it, and do its work.
2020-09-17 22:15:30 +02:00
Florian Schmaus
b7824f008d Introduce and use XmlStringBuilder.text()
Smack currently does unnecessary escaping of XML text, where it
escapes e.g. '"' to '&quot;'. This bloats the stanza size, especially
if JSON payloads are involved.

Fixes SMACK-892 (although there are probably still places where
XmlStringBuilder.escape() is used when XmlStringBuild.text() could
have been used).
2020-09-17 14:20:11 +02:00
Florian Schmaus
9e4153435a
Merge pull request #434 from Fishbowler/building_on_a_mac
Mac & Windows build instructions
2020-09-14 21:46:59 +02:00
Dan Caseley
8c33f56047 Mac & Windows build instructions 2020-09-14 17:04:21 +01:00
Florian Schmaus
0a6c21982b
Merge pull request #430 from Flowdalic/websocket
Introduce smack-websocket-okhttp
2020-09-02 11:13:06 +02:00
Florian Schmaus
9002be8e7a s/Websocket/WebSocket/
Java SE as well as OkHttp use 'WebSocket' (not 'Websocket'). Let us do
the same.

SMACK-835.
2020-09-01 21:47:36 +02:00
Florian Schmaus
6533cb7ed1 Introduce smack-websocket-okhttp
This uses Java's Service Provider Interface (SPI) to abstract
different WebSocket implementations.

SMACK-835
2020-09-01 21:36:13 +02:00
Florian Schmaus
9e9d30074c
Merge pull request #428 from vanitasvitae/pgpainlessalpha12
Bump pgpainless version to 0.1.0
2020-08-31 09:47:15 +02:00
4cc0f1d129
Bump pgpainless version to 0.1.0 2020-08-30 23:08:26 +02:00
Florian Schmaus
525f27abf1 Merge branch '4.4' 2020-08-29 16:39:15 +02:00
Florian Schmaus
64d3e804a7
Merge pull request #427 from Flowdalic/elements
Add XmppElementUtil.castOrThrow()
2020-08-29 16:38:54 +02:00
Florian Schmaus
e78ef2b668
Merge pull request #399 from adiaholic/websocket
Websocket support through RFC 7395
2020-08-29 16:34:32 +02:00
Florian Schmaus
1ebe8b0309
Merge pull request #422 from Flowdalic/drop-sm-state-on-clean-shutdown
[tcp] Drop Stream Management state on clean shutdown
2020-08-29 16:33:50 +02:00
Florian Schmaus
b09cd06053 [core] Use XmppElementUtil.castOrThrow() in StanzaView.getExtension(Class)
This means that users get now exceptions with helpful error messages
instead of the dreaded ClassCastException, like

java.lang.ClassCastException: org.jivesoftware.smack.packet.StandardExtensionElement cannot be cast to org.jivesoftware.smackx.mam.element.MamElements$MamResultExtension
at

when StanzaView.getExtension(Class) is used to retrieve the extension.
2020-08-29 16:29:22 +02:00
Florian Schmaus
d06e9499e8 [core] Add XmppElementUtil.castOrThrow(ExtensionElement, Class)
This method throws an IllegalStateException if the provided extension
element is not of the expected type and hints users towards potential
causes.
2020-08-29 16:29:22 +02:00
adiaholic
7ed29b9d5f Introduce websocket module into smack 2020-08-28 23:40:40 +05:30
Florian Schmaus
99297e5a76 [mam] Improve MamResultExtension: use MessageView in from() and add QNAME 2020-08-28 09:47:54 +02:00
Florian Schmaus
1aab0b8aac [core] Add cache to XmppElementUtil.getQNameFor(Class) 2020-08-28 09:47:09 +02:00
Florian Schmaus
cf4c9725b7 [core] Add ProviderManager.getExtensionProvider(QName) 2020-08-28 09:37:29 +02:00
Florian Schmaus
5d32735ad7
Merge pull request #426 from Flowdalic/getstreamopen
Get stream-open-like element from transport
2020-08-26 12:52:01 +02:00
Florian Schmaus
f892ba1369 [core] Get stream-open-like element from transport
When sending a stream-open-like element, it depends on the actual used
transport which element is send. For example, RFC6120-style TCP uses
<stream>, whereas the Websocket binding for XMPP uses <open/>.
2020-08-26 11:38:24 +02:00
Florian Schmaus
e6a60213b6 [core] Add convenience constructor to AbstractStreamOpen
Most of the times when we construct a stream-open-like element, we
want the jabber:client namespace. Hence add a constructor that does
select the namespace implicitly.
2020-08-26 11:36:55 +02:00
Florian Schmaus
2a9671ca93 [core] Change type of XmlStringBuilder cosntructor to FullyQualifiedElement
There is no reason we should do this only for ExtensionElements, this
behavior is sane for every FulllyQualifiedElement.
2020-08-26 11:35:22 +02:00
Florian Schmaus
d00656493a [jingle] Use correct XmlStringBuilder constructor in JingleReason 2020-08-26 11:34:57 +02:00
Florian Schmaus
7f10a82fd9
Merge pull request #425 from adiaholic/docFix
XMPPTCPConnection: Add missing `to` in comment
2020-08-25 14:52:54 +02:00
Aditya Borikar
0bb0884512 XMPPTCPConnection: Add missing to in comment 2020-08-23 13:25:18 +05:30
Florian Schmaus
53d66261af
Merge pull request #423 from adiaholic/streamFactory
Use AbstractStreamOpen instead of StreamOpen to open stream
2020-08-19 13:40:21 +02:00
Florian Schmaus
61799c5951
Merge pull request #424 from adiaholic/plugModule
Make ModularXmppClientToServerConnectionConfiguration.addModule() public
2020-08-19 13:39:39 +02:00
Aditya Borikar
648a1cfab1 Use AbstractStreamOpen instead of StreamOpen to open stream
Before the existence of AbstractStreamOpen, StreamOpen sufficed our need
during sending an open stream element. Since the intention behind
introducing AbstractStreamOpen is to allow underlying transports provide
transport specific opening streams, these changes will further support
the cause.

This commit will allow us to send transport specific open element
which should be inherited from AbstractStreamOpen.
2020-08-19 11:48:00 +05:30
Aditya Borikar
db385e6595 Make ModularXmppClientToServerConnectionConfiguration.addModule() public
This commit will allow users to plug their module descriptors inside
modular architecture.
2020-08-19 11:32:50 +05:30
Florian Schmaus
9cec02b5e3
Merge pull request #420 from adiaholic/streamFactory
Introduce StreamOpenFactory for modular architecture
2020-08-18 16:22:27 +02:00
Aditya Borikar
0e49adff1d Introduce StreamOpenAndCloseFactory for modular architecture 2020-08-18 19:04:34 +05:30
Aditya Borikar
9fcc97836b Introduce AbstractStreamOpen and AbstractStreamClose
- Inherit StreamOpen and StreamClose from AbstractStream classes
2020-08-18 10:35:22 +05:30
Florian Schmaus
49ebe8c587 [tcp] Drop Stream Management state on clean shutdown
We previously only set the SM session ID to zero, but that is not
enough. On a clean shutdown, i.e. where we send a </stream> close tag,
we also have to nullify the unacknowledgedStanzas queue.
2020-08-17 22:11:50 +02:00
Florian Schmaus
9fe1fc6689 Merge branch '4.4' 2020-08-17 17:25:26 +02:00
Florian Schmaus
3f3590b42b
Merge pull request #421 from Flowdalic/smack-streammanagement
Add smack-streammanagement project
2020-08-17 15:55:37 +02:00
Florian Schmaus
317e391da5 Create smack-streammanagement project and move o.j.smack.sm code there 2020-08-15 14:03:57 +02:00
Florian Schmaus
45e865757a [gradle] Use 'projectDirFile' File instance in getGitCommit()
The previous construct

def projectDir = dotGit.getParentFile()

was a little bit strange (and its declaration shadows the projectDir
String property).
2020-08-15 10:08:43 +02:00
Florian Schmaus
f00804ef72
Merge pull request #419 from adiaholic/bugFix
XmlEnvironment: Use correct method to obatain effective namespace.
2020-08-11 14:19:03 +02:00
Aditya Borikar
c9cf4f1541 XmlEnvironment: Use correct method to obatain effective namespace. 2020-08-08 20:14:39 +05:30
Florian Schmaus
11e38f9ba5 Smack 4.5.0-alpha1-SNAPSHOT 2020-08-07 22:07:00 +02:00
Florian Schmaus
89c5895ab3 Smack 4.4.0-beta2-SNAPSHOT 2020-08-07 22:06:32 +02:00
Florian Schmaus
b61426c8d0 Smack 4.4.0-beta1 2020-08-07 21:25:20 +02:00
Florian Schmaus
cf92566e26
Merge pull request #416 from Flowdalic/connected-boolean
Set 'connected' to 'true' as early as possible
2020-08-07 12:43:53 +02:00