Commit Graph

576 Commits

Author SHA1 Message Date
Florian Schmaus 013f4d630a Move duplicate code in AbstractXMPPConnection
from XMPP(TCP|BOSH)Connection.
2016-11-12 11:03:44 +01:00
Florian Schmaus 6cf3ad32f9 Remove unnecessary semicolon in StringUtils 2016-11-06 11:14:19 +01:00
Florian Schmaus 5a2326a856 Add convinient constructors for Message and Presence 2016-10-31 12:24:03 +01:00
Dmitry Deshevoy 267fc431e5 Fix typo in TLSUtils 2016-10-31 10:50:34 +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 6e04a9d0ff Use 24h timestamp in debuggers. 2016-10-20 17:44:23 +02:00
Florian Schmaus fca2f59e08 Fix SCRAM-SHA1 mechanism creating invalid c-nonce
Because of the condition "c >= 32", Smack would possible return a
c-nonce containing ASCII whitespace characters (32d, 0x20), which are
not allowed in the c-nonce as per RFC 5802.

This commit applies the correct condition: "c > 32".

Fixes SMACK-735.
2016-10-20 17:00:52 +02:00
Andrey Prokopenko 2b83decc89 Handle success SASL messages containing equals sign
More strict conformance to RFC 6120 § 6.4.6, correctly handle
success SASL message which consists of a single equals sign.
Fixes SMACK-737.
2016-08-31 22:28:00 +02:00
Florian Schmaus 0e72213760 Add ConnectionConfiguration.setXmppDomain(String)
for easier usage and so so that the examples actually work. :)

Also some javadoc improvements.
2016-08-09 17:47:09 +02:00
Florian Schmaus d37d26547c Improve MUC code and documentation
- use JID types
- make clases immutable
2016-08-03 19:12:57 +02:00
Florian Schmaus e04697d349 Improve Collector javadoc 2016-08-03 19:12:24 +02:00
Florian Schmaus 4d7e4b2ab1 Add Message(String, String) constructor
to make simply Smack examples work, e.g.

Message message = new Message("user@example.org", "Hi, how are you?");
2016-07-24 21:21:21 +02:00
Florian Schmaus aeb385a022 Apply refinements and fixes to the MAM code
SMACK-625.
2016-07-23 15:45:45 +02:00
Florian Schmaus b91978dcc4 Add (partial) support for IoT XEPs
That is XEP-0323, -0324, -0325, and -0347.

SMACK-727.
2016-07-21 08:51:11 +02:00
Florian Schmaus d3cc9d12a0 Implement flexible port selection in Socks5ClientTest 2016-07-08 08:07:37 +02:00
Florian Schmaus 45b04800a4 Handle AlreadyConnectedException in ReconnectionManager
Fixes SMACK-725.
2016-07-04 08:27:18 +02:00
Florian Schmaus e943bbbd91 Handle AlreadyLoggedInException in ReconnectionManager
Fixes SMACK-725.
2016-07-04 08:27:06 +02:00
Florian Schmaus 1f87185ee8 Do not base64 twice in SASL X-OAUTH2
Fixes SMACK-722.
2016-07-04 08:25:01 +02:00
Florian Schmaus 17c9661283 Handle AlreadyLoggedInException in ReconnectionManager
Fixes SMACK-725.
2016-07-01 08:18:56 +02:00
Florian Schmaus ac5d9d56c6 Do not base64 twice in SASL X-OAUTH2
Fixes SMACK-722.
2016-06-01 13:10:11 +02:00
Florian Schmaus 86e11e69e8 Add Message.toString() providing a short description 2016-05-25 22:58:34 +02:00
Florian Schmaus 98ec77caee Use Message in FromMatchesFilterTest 2016-05-25 22:58:34 +02:00
Florian Schmaus 2bf6435881 Make Bind IQ constructor private 2016-05-25 22:58:34 +02:00
Florian Schmaus 03031dfb5d Add javadoc to SASLError 2016-05-22 22:55:28 +02:00
Florian Schmaus f4ce4b6e77 Add @see RFC for Presence's priority element 2016-05-21 12:44:13 +02:00
Florian Schmaus fa10a01831 Fix Presence.setPriority(int): Range is [-128,127]
Thanks to Guus der Kinderen for reporting this.
2016-05-21 12:44:13 +02:00
Florian Schmaus 4c63cfafd7 Rework support for Proxy connections
in order to improve support for Tor connections.

This makes it possible to establish a connection to an .onion domain by
manually setting host and port in the ConnectionConfiguration and
configuring a Socks5Proxy pointing to a Tor node.

