Commit Graph

139 Commits

Author SHA1 Message Date
Florian Schmaus 2edbc64957 Refactor reconnection callbacks into an extra class
Fixes SMACK-775
2017-11-25 16:30:18 +01:00
Florian Schmaus 65b4f506dc Add SubscribeAnswer.ApproveAndAlsoRequestIfRequired 2017-11-06 22:41:28 +01:00
Florian Schmaus 08e897113d Add CustomImportOrder checkstyle rule
And matching ImportOrder settings for Eclipse in
resources/eclipse/smack.importorder
2017-06-14 17:12:43 +02:00
Florian Schmaus ce1cddc722 More checkstyle whitespace related checks 2017-05-24 14:42:38 +02:00
Florian Schmaus dcf7406fa4 Add UnknownIqRequestReplyMode 2017-05-16 15:53:03 +02:00
Florian Schmaus 4c646436a5 Bump "Error Prone" to 2.0.15
and fix a few things :)
2017-02-11 16:16:41 +01:00
Florian Schmaus 872b254db5 sendStanzaWithResponseCallback: Ensure exactly one callback is called 2017-01-30 21:01:56 +01:00
Florian Schmaus b142060f9e sendStanzaWithResponseCallback(): remove listener right away
I'm not sure why i've put the removeAsyncStanzaListener() call into
the finally block. If callback.processStanza(Stanza) takes a long
time (or even blocks), then it would appear to the "no response"
handling Runnable as if there was no response, when in fact there was
one.
2017-01-30 17:09:30 +01:00
Florian Schmaus 7c46f58c80 Rename "PacketReplyTimeout" → "ReplyTimeout" 2017-01-12 20:57:19 +01:00
Florian Schmaus b0fef6ffcb Ensure that populateHostAddressees() doesn't return a list with 'null'
Thanks to Grigory Fedorov for reporting this.
2017-01-09 19:36:21 +01:00
Florian Schmaus bfc14227ca Propagate stream errors on connect/login to the caller
Before this, if there was a stream error response by the server to our
stream open, that error response would only be handled in the reader
thread, and the user would get a message like:

"org.jivesoftware.smack.SmackException$NoResponseException: No
response received within reply timeout. Timeout was
5000ms (~5s). While waiting for SASL mechanisms stream feature from
server"

while the server may actually sent something like

<stream:stream
  xmlns='jabber:client'
  xmlns:stream='http://etherx.jabber.org/streams'
  id='6785787028201586334'
  from='jabbim.com'
  version='1.0'
  xml:lang='en'>
  <stream:error>
    <policy-violation xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
	</policy-violation>
	<text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
	  Too many (2) failed authentications from this IP
      address (1xx.66.xx.xxx). The address will be unblocked at 04:24:00
      06.01.2017 UTC
    </text>
  </stream:error>
</stream:stream>

It was necessary to change saslFeatureReceived from SmackException to
XMPPException in order to return the StreamErrorException at this sync
point. But this change in return required the introduction of a
tlsHandled sync point for SmackException (which just acts as a wrapper
for the various exception types that could occurn when establishing
TLS). The tlsHandled sync point is marked successful even if no TLS
was established in case none was required and/or if not supported by
the server.
2017-01-07 10:38:41 +01:00
Florian Schmaus 90a5e289f8 s/processPacket/processStanza/ s/PacketCollector/StanzaCollector/ 2017-01-03 11:35:04 +01:00
Florian Schmaus 3129165a1c Add ConnectionConfiguration.setHostAddress(InetAddress)
In previous Smack versions, it was possible to set the host's IP
address via setHost(String), this is no longer possible (since the
support for DNSSEC was introduced). The new
setHostAddress(InetAddress) allows it again to explicitly specifiy the
XMPP service's host IP.
2016-12-28 23:18:28 +01:00
Florian Schmaus 9165e818d9 Add ParenPad and NoWhitespaceAfter checkstyle rules 2016-11-29 12:01:41 +01:00
Florian Schmaus 5a47f56cd0 Call shutdown() before throwing
Follow up on a9d5cd4a61 /
059ee99ba0 (SMACK-739).
2016-11-15 07:20:58 +01:00
Florian Schmaus a9d5cd4a61 Move TLS Required check at the end of connect()
It was a *very* bad idea to perform the SecurityMode.Required check in
the connection's reader thread and not at the end of
AbstractXMPPConnectin's connect(). :/

This behavior dates back to 8e750912a7

