Commit Graph

121 Commits

Author SHA1 Message Date
Florian Schmaus 64d134052d Enable javadoc checkstyle
and fix violations.
2015-03-29 12:29:32 +02: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 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 5e86db4f80 Substitute 'packet' with 'stanza(/packet)' in javadoc 2015-03-21 09:36:28 +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 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 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 d4a6d8e653 Rename PacketFilter (and implementing classes) and PacketExtension
to StanzaFilter and ExtensionElement.
2015-02-28 13:49:38 +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 afba123ba3 Javadoc improvements in MultiMap and Stanza 2015-02-23 10:49:33 +01:00
Florian Schmaus 5bb4727c57 Use Jid (and subclasses) from jxmpp-jid
Fixes SMACK-634
2015-02-17 16:07:16 +01:00
Florian Schmaus bc61527bd2 Expose InterruptedException
SMACK-632
2015-02-14 14:57:33 +01:00
Florian Schmaus 4698805a34 Rename 'Packet' class to 'Stanza'
Smack still uses the term 'Packet' in some places. This is just the
first step towards using correct XMPP terms in Smack.
2015-02-06 09:34:51 +01:00
Florian Schmaus 9fc26f1d83 Use MultiMap for Stanza extension elements 2015-02-05 11:04:38 +01:00
Florian Schmaus 4013c68584 Use Objects.requireNonNull() in Presence
Also make Objects.requireNonNull() throw NullPointerException to match
the original API behavior.
2015-02-03 19:32:04 +01:00
Florian Schmaus 37081b2810 Send more information with the stream open tag 2015-01-28 09:31:28 +01:00
Florian Schmaus 86ea027301 Add StringUtils.requireNotNullOrEmpty and Objects.requireNonNull
and use this in a few places.
2015-01-26 20:47:09 +01:00
Florian Schmaus 4b10f36e9e Report failed DNS SRV lookup in ConnectionException
instead of just logging a warning if the XMPP domain has no DNS SRV
lookups, create the failedAddresses list now within DNSUtil and add the
information that the SRV lookup failed.
2015-01-26 07:54:12 +01:00
Florian Schmaus d97de5f42c Fix typo in DNSUtil.setIdnaTransformer 2015-01-21 09:50:50 +01:00
Florian Schmaus c5db012fc8 Improve privacy parsing and API. Add NumberUtil
Make 'order' an long

Parse fall-through case's child elements (message, iq, presence-in,
presence-out)

Remove

privacy.addExtension(new DefaultPacketExtension(parser.getName(), parser.getNamespace()));

at the beginning of PrivacyProvider. Was there since day one for an
unknown reason.
2015-01-21 09:50:44 +01:00
Florian Schmaus 8409dddffd Add PacketUtil.extensionElementFrom()
and deprecate extensionElementfromCollection()
2015-01-19 08:41:21 +01:00
Florian Schmaus 9ae66cc747 Use Exception.getString in HostAddress
instead of getMessage(), because some Exceptions, e.g. Android's
NetworkOnMainThreadException, will return null on
getMessage(). Exception.toString() does what we want, i.e. returns
- the exception class name
- and the return value of getLocalizedMessage()
2015-01-18 19:21:58 +01:00
Florian Schmaus 9ec7d628c8 TLSUtils.disableHostnameVerificationForTlsCertificates()
(yeah, I know)

Sometimes "a friend" has setup an XMPP service which uses a self-signed
cert. While we can get a decent amount of security by using techniques
like e.g. the MemorizingTrustManager, there's still a pitfall. If the
service's TLS certificates contains no or the wrong service/hostname
information, Smack will throw an CertificateException. Therefore provide
an API call to disable hostname verification.
2015-01-17 12:17:28 +01:00
Florian Schmaus b0cecee710 Rename IQ.ELEMENT to IQ.IQ_ELEMENT
to avoid confusion between the IQ element 'iq' and the IQs child
element. ELEMENT defined in an IQ sublcass should contain the *child*
element.

Add element to StreamInitation and fix FileTransferManager which still
used a packet listener instead of an IQ request handler to handle
incoming stream initiation requests.
2015-01-11 21:54:46 +01:00
Florian Schmaus 8f8e0c7138 Use Async.go() in ReconnectionManager 2015-01-10 01:12:37 +01:00
Florian Schmaus bb8dcc9874 Add IQ request handler API
This also moves the logic to send error IQ replies from "when there is
no IQ provider registerd" to "when there is no IQ request handler
registered". Which has for example the advantage that IQ parsing no
longer asks for a connection instance.
2015-01-08 23:15:24 +01:00
Florian Schmaus b23df7d2b8 Decrease logging verbosity in FileUtils.readFile(File) 2015-01-07 14:35:23 +01:00
Florian Schmaus f2703bc195 Improve SHIM API
- HeadersExtension.getHeaders() now returns a List instead of a
  Collection