Fixes SMACK-720.
2016-05-10 18:57:04 +02:00
Florian Schmaus b94b2586e2 Smack 4.1.7
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJXD/2lXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41rggH/0DjBLpCfTSdjjKGFNChc+1V
 dW9PaPGFUiPuTt3T2NEa74jGYe4PsPpy5zDsJ8uYi2aq3LAiCQvfk+F5LXjRJFoa
 eftz0GtPvfP42oFg8wyDAebFtb0OtE7aJueSRkYGhA1+kzHBbJ9s6TxqDWcB0UWC
 puLh/DEWDFGX5njln+l10O7b10G0+bSrvece22eP0sQIv4hvZJoPQ5rOpCR1wibL
 ldp6wXI6C/b/oQS9MjHq9SV10S+5GykBqN/UzcFnwRVHLbasqnXeNFLGOnMtx0g9
 DmOolAYKGBN5m7m0rqEj9R+OyNgtefV8sCHE69iNAlpQhbmTqPd5rIhIXIII4U4=
 =yWKV
 -----END PGP SIGNATURE-----

Merge tag '4.1.7'

Smack 4.1.7
2016-04-14 22:30:34 +02:00
Florian Schmaus 58d9f4e749 Use Locale.US in XMPPError.Type ↔ String conversion
Fixes SMACK-719
2016-04-12 15:05:56 +02:00
Florian Schmaus 8235e8417d Use simple name in StanzaTypeFilter 2016-04-12 15:05:56 +02:00
rohanag12 d69265774b Update DefaultExtensionElement.java
Removed duplicate word from description
2016-01-30 12:44:43 +05:30
Andrey Starodubtsev 35ba917728 Fix a couple of javadoc warnings 2016-01-18 22:08:43 +01:00
Florian Schmaus 23201d5f0f Improve logging of failed presence extensions
Don't log the exception for now because the stack trace makes to much
noise in the log output. This is mostly caused by Googles outdated
Entity Capabilities implementation.
2016-01-18 22:08:23 +01:00
Florian Schmaus e6a9027cc6 Improve StringUtils.escapeForXml() 2016-01-18 22:04:20 +01:00
Florian Schmaus 2539c10246 Fix javadoc of ConnectionException
Related to SMACK-711.
2016-01-10 19:38:29 +01:00
Florian Schmaus ac0c05be04 StringUtils: Make randGen and numbersAndLetters final 2016-01-10 18:34:54 +01:00
Florian Schmaus 7a8d66e9e6 Improve logging of failed connection attempts
also improve XMPPTCPConnection.connectUsingConfiguration(): Try further
hostAddresses if getAllByName failes.

Fixes SMACK-711
2016-01-10 18:34:54 +01:00
Florian Schmaus 658a671cbe Make StringUtils.randomString(int) use SecureRandom 2016-01-10 18:21:46 +01:00
Florian Schmaus f79a7d9d5f Fix javadoc warnings 2015-12-19 13:30:15 +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 3c2dd9b9e6 Improve javadoc of getIQChildElementBuilder() 2015-11-24 10:58:41 +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 227ef2c5ae Add StandardExtensionElement
replaces DefaultExtensionElement which is now deprecated.

Also changes Stanza (and MultiMap) API so that there can be duplicate extension
elements, as this change is required for StandardExtensionElement and by
the XMPP standard.
2015-10-19 08:21:42 +02:00
Florian Schmaus 86548b87bb Rework Roster IQ and DirectoryRosterStore
remove (set|get)ItemStatus. This was always the ask status, which can
only be set to 'subscribe' or is non-existent.

Use the standard (de-)serialization facilities for DirectoryRosterStore.

Fixes Smack-657.
2015-09-29 22:35:50 +02:00
Florian Schmaus e9f7710759 Fix spelling in ConnectionConfiguration 2015-09-27 23:12:18 +02:00
Florian Schmaus e1f09032d9 Fix javadoc link in ConnectionConfiguration.Builder 2015-09-27 23:11:56 +02:00
Florian Schmaus 9c694a0a75 Code cleanup: Fix some warnings 2015-09-24 12:59:17 +02:00
Dave Cridland 9c772add93 SASL Proxy Auth support
This adds the ability to provide a distinct authorization identifier for use
by SASL mechanisms. Not all SASL mechanisms support this operation, in
particular CRAM-MD5.

Both the javax and provided SASL implementations are extended, and an authzid
parameter added to the authenticate method.