Fixes SMACK-739
2016-11-12 11:59:06 +01:00
Florian Schmaus 013f4d630a Move duplicate code in AbstractXMPPConnection
from XMPP(TCP|BOSH)Connection.
2016-11-12 11:03:44 +01:00
Florian Schmaus a1630d033e Add support for DNSSEC/DANE
This closes the cycle which started with a GSOC 2015 project under the
umbrella of the XSF adding DNSSEC/DANE support to MiniDNS.

Fixes SMACK-366.
2016-10-31 10:45:38 +01:00
Florian Schmaus 45feaecdf7 Make XMPPError imutable and add stanza reference 2015-12-09 10:48:52 +01:00
damencho 035bbea837 Reply with service-unavailable for unhandled IQ requests
instead of feature-not-implemented.

Changes to send service-unavailable for not handled iq as said in
RFC6120 § 8.4: https://tools.ietf.org/html/rfc6120#page-128

"""
o  If an intended recipient receives an IQ stanza of type "get" or
   "set" containing a child element qualified by a namespace it does
   not understand, then the entity MUST return an IQ stanza of type
   "error" with an error condition of <service-unavailable/>.
"""
2015-12-06 17:09:47 +01:00
Florian Schmaus 8dcb3c11ff Smack 4.1.5
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJWUjTuXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41zp8H/iRB0CtFvxVBFwRpP2HB0Iyc
 VzdxJTVXgJ7s8V3Us2Gmm0chUvs1wybshIdZ090NX7huZ4F1rWrOP7qt9S4soKgX
 LNdKTKTTNJ61jktLkG1HjA8yJr1Zu+XFK10Ne8997N9TnhbcVYAhsuTb8SRE8dlE
 G1Qihe2guJCCnWJhz9bsCXyAFt/fM5rSb/sgs/kXkE1W5bYeMHpFMvqMfab8NPBP
 fkt/NSxfqLfrRJneynnSwGSvRitDxpfRCcxLktTdDO31eryayIyiQIhaUhFYIGJQ
 tKx0/7HdCkgdUueBdtoQ/O02rjJ+kYqN2F3CErcIbB//3R6WKNF61XzOY81egYc=
 =dklO
 -----END PGP SIGNATURE-----

Merge tag '4.1.5'

Smack 4.1.5
2015-11-22 23:14:02 +01:00
Florian Schmaus 81fb1ed93c Make executorService blocking in AbstractXMPPConnection
Otherwise AbstractXMPPConnection.processPacket() will throw a
RejectedExecutionException if the underlying queue is full.

Fixes SMACK-702.
2015-11-21 17:31:39 +01:00
Florian Schmaus 04a0004035 Smack 4.1.4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJV9nAlXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41sFEIAJlfRspk6S5ymNc4w7u/FT1w
 MpHT/cxqIQIBU9J5dYqeW6Y8O6VuUeknCmZBEv7dIVHroTmvfosMauAyRZJXWeeL
 FQQTBqDJszYdM88x/d5X6d25lCEBdQkdDh2a5s9AIy9RH0iXE74AypuikbroK+VC
 zI3wRPUFq7WnARtmiP2NalSgSNv5ToeicBO+JSniQ+O52ZAlP2FSDfi4uzPPigdP
 Ip/V3eF4Bp0YZimcxAnWdnMU+ciVLClRYKgD3+qTEoic7dx3dzeTyrk1NoLRgQl9
 mfcNXBgUScHZAoSIkR0QiUx9ktPCJ950qa+XtW3B8NtDOZkXegUL/a8ukQAuz+k=
 =qMsC
 -----END PGP SIGNATURE-----

Merge tag '4.1.4'

Smack 4.1.4
2015-09-14 09:05:24 +02:00
Florian Schmaus 9884eee85d Provide a hint in NotConnectedException
that connect() needs to be called prior login().

SMACK-686
2015-07-29 08:20:46 +02:00
Florian Schmaus 710948c8f7 Add support for XEP-360: Nonzas
SMACK-682
2015-07-14 22:43:58 +02:00
Florian Schmaus bfdcfba092 Throw NotConnectedException instead of NoResponseException
if the connection is not connected in sendStanzaWithResponseCallback and
in PacketCollector.

Also decrease log level if roster result listener's exeption callback is
invoked with a NotConnectedException.
2015-07-03 13:01:53 +02:00
Florian Schmaus ebcbdb75cd Smack 4.1.2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJVjpgTXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41g0IH/3dJedDe6D8BySl4YVoFkQEk
 Ax6T9oguTHN4o+6wnIjZUMBqycxKbwCppwE8ydrsarpxBicehwLzgaegxqVOtqM/
 /7ZNzMiASxzeSCOQpR6dxNYGZp/buY3yaL4hweVh8V+vRVxzk/dXBpl6Syba+G1N
 ytpCfeC6bGd+Gf5aQ9SA8rPz3ZP99twFNuKYwZGkC8/ePtieT8YthKwwnaIlCuFL
 BZbhgR24W5pDtaCocTBUnI2wTqv2WsEx6+6LNEHsg2pbAwf2hYw12LPk0krvZOOV
 PSK/Jtq5qdXrq/vNudvfuVmk5KnhS8BO/WIY+8+EsYBFfP0W7ajZl69KGOxobNQ=
 =dg39
 -----END PGP SIGNATURE-----

