1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-16 04:12:04 +01:00
Commit graph

4497 commits

Author SHA1 Message Date
Florian Schmaus
1d5949de4d
Merge pull request #451 from Flowdalic/github-actions
Add GitHub CI actions
2021-01-10 20:36:29 +01:00
Dan Caseley
5b73f2c061 Add Github Actions CI workflow, drop Travis CI
Modified-by: Florian Schmaus <flo@geekplace.eu>
2021-01-10 20:28:34 +01:00
Florian Schmaus
65d7c1c1b8 [im] Update DirectoryRosterStore TODO note regarding Android API 26. 2021-01-06 13:48:49 +01:00
Florian Schmaus
40aa9e87b7 [im] DirectoryRosterStore.readEntry() should also catch IllegalArgumentException
Fixes SMACK-897.
2021-01-06 13:48:03 +01:00
Florian Schmaus
d64ee785bd [extensions] Add BoBDataExtension getBobData() and getContentId()
Those two methods where missing after the BoB API redesign.

Fixes SMACK-896.
2021-01-06 13:47:09 +01:00
Florian Schmaus
fcc372754e Fix NPE in BoBIQ by adding XmlStringBuilder.optIntAttribute(String, Integer)
The method was missing and hence BoBIQ used optIntAttribute(String,
int) instead, which resulted in an NPE if the Integer was null.

Fixes SMACK-895.
2021-01-06 13:45:13 +01:00
Florian Schmaus
ca3679add9 Smack 4.4.1-SNAPSHOT 2020-12-06 12:15:19 +01:00
Florian Schmaus
d8864b62ca Smack 4.4.0 2020-12-06 11:28:41 +01:00
Florian Schmaus
a4bb5bfda8 [ibb] Use UInt16 for 'seq' and fix its handling
Fixes a off-by-one error when incrementing 'seq'. Thanks to Kim
Alvefur <zash@zash.se> for spotting this.
2020-12-05 23:04:17 +01:00
Florian Schmaus
02c9058c3d [core] Remove @SuppressWarnings for parseContentDepthWithRoundtrip()
Also use the most specific return type in the method's signature.
2020-11-25 20:55:05 +01:00
Florian Schmaus
ca497a2199 [core] Fix parseContentDepthWithRoundtrip() and add tests 2020-11-25 20:55:05 +01:00
Florian Schmaus
821bdf6d86 Smack 4.4.0-rc3-SNAPSHOT 2020-11-18 21:19:01 +01:00
Florian Schmaus
c1f3f8ce13 Smack 4.4.0-rc2 2020-11-18 20:04:55 +01:00
Florian Schmaus
f10cbb4a97 [core] Add requireNonNull() check to some connection endpoints 2020-11-14 12:47:35 +01:00
Florian Schmaus
c4228e072b [tcp] Add missing null check in resolveDomain()
The method lookupHostAddress() returns null in case of an error, hence
we need to test if the returned value is null prior adding the endpoint.

Should fix the following NPE:

java.lang.NullPointerException:
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration (XMPPTCPConnection.java:606)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal (XMPPTCPConnection.java:846)
  at org.jivesoftware.smack.AbstractXMPPConnection.connect (AbstractXMPPConnection.java:530)
  at org.jivesoftware.smack.ReconnectionManager$2.run (ReconnectionManager.java:282)
  at java.lang.Thread.run (Thread.java:784)

Reported-by: Eng ChongMeng <cmeng.gm@gmail.com>
2020-11-14 12:47:34 +01:00
Guus der Kinderen
59cf449799 Provide more detailed code comment. 2020-11-09 21:21:27 +01:00
Guus der Kinderen
0ff8040895 FileTransfer: replace Error.none with null
This fixes an inconsistent representation of a 'no error' representation, that
causes a file transfer in which not enough bytes were transferred to _not_ be
marked as having a problem.
2020-11-09 21:21:27 +01:00
Florian Schmaus
e117f431bc Smack 4.4.0-rc2-SNAPSHOT 2020-11-09 09:32:29 +01:00
Florian Schmaus
e6236b0c21 Smack 4.4.0-rc1 2020-11-09 08:54:18 +01:00
Florian Schmaus
afd18f95c9 Add Smack.getNoticeStream() and 'License' section to README 2020-11-09 08:46:57 +01:00
Florian Schmaus
1f5ada4822 Add org.jivesoftware.smack.Smack with getVersion() and ensureInitialized() 2020-11-09 08:46:57 +01:00
Florian Schmaus
df96c57093 [address] Get rid of PacketCopy workaround
PacketCopy subclassing Stanza was always a peculiarity. The only
subclasses of Stanza should be Message, Presence, and IQ.
2020-11-09 08:46:56 +01:00
Florian Schmaus
72acd8e095 [core] Add StanzaBuilder.build() 2020-11-09 08:46:56 +01:00
Florian Schmaus
7e311ab9df [muc] Prevent race condition on enter() by waiting
This prevents a race condition of enter() with the presence listern by
waiting until all presences have been processed.