The authorization identifier is passed as a EntityBareJid in order to assure the
correct form.

Resolves SMACK-677.

Minor-Modifications-By: Florian Schmaus <flo@geekplace.eu>
2015-09-21 20:39:23 +02: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 d728204890 Add errorprone check and fix found errors
Adds gradle-errorprone-plugin 0.0.8, requires Gradle 2.6.
2015-09-13 18:12:33 +02:00
Florian Schmaus b1e4884fbb Remove erroneous next() from AbstractJsonExtensionProvider
Fixes SMACK-695.
2015-08-24 11:09:59 +02:00
Florian Schmaus 33e5c37af8 Refactor PEP to use PubSub API.
Fixes SMACK-416.
2015-08-17 12:45:23 +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 e0e4fd9b12 Add checkstyle rule for StringBuilder.append(char)
And replace all instances where String.Builder.append() is called with a
String of length one with append(char).

Also adds StringUtils.toStringBuilder(Collection, String).
2015-07-27 19:02:11 +02:00
Florian Schmaus 7032688123 Rework Proxy API
Instead of extending SocketFactory, the proxy support classes now
implement ProxySocketConnection. This removes a lot of unnecessary
code.

Also re-enables proxy support, which was broken in previous versions
because none of extended SocketFactories did override
createSocket() (SMACK-683).
2015-07-17 08:50:19 +02:00
Florian Schmaus 46f9b9ab39 Improve StringUtils.escapeForXML()
use CharSequence as input.
2015-07-15 19:56:46 +02:00
Florian Schmaus 1c716bc1e0 Smack 4.1.3
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJVpgWiXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41G1gH+gIw/seXSSY6vYlVkYEFtR+e
 LV/LArN/eN1ZGc+WjN0EysRyqOBqF8HVHuyO7fF67huDRn62s7hufVY//NTctJ5L
 m4TXwaEUvgjdul7vm/dZcNRYr0jcSpDTFWx2egkOXt3qE9AhnpbnaIJ5c3q9VVVD
 aba88c3NS7quxp0hQm1SNEAmt1CCMPom7YkxdIPKWlLj8N5AF1UuSKwckLLYSUlS
 wloBbITb6EjI1IwszhN6e6o3W+7Pz/1zbFjk0CkKUS+TmhHhKil8TonH8Se/9DYD
 1SVHxvZa8LHWsU9G/R1Nhl69K2+GHEUbGmXalFmyPIf5ifhYyNimpx9krXQUuLs=
 =3/cn
 -----END PGP SIGNATURE-----

Merge tag '4.1.3'

Smack 4.1.3
2015-07-15 09:37:46 +02:00
Florian Schmaus 710948c8f7 Add support for XEP-360: Nonzas
SMACK-682
2015-07-14 22:43:58 +02:00
Florian Schmaus 734695c80e Improve StringUtils.collectionToString()
Use generics, and iterator and append(char) instead of append(String).
2015-07-14 13:40:23 +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 e6a403fb1c Re-escape XML text in parseContentDepth()
SMACK-680.
2015-07-02 16:10:50 +02:00
Florian Schmaus 9ea5c0a2ce "Smackify" HOXT code: Use Smack programming idioms 2015-07-01 13:39:04 +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 65788389ea Reset ReconnectionManager's 'attempts' to 0
on successful reconnects. Fixes SMACK-668.
2015-06-27 14:25:19 +02:00
Florian Schmaus a997283304 Make AbstractXMPPConnection.getConfiguration public 2015-06-26 14:04:46 +02:00
Florian Schmaus 989076a166 Make synchronization point return the exception
instead of a boolean value.
2015-06-13 19:26:57 +02:00
Florian Schmaus 13224a9662 More information in closed on error log 2015-06-09 22:25:19 +02:00
Florian Schmaus a85ba5311e Add more information to NotConnectedException 2015-06-09 22:16:01 +02:00
Florian Schmaus bad52fad21 Deprecate setServiceName in favor of setXmppDomain 2015-06-08 14:42:05 +02:00
Florian Schmaus 4a857fe67a Assert that a Stanza is a Stanza in sendStanza 2015-06-06 11:16:12 +02:00
Florian Schmaus 58402c5615 Bump jxmpp to 0.5.0-alpha5 and change Roster API
to only allow bare JIDs as roster entires.
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 8840236b72 Gracefully disconnect XMPPTCPConnection
That is, wait with a timeout for a closing stream element if we have
sent a closing stream element to the server. See RFC 6120 § 4.4.