- Use XmlStringBuilder in Header and HeadersExtension toXML()
- Add HeadersProviderTest
- Use Smack formatting

Also remove duplicate parsing code regarding SHIM from HOXT
implementation.
2015-01-02 00:09:30 +01:00
Florian Schmaus c5d0fb3c7b Add support for *optional* session establishment
Don't perform XMPP session binding if the server announced the feature
as optional.

Fixes SMACK-622
2014-12-30 14:34:04 +01:00
Anno van Vliet b08dbc1dbc Support for XEP-0122: Data Forms Validation.
Data Forms Validation are a part of Data Fields and implemented as
extensions, added to a Datafield.

Data validation extensions are validated before adding to the message,
using the consistency rules as described in the XEP.
Fixes SMACK-621.

Minor modifications done by Florian Schmaus <flo@geekplace.eu>
2014-12-30 02:03:12 +01:00
Florian Schmaus f4aaf387d4 Use assertAtStartTag in parseStanza 2014-12-28 17:45:11 +01:00
Florian Schmaus 755765120d Make FormField.Type an enum 2014-12-27 21:12:48 +01:00
Florian Schmaus 18ac83cf8c Move SmackExecutorThreadFactory out of
AbstractXMPPConnection. And use it in PingManager.
2014-12-19 12:53:16 +01:00
Florian Schmaus a87227c531 Rename ConnectionConfigurationBuilder to Builder 2014-12-18 10:15:35 +01:00
Florian Schmaus c89d06861b Use switch-case in PacketParserUtils.parseContentDepthWithoutRoundtrip() 2014-12-10 12:28:22 +01:00
Florian Schmaus 77f0fdc156 Add (IQ|PacketExtension)IntrospectionProvider
This simplifies code as there is no longer a distinction between
"normal" providers and introspection providers in ProviderManager
necessary.

It's also easier to get an idea where introspection is used for parsing.
2014-12-10 11:09:52 +01:00
Florian Schmaus 9286a1decb Rework XMPP Error class design
Introduce AbstractError, change 'Conditions' to enums. Because of
AbstractError, it was necessary that PlainStreamElement and
TopLevelStreamElement becomes an interface. Thus the implementation of
TopLevelStreamElement.toString() had to be removed.

This adds

- policy-violation
- unexpected-request

to XMPPError.Condition, and removes the

- payment-required
- remote-server-error
- unexpected-condition
- request-timeout

Conditions

The file transfer code does now no longer throw XMPPErrorExceptions, but
SmackExceptions.

Fixes SMACK-608. Makes it possible to resolves SMACK-386.
2014-11-25 13:19:32 +01:00
Florian Schmaus cc09192095 Smack 4.0.6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJUci2fXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI415IIH/j1eCvLIjNqNP6ytXdgomYY+
 j2i5KRHMv69La1JqtdmAeTeZfD13549s/66I5VUfegEfaADGUPr1NGrQKlb8lJBe
 YSqthMaQUybLBuCL9Lwg/3jE6s27GixRjW/Wip4ntac1wS2R3qD18lAxYIivsGJh
 gvyGHGoXvdct6teu9X0RtmyE/EOBfV63y1gVJG07Jv5/AJ2wCh9dIOD4jFuqvkoA
 cz2OfVJOIFletBV2psLxc0VVeqU9Lpba5TZuW1ZylY61z+X2rpt9BwCgBD35jTF9
 ztP2ytQY80+vZO6uP+Tl75QxdQd/e0O9oGnYbmMp1gfYQjgETaHUDxAL2uw4XNo=
 =7UY+
 -----END PGP SIGNATURE-----

Merge tag '4.0.6'

Smack 4.0.6

Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java
	version.gradle
2014-11-23 20:05:44 +01:00
Florian Schmaus 646a4a6f90 Add support for SASL failure 'text' elements
- Also move toString() into TopLevelStreamElement.
- Fix SASLFailure toXML xmlnsAttribute(NAMESPACE)
- Improve SASLFailure parsing
- And introduce XmlUnitUtils
2014-11-19 09:57:39 +01:00
Florian Schmaus 763f9c7c14 Implemented MD5 just like the SHA1 util 2014-11-15 09:46:39 +01:00