Merge tag '4.1.2'

Smack 4.1.2

Conflicts:
	version.gradle
2015-06-27 15:07:04 +02:00
Florian Schmaus a997283304 Make AbstractXMPPConnection.getConfiguration public 2015-06-26 14:04:46 +02:00
Florian Schmaus 13224a9662 More information in closed on error log 2015-06-09 22:25:19 +02:00
Florian Schmaus 4a857fe67a Assert that a Stanza is a Stanza in sendStanza 2015-06-06 11:16:12 +02:00
Florian Schmaus 2f219c7317 Rename processPacket to processStanza
and assert that 'stanza' is a Stanza.
2015-06-05 14:04:17 +02:00
Florian Schmaus 9a00e09c0a Improve NoResponseException messages 2015-06-02 17:30:57 +02:00
Florian Schmaus c125a3b055 Bump jxmpp to 0.5.0-alpha4 2015-05-27 19:29:51 +02:00
Florian Schmaus 3c2ba0ec43 Add AbstractXMPPConnection.getUsedSaslMechanism()
and improve isAnonymous(). Also some minor changes to
SASLAuthentication.
2015-05-19 09:26:59 +02:00
Florian Schmaus f369a009ac Rename 'serviceName' to 'xmppServiceDomain'
Also use 'null' as default value for the resource, to enforce server
generated resources.

Fixes Smack-665
2015-05-19 09:26:59 +02:00
Florian Schmaus 0c8199650b Improve parsing exception callback.
Fixes SMACK-631.
2015-05-18 12:38:25 +02:00
Florian Schmaus 36cc05a507 Use Resourcepart as type for the resource 2015-05-04 20:53:00 +02:00
Florian Schmaus 9354e4fb74 Rework and improve authentication API and internals
Add

- performSaslAnonymousAuthentication()
- performSaslExternalAuthentication(SSLContext)
- addEnabledSaslMechanism(String)
- addEnabledSaslMechanisms(Collection<String>)

to ConnectionConfiguration.Builder.

Instead of providing a special API call for anonymous authentication,
Smack now has a configuration builder method to set anonymous/external
authentication. This also removes a lot of duplicate code within
Smack.

Also move SASLAnonymous into o.j.smack.sasl.core.

Fixes SMACK-629.
2015-05-03 22:00:41 +02:00
Florian Schmaus 17103def0b Change SmackExecutorthreadFactory constructor parameter to XMPPConnection 2015-04-22 09:45:02 +02:00
Florian Schmaus 7c3f4b7129 Add AbstractXMPPConnection.toString() 2015-04-22 09:28:30 +02:00
Florian Schmaus 6c637d5784 Don't automatically login() on connect()
if the connection was authenticated before.

Fixes SMACK-647.
2015-04-06 13:51:47 +02:00
Florian Schmaus 64d134052d Enable javadoc checkstyle
and fix violations.
2015-03-29 12:29:32 +02:00
Florian Schmaus 72f41e20b1 Don't rethrow RuntimeExceptions in parseAndProcessStanza 2015-03-25 10:29:43 +01:00
Florian Schmaus c6594aec2f Lint fixes: Remove dead code, etc.
- make method static when possible
- remove never thrown Exception declarations
- other fixes
2015-03-24 18:33:47 +01:00
Florian Schmaus 83b84c5bd3 Merge branch '4.1'
Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java
	smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
	smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
	version.gradle
2015-03-24 17:16:18 +01:00
Florian Schmaus 451eb4c826 Add missing break statements 2015-03-23 09:52:01 +01:00
Florian Schmaus f546d28ad8 Xlint all the things
and fix all warnings.
2015-03-23 09:28:49 +01:00
Florian Schmaus 5e86db4f80 Substitute 'packet' with 'stanza(/packet)' in javadoc 2015-03-21 09:36:28 +01:00
Tomáš Havlas fae9d129a9 Added support for pre-approved subscription requests (RFC 6121 § 3.4)
SMACK-639
2015-03-19 11:31:05 +01:00
Florian Schmaus f410ece468 Call connection created listeners in constructor
Fixes SMACK-638.
2015-03-19 08:21:47 +01:00