Fixes SMACK-633.
2015-05-27 17:36:04 +02:00
Florian Schmaus 01f08e87c2 Merge branch '4.1'
Conflicts:
	smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java
	version.gradle
2015-05-24 22:36:11 +02:00
Florian Schmaus 385798f9ba Only add Entity Capabilities extension to available presences
Also don't override eventually send presences on
updateLocalEntityCaps(), instead save the last sent Presence stanza and
re-send that stanza.

SMACK-669.
2015-05-22 08:45:53 +02:00
Florian Schmaus c120bc1cbc Handle empty array in SASLMechanism.authenticate()
like null array.

Thanks to Anthony Sorvari for reporting.

Fixes SMACK-670.
2015-05-22 08:24:54 +02:00
Florian Schmaus 8db0403138 Improve writing XML elements to socket
Instead of allocating one big continuous memory block before "writing"
the XMPP stream element to the socket, write the single CharSequences of
LazyStringBuilder/XmlStringBuilder.

Also change Obserable writer to only notify the listeners after a
flush *or* if a certain limit has been reached since the last
notification. Otherwise the debugger would "print" every single XML part
as result of this change.
2015-05-21 22:41:21 +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 bbc7aaae77 Smack 4.1.1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJVTgmuXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41MXUH/3A5Jc6rzALhnXMT4yj+jXow
 rLLX5/ypOvkAXEMRlTf9xd2apz4hT8dMsBcL3JvZscuVmkw0/woh9eV/PFSDoc7t
 HA7bMZRqWqUuVOezFD0ggHsJ7zfpcIuxsgoNARQlCRMPHzCLzKhMNctz5UApAdfy
 +wPpTMpc3K5SM1bNlM60qp+dbPCqQcLwYP02KrOQASgenVDm6iKFpzx0ieVpPY1M
 hOBMyaZg3n2j+267gpqBG6c7PVmEq3deAlB6BOBAsL/Bp1w5B5Smq959LWJLstrU
 /LeYJFi1TeIASiFy1vZyTV0Tw+Pe++3gB6ppLqkQhfWV8vXzm0coCXx29qWxAzM=
 =pGJt
 -----END PGP SIGNATURE-----

Merge tag '4.1.1'

Smack 4.1.1

Conflicts:
	smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java
	smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java
	smack-java7/src/main/java/org/jivesoftware/smack/java7/Java7SmackInitializer.java
	version.gradle
2015-05-09 15:42:09 +02:00
Florian Schmaus 236dfb009d Improve logging of parsing errors 2015-05-07 22:40:38 +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 4eb322608e Add ConnectionConfiguration.setProxyInfo(ProxyInfo)
Fixes SMACK-661.
2015-04-27 17:51:18 +02:00
Florian Schmaus a4be67ff5d Fix ReconnectionManager RANDOM_INCREASING_DELAY policy
which was using the same value. Fixes SMACK-660.
2015-04-27 17:35:00 +02:00
Florian Schmaus f579fb2c77 Throw exception if smack-java7 is loaded on Android 2015-04-25 22:53:46 +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 189f524195 Make SynchronizationPoint interruptible
SMACK-632
2015-04-12 18:33:43 +02:00
Florian Schmaus 4a16ab9329 Merge branch '4.1'
Conflicts:
	version.gradle
2015-04-12 18:32:55 +02:00
Florian Schmaus 1eb315d6b7 Add Manager.getAuthenticatedConnectionOrThrow() 2015-04-09 19:00:03 +02:00
Florian Schmaus 9a69f992c4 Deprecate SynchronizationPoint.reportFailure()
assert and document that an exception must be set when calling
reportFailure(E).
2015-04-07 08:52:48 +02:00
Florian Schmaus cca34fd872 First check condition, then remaining wait in SynchronizationPoint
as otherwhise SynchronizationPoint may report NoResponseException when
there was in fact a success or failure reported in case there are
multiple threads waiting for the condition.
2015-04-07 08:51:03 +02:00
Florian Schmaus 83aa6838d9 Use signalAll in SynchronizationPoint
to prevent a thread from not being notified about a change of the state
of the SynchronizationPoint.

If two threads are waiting for a change, which could happen e.g. because
of a connectivity change and one thread does instantShutdown() while the
other handles connectionClosedOnError(), then only one thread, usually
the one handling connectionClosedOnError(), would be notified and
resumed.