Reported-by: Guus der Kinderen <guus@goodbytes.nl>
2020-11-09 08:46:56 +01:00
Florian Schmaus
f12fe2264a [muc] Only retrieve MUCUser once in Presence listener 2020-11-08 19:37:41 +01:00
Florian Schmaus
5dfed2935f Add NOTICE file 2020-11-05 12:54:54 +01:00
Florian Schmaus
e1624e1ab9 Add resources/get-contributors.sh 2020-11-05 12:52:22 +01:00
Florian Schmaus
74adcda23d Add .mailmap 2020-11-05 12:52:17 +01:00
Florian Schmaus
cfccc78ba0 [muc] Rename local variable 'presence' to 'reflectedSelfPresence'
To increase readability, and with that maintainability, we rename
'presence' to 'reflectedSelfPresence' in MultiUserChat.enter(), to
make it clear what kind of presence this variable holds.

Also mark the variable as final.
2020-11-03 22:31:22 +01:00
Guus der Kinderen
55d7b9d4eb Fix pubsub options rendering
The exiting code generates an unintentional nested 'options' child element:

```
<iq to='pubsub.example.org' id='FQTHU-126' type='get'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <options node='sinttest-multisubscribe-nodename-13pnc'>
      <options jid='smack-inttest-two-13pnc@example.org'
               node='sinttest-multisubscribe-nodename-13pnc'/>
    </options>
  </pubsub>
</iq>
```

This commit removes the undesired nesting, resulting in:

```
<iq to='pubsub.example.org' id='FQTHU-126' type='get'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <options jid='smack-inttest-two-13pnc@example.org'
             node='sinttest-multisubscribe-nodename-13pnc'/>
  </pubsub>
</iq>
```
2020-10-27 10:23:17 +01:00
1a9ac238e8 OpenPgpManager: Expose methods to generate and import keys 2020-10-27 10:22:46 +01:00
Florian Schmaus
28dd56a13a
Merge pull request #438 from Flowdalic/stax-disable-xxe-and-dtd
[xmlparser-stax] Disable external entities and DTD
2020-10-05 09:15:42 +02:00
Florian Schmaus
c1b412c457 [xmlparser-stax] Disable external entities and DTD
Before that, the StAX parser used by Smack for XML parsing had
only external entity replacement disabled. We further harden the
parser by disabling DTDs.

See also:
https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xmlinputfactory-a-stax-parser
2020-10-05 08:55:10 +02:00
Florian Schmaus
6d39a4e3ac [bob] Add BoBDataExtension, remove BoBExtension
BoBExtension extending XHTMLExtension was poorly designed and only
worked for a single paragraphy.

Fixes SMACK-770.
2020-09-23 19:57:13 +02:00
Florian Schmaus
15e3d267f6 Add Pair utility class 2020-09-23 19:46:01 +02:00
Florian Schmaus
048226960b Rename smack-java7 to smack-java8
Fixes SMACK-854.
2020-09-23 17:50:11 +02:00
Florian Schmaus
fe7d3bec30 Make Forwarded a generic type
Fixes SMACK-821.
2020-09-23 17:48:04 +02:00
Florian Schmaus
c1b32f8e11 [carbons] Throw SmackParsingException instead of IOException 2020-09-23 17:47:04 +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
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
64d3e804a7
Merge pull request #427 from Flowdalic/elements
Add XmppElementUtil.castOrThrow()
2020-08-29 16:38:54 +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