Fixes SMACK-652.
2015-04-07 08:51:03 +02:00
Florian Schmaus 57fa631480 Add javadoc to SynchronizationPoint 2015-04-07 08:50:52 +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 b4694ec152 Add FinalClass checkstyle check
And mark affected classes final.
2015-04-06 10:45:12 +02:00
Florian Schmaus 0a6ac76447 Remove package-info.java from test packages
as otherwhise eclipse will complain "The type package-info is already
defined".
2015-04-05 10:48:00 +02:00
stawny 9d0ea3cf70 Resurrect integration tests: Chat Test 2015-04-04 17:19:31 +02:00
Florian Schmaus de528eee67 Add JavadocPackage checkstyle
change from package.html to package-info.java. Add missing
package-info.java with a placeholder description.
2015-04-04 17:16:47 +02:00
Florian Schmaus dc373f641c Make Smack Java8's javac and javadoc ready 2015-04-04 17:16:27 +02:00
Vyacheslav Blinov 5272680d47 Add XmlStringBuilder API for Date
Fixes XEP-0080 GeoLoc timestamp element formating
2015-03-30 20:56:36 +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 0897b76718 Fix unit-tests initialization
Remove the TestSuite class. We now have

SmackTestSuite
    ^
	|
InitExtensions
    ^
	|
$UnitTest

where most basic setup is done in a static block within
SmackTestSuite (only stringencoder setup right now).

Also some minor fixes in unit tests.
2015-03-24 21:40:08 +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 9ac3633612 javadoc: s/packet/stanza/ 2015-03-24 17:15:50 +01:00
Florian Schmaus 40a2a28ebe Enable -Werror and add XmppHostnameVerifier
We now treat warnings as errors (-Werror).

In order to do so, it was necessary to remove Java7HostnameVerifier
since it depended on internal properietary API. XmppHostnameVerifier
take the place of it.
2015-03-23 14:20:03 +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 7c5428ab0e Javadoc improvements 2015-03-21 18:59:12 +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
Florian Schmaus 5188c6f934 Add checkstyle check for space(s) after tab(s) 2015-03-18 21:51:25 +01:00
lucastucchi a7616f2a03 Add the possibility to choose reconnection policy
Until now the reconnection used a fixed policy using random
increasing delay as the number of attempts grows. Even if
that policy is still the default one, it is now possible to
select a fixed delay policy that always waits a fixed amount
of time before trying to reconnect
2015-03-18 21:16:32 +01:00
Florian Schmaus 8878cf3773 Add checkstyle check for trailing whitespace 2015-03-18 21:01:49 +01:00
Florian Schmaus b8f046706b Add Integration Test Framework
and resurrect a few integration tests.
2015-03-18 11:09:56 +01:00
Florian Schmaus b2221d5483 Add more checkstyle tests
- Lines containing tab(s) after space
- Usage of printStackTrace
- Usage of println
- Add SupressionCommentFilter module

SuppressionCommentFilter can be enabled with
// CHECKSTYLE:OFF
and disabled with
// CHECKSTYLE:ON
2015-03-17 22:02:44 +01:00
Florian Schmaus 0fde39fa45 's;^\s+$;;' on all source files
And add checkstyle test for lines containing only whitespace characters.
2015-03-17 11:33:02 +01:00
Ishan Khanna 0d8f3185e5 Add Support for XEP-80: User Location
SMACK-610
2015-03-16 20:01:58 +01:00
Florian Schmaus bc093b620d Make Provider.parse() just throw Exception
instead of throwing XmlPullParserException, IOException and
SmackException.

Add a guard to AbstractXMPPConnection.processPacket() to always re-throw
RuntimeExceptions.
2015-03-13 09:27:18 +01:00
Florian Schmaus 516e397679 Improve MUC's Destroy element class
- Made jid of type BareJid
- Made it implement TypedCloneable
- Made it implement Serializable
- Made it immutable

Also update its parsing code. And add some convenience methods to
ParserUtils.
2015-03-11 21:31:37 +01:00
Florian Schmaus 369878b6d9 Merge branch '4.1'
Conflicts:
	version.gradle
2015-03-11 20:51:08 +01:00
Florian Schmaus e85c1881d7 Add TypedCloneable 2015-03-10 22:50:48 +01:00
Florian Schmaus c540ac9703 Merge Smack 4.1.0-rc3
Conflicts:
	smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/provider/BytestreamsProvider.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
	version.gradle
2015-03-07 21:31:56 +01:00
Florian Schmaus 9c5b7d263e Include conditionText in XMPPError.toXML() 2015-03-06 09:10:49 +01:00
Florian Schmaus 701aa7d9c4 Merge branch '4.1'
Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
	smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
	smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java
	smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
	smack-core/src/main/java/org/jivesoftware/smack/debugger/SmackDebugger.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java
	smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
	smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/address/provider/MultipleAddressesProvider.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/Socks5TransferNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSub.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/VCardManager.java
	smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java
	smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java
	smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
	smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java
	smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java
	smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/provider/RosterExchangeProvider.java
	smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
	version.gradle
2015-03-04 22:42:36 +01:00
Florian Schmaus ed4fa3390f Add XMPPConnection.sendStanza(Stanza)
and deprecate sendPacket().
2015-03-04 21:46:44 +01:00
Florian Schmaus 18d9be0099 Add CapsExtensionProviderTest 2015-03-04 13:08:35 +01:00
Florian Schmaus dde0cfd7f6 Fix incoming file transfers
With bb8dcc9874 the concept if IQ request
handlers was introduced in Smack. This doesn't allow packet/stanza
collectors/listeners to filter for incoming IQ requests. Unfortunately
the file transfer code relied on this being able, so it broke with the
change.

There were two places where the file transfer code was listening for
incoming IQ requests:
- InitationListener(s)
- Negotiator(s)

With this change, we let the InitiationListener signal the existence of
an incoming initation request, send by an IQ of type 'set', using the
newly created EventManager utility.

The negotiator waits for those events to arrive and proceedes as it would
have done when the packet collector was used.
2015-03-02 15:56:26 +01:00
Florian Schmaus 21c0be5e2a Fixed AbstractXMPPConnection.cachedExecutorService
the combination with concurrencyLevel and LinkedBlockingQueue never
worked as intented. The idea was that the cachedExecutorService would
spawn new threads until maximumPoolSize (=concurrencyLevel) is reached,
and then start queing the Runnables.

But this was not the case, since ThreadPoolExecutor does not take into
consideration if the worker threads is busy, i.e. executing a Runnable,
or idle, i.e. waiting for a Runnable.

This means that if a busy Worker would execute a Runnable, which would
block, because it's waiting for an event (e.g. an incoming IQ
request), then the handling of those incoming IQ request would be
queued by ThreadPoolExecutor, because no fewer threads then corePoolSize
are running and the task can be queued (since the LinkedBlockingQueue is
unbounded).
2015-03-02 15:50:13 +01:00
Florian Schmaus caa7b9acb8 Improve message of StreamErrorException 2015-03-02 15:50:12 +01:00
Florian Schmaus 75ec271c6c Rename PacketListener to StanzaListener
and add the PacketListener as deprecated interface.
2015-03-02 15:49:56 +01:00
Florian Schmaus d4a6d8e653 Rename PacketFilter (and implementing classes) and PacketExtension
to StanzaFilter and ExtensionElement.
2015-02-28 13:49:38 +01:00
Florian Schmaus 49e1c837b2 Adjust AbstractListFilter.toString()
to produce a similar styled output like the other toString() methods and
add unit-test for the method.
2015-02-26 08:47:43 +01:00
Florian Schmaus 404b90054b Use Executors.newSingleThreadScheduledExecutor
and remove the calls to setMaximumPoolSize() and steKeepAliveTime()
since they are ineffective on Android.
2015-02-25 16:17:09 +01:00
Florian Schmaus 39382b8b38 Shorten Smack's executor service names
instead of

"Smack Executor - Foo 42 (2)"

use

"Smack-Foo 42 (2)"

since sometimes the space for the name is limited (e.g. busybox's 'ps
-t').
2015-02-25 16:09:41 +01:00
Florian Schmaus e9dd3e2fa6 Add copy constructor to Message and Presence
and also implement Cloneable and add clone() methods.
2015-02-23 22:15:59 +01:00
Florian Schmaus afba123ba3 Javadoc improvements in MultiMap and Stanza 2015-02-23 10:49:33 +01:00
Florian Schmaus b74b8c5757 Make Stanza constructors 'protected' 2015-02-23 10:48:43 +01:00
Florian Schmaus 180a3bb4ca Fix SASL X-OAUTH2: Use Base64.encode() instead of decode() 2015-02-23 08:49:30 +01:00
Florian Schmaus 8b0ccd7420 Minor javadoc fixes and improvements 2015-02-22 10:41:53 +01:00
Florian Schmaus fbf0ba13ce Merge Smack 4.1.0-rc2
Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java
	version.gradle
2015-02-21 18:07:45 +01:00