Commit Graph

282 Commits

Author SHA1 Message Date
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
Florian Schmaus c81cd34561 Apply builder pattern to ConnectionConfiguration
Introducing a clean split between the constant connection configuration
parameters, which are now all in ConnectionConfiguration and the dynamic
connection state (e.g. hostAddresses) which are now in
AbstractXMPPConnection.

Also removed all arguments of login() since the username, password,
resource and callback handler need now to be configured via
ConnectionConfiguration.

Also remove documentation/extensions/messageevents.md, as it's already
in documentation/legacy
2014-11-15 09:46:31 +01:00
Florian Schmaus 4000adb70c Fallback to host if DNS SRV lookup fails
Also fix javadoc for DNSUtil, _jabber SRV records are no longer tried.

Fixes SMACK-616.
2014-11-10 21:21:44 +01:00
Florian Schmaus 9e797c1b17 Enable PacketExtensions for IQs
This is actually only part one, i.e. with this commit if the user adds a
PacketExtension to an IQ it will be included in IQ.toXml(). Which was
previously only the case if the IQ subclass explicitly included packet
extensions.

The second part of the change is to change the IQ provider, so that
packet extensions are automatically parsed.

Cases where PacketExtensions are used for Message and IQ are slightly
changed. The IQ sublcass now only has a field with this
PacketExtension (see for example
bytestreams.ibb.packet.DataPacketExtension).

Also changed hoxt API: Removed unnecessary indirection and made the
API more Smack idiomatic.
2014-11-10 11:43:18 +01:00
Florian Schmaus 1de2fc2a81 Refactor Bind and Roster IQ parsing code into providers 2014-10-30 13:21:36 +01:00
Florian Schmaus e88583d287 Use switch/case in 'IQ parse(XmlPullParser)' 2014-10-30 13:21:36 +01:00
Florian Schmaus b5daee3032 Include the full content in UnparsedResultIQ
In order to prevent

<iq to='...' from='...' type='result' id='1'>
  <mynode xmlns='my:namespace' myattr='...'>
    <somenode\>
  </mynode>
</iq>

showing up as UnparsedResultIQ like this:

<iq to='...' from='...' type='result' id='1'>
  <somenode\>
</iq>
2014-10-30 13:21:36 +01:00
Florian Schmaus 53bba50f91 Call pingServerIfNecessary in new thread
in order to prevent the BroadcastReceiver from timing out.

To prevent:

10-24 10:59:35.096 W/BroadcastQueue( 1044): Timeout of broadcast BroadcastRecord{43400df0 u0 org.igniterealtime.smackx.ping.ACTION} - receiver=android.os.BinderProxy@42d37cc0, started 60000ms ago
10-24 10:59:35.096 W/BroadcastQueue( 1044): Receiver during timeout: BroadcastFilter{42cee7b0 u0 ReceiverList{42cfd9f0 16003 org.projectmaxs.transport.xmpp/10149/u0 remote:42d37cc0}}

10-24 10:59:38.201 E/ActivityManager( 1044): ANR in org.projectmaxs.transport.xmpp
10-24 10:59:38.201 E/ActivityManager( 1044): PID: 16003
10-24 10:59:38.201 E/ActivityManager( 1044): Reason: Broadcast of Intent { act=org.igniterealtime.smackx.ping.ACTION flg=0x14 (has extras) }
10-24 10:59:38.201 E/ActivityManager( 1044): Load: 18.97 / 31.7 / 45.71
10-24 10:59:38.201 E/ActivityManager( 1044): CPU usage from 20588ms to 0ms ago:
10-24 10:59:38.201 E/ActivityManager( 1044):   0.4% 1044/system_server: 0.2% user + 0.1% kernel / faults: 188 minor 1 major
10-24 10:59:38.201 E/ActivityManager( 1044):   0.4% 9089/kworker/0:3: 0% user + 0.4% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0.1% 1567/mpdecision: 0% user + 0.1% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0.1% 28507/kworker/u:5: 0% user + 0.1% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 7/kworker/u:0H: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 148/mmcqd/0: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 14687/com.teslacoilsw.launcher: 0% user + 0% kernel / faults: 6 minor
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 3/ksoftirqd/0: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 1111/MC_Thread: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 1135/wpa_supplicant: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 1283/com.android.phone: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 11469/com.getpebble.android: 0% user + 0% kernel / faults: 1 minor
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 14971/com.google.android.apps.unveil: 0% user + 0% kernel / faults: 6 minor
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 28677/watch_server: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 31539/kworker/0:2: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044): 1.2% TOTAL: 0.4% user + 0.5% kernel + 0.2% iowait
10-24 10:59:38.201 E/ActivityManager( 1044): CPU usage from 2536ms to 3060ms later:
10-24 10:59:38.201 E/ActivityManager( 1044):   9.2% 1044/system_server: 1.8% user + 7.4% kernel / faults: 56 minor
10-24 10:59:38.201 E/ActivityManager( 1044):     5.5% 1058/ActivityManager: 0% user + 5.5% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   1.3% 23415/kworker/0:1H: 0% user + 1.3% kernel
10-24 10:59:38.201 E/ActivityManager( 1044): 0% TOTAL: 0% user + 0% kernel + 0% iowait
10-24 10:59:38.208 I/ActivityManager( 1044): Killing 16003:org.projectmaxs.transport.xmpp/u0a149 (adj 0): background ANR
2014-10-24 11:45:28 +02:00
Florian Schmaus 403ecff2b2 Add SCRAM-SHA1 support
Thanks to Stefan Karlsson for helping with the implementation.

Also add SASLMechanism.checkIfSuccessfulOrThrow(), to increase the
security by verifying the mechanisms state at the end of SASL
authentication.

SASLMechanism now has a SASLPrep StringTransformer.

Refactor SHA1 functions out of StringUtils into SHA1 utility class.

Add MAC utility class.

Make DummyConnection getSentpacket() methods use generics to make unit
testing SCRAM-SHA1 easier.

Fixes SMACK-398
2014-10-21 15:03:48 +02:00
Florian Schmaus 3733a6aaa5 Cache the parser availability of the roundtrip feature
As otherwise there would be multiple log statements (which are of level
fine but nevertheless).

PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$2600(XMPPTCPConnection.java:1224)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1263)
PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:970)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:989)
PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:970)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:989)
PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:970)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:989)
2014-10-19 20:58:42 +02:00
Florian Schmaus a90c1ac845 Remove 'throws Exception' from DNSUtil.resolve…(String) 2014-10-19 11:49:45 +02:00
Florian Schmaus ed58abbee7 Support XML_ROUNDTRIP where possible
The approach to avoid XmlPullParser's XML_ROUNDTRIP feature prevents
Smack from handling XML namespaces on e.g. PubSub payloads on platforms
where support for XML_ROUNDTRIP would be available.

We now check for this XmlPullParser feature and use it if it's
available.
2014-10-15 22:50:48 +02:00
Florian Schmaus fe74fc23dc Rework smackx.address (XEP-0033: Extended Stanza Addressing)
- Make MultipleAddress.Type a enum
- Change the signature of the methods to use Collection instead of List
- Use for-each loops instead of iterators
- Switch Provider to new provider pattern (using switch-case)
- Use XmlStringBuilder (extend the API by two new methods)
2014-10-11 17:11:38 +02:00
Florian Schmaus 452b2aca0f Add 'PacketParserUtils.addPacketextension()' 2014-10-08 16:01:19 +02:00
Florian Schmaus 6980c8e63d Rework Smack Provider design
this is the first stop towards fixing "SMACK-65: parsing should look for
depth", by providing the initial parsing depth to the provider. Some
methods (.e.g parseMessage) now use the depth as abort condition,
instead of a unclean String equals check.

parseIQ() and parseExtension() where both renamed to parse.

This also restricts the Exceptions thrown by the parse method, to just
XmlPullParserException, IOException and SmackException (not really a big
victory, but nevertheless a slight improvement).

StreamFeatureProvider is now gone, we simply use PacketExtensionProvider
for stream features.
2014-10-08 16:01:14 +02:00
Florian Schmaus 47dd63e6b2 Don't use instanceof in a parse(IQ|PacketExtension)
Instead of using instanceof *every time* we parse an IQ or
PacketExtension, we now check the type of the Provider only once when
adding it.
2014-09-26 10:45:25 +02:00
Florian Schmaus 2dc93d7639 Add support for XEP-0059: Result Set Management
SMACK-581
2014-09-13 12:28:18 +02:00
Florian Schmaus d3cea48c0d Support for International Domain Names in DNSUtil 2014-09-13 09:27:55 +02:00
Florian Schmaus f2718c2d76 Remove smack.util.Cache
and use the Cache from jxmpp-util-cache instead.
2014-09-13 00:38:11 +02:00
Florian Schmaus 9016120d71 Add support for (custom) data form extensions
Fixes SMACK-605
2014-09-12 13:43:04 +02:00
Florian Schmaus d57fecfcc9 Add ELEMENT and NAMESPACE to RosterPacket 2014-09-12 13:40:04 +02:00
Florian Schmaus fca884d76b Add XmlStringBuilder.emptyElement(Enum) 2014-09-12 11:03:12 +02:00
Florian Schmaus 46a4402a69 Add StreamFeatureProvider
so that AccountManager and the CapsExtension can be moved to
smack-extensions, where they belong.
2014-09-11 23:58:07 +02:00
Florian Schmaus fc51f3df48 Add support for XEP-0198: Stream Management
- De-duplicate code by moving it into AbstractXMPPConnection
- Introduce TopLevelStreamElement as superclass for all XMPP stream elements.
- Add SynchronizationPoint, ParserUtils
- Add ParserUtils

Fixes SMACK-333 and SMACK-521
2014-09-11 09:49:16 +02:00
Florian Schmaus 34bc13bec7 Merge branch '4.0'
Conflicts:
	build.gradle
	smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
	smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
	smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java
2014-09-05 22:11:35 +02:00
Florian Schmaus afd7c67bf9 Add support for multiple status codes to MUCUser
Fixes SMACK-604
2014-09-05 11:45:06 +02:00
Florian Schmaus 5d4aa76d19 Create smack.util.stringencoder for Base64, Base32,…
Use Android's Base64 implementation when on Android, otherwise, when on
Java7, use the existing one.
2014-09-04 11:07:55 +02:00
Florian Schmaus 5342aaf137 Make XMPPError.Condition.equals null-safe
also make Condition implement CharSequence.

SMACK-603
2014-09-01 10:13:23 +02:00
Florian Schmaus b5b134f569 Process all XML namespaces in PubSub ItemProvider
Fixes SMACK-601
2014-08-29 14:59:54 +02:00
Florian Schmaus 5a5524623c Make presence parsing more robust
by allowing 'show' to be an empty element: '<show />'
2014-08-28 14:14:18 +02:00
Florian Schmaus 191c4429da Fix FileTransferManager invoking request listeners
those need to be called asynchronously.

Also add a small API for that.
2014-08-26 13:50:42 +02:00
Florian Schmaus 02228702da Make XmlStringBuilder equals() CharSequence aware
The minimal condition in order to check equality in XmlStringBuilder is
that 'other' implements the CharSequence interface. Not as it was
previously, that it's also a XmlStringBuilder.

This allows junit's assertEquals() to be used (to a certain extend).
2014-08-25 13:46:05 +02:00
Florian Schmaus bbf89c65bf Fix typo in XmlStringBuilder, it's not an Angel
s/rightAngelBracket/rightAngleBracket/
2014-08-20 21:25:14 +02:00
Florian Schmaus 47ffcd8b6d Merge branch '4.0' 2014-08-20 15:29:29 +02:00
Florian Schmaus 1e5f0eb749 Make parseElementText handle empty string elements
ie. elements which only content is the empty string, for example
<body></body>.

Fixes SMACK-598
2014-08-20 15:23:52 +02:00
Florian Schmaus 6ab2bf9fe0 Also log the exception in parsePresence()
when parsing packet extensions.
2014-08-19 22:14:47 +02:00
Florian Schmaus 7277eb553a Enable more 'checkstyle' checks
AvoidStarImport
IllegalImport
RedundantImport
UpperEll
ArrayTypeStyle
GenericWhitespace
EmptyStatement
PackageDelcaration
2014-08-15 23:17:45 +02:00
Florian Schmaus 0c0737942c Make resolver-dnsjava, -minidns initializer
and OSGi components.

There is really no need to treat them different then
resolver-javax. This also allows the removal of the DNSUtil.init() method.
2014-08-11 19:39:31 +02:00
Florian Schmaus 92a6d01507 Merge branch '4.0'
Also slightly improve OfflineMessageManager.getMessages()

Conflicts:
	build.gradle
	smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
2014-08-07 16:51:03 +02:00
Florian Schmaus 6caf2cbdb5 Don't use IQReplyFilter for resource binding
as the local username is only available after binding (and legacy
session establishment). This makes Smack compatible again with XMPP
services that use the user's JID as from attribute in the result IQ
after the bind set IQ, e.g. Facebook:

SENT:
<iq id='sqvTK-1' type='set'>
  <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
    <resource>Smack</resource>
  </bind>
</iq>

RCV:
<iq from='user.name.1@chat.facebook.com' id='sqvTK-1' type='result'>
  <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
    <jid>user.name.1@chat.facebook.com/Smack</jid>
  </bind>
</iq>

Fixes SMACK-590
2014-08-04 18:01:05 +02:00
Florian Schmaus a574e1d56d Verify ConnectionConfiguration parameters
also fix javadoc error for StringUtils.isNullOrEmpty()

Fixes SMACK-539
2014-08-01 23:23:11 +02:00
Florian Schmaus 89dc3a0e85 Add smack-android and redesign SASL authentication
This commit marks an important milestone with the addition of the
smack-android subproject. Smack is now able to run native on Android
without requiring any modifications, which makes the aSmack build
environment obsolete.

It was necessary to redesign the code for SASL authentication to achieve
this. Smack now comes with smack-sasl-provided for SASL implementations
that do not rely on additional APIs like javax for platforms where those
APIs are not available like Android.
2014-08-01 10:34:47 +02:00
Florian Schmaus 49ee058c38 Cleanup carbons, forwarded and a few others API
Adopt to common design patterns in Smack:

- getFrom(Packet) in Packetextensions
- INSTANCES.put() in getInstanceFor()
- ELEMENT instead of ELEMENT_NAME
- Use XmlStringBuilder
2014-07-16 11:46:30 +02:00
Florian Schmaus e6aa2416e4 Improve MUC code
Removes a ton of duplicate code, mostly related to MUCItem being
duplicated in MUCOwner and MUCAdmin, but also some other duplicate code.

Make MUC code use XmlStringBuilder.

Add ELEMENT and NAMESPACE constants to the appropriate places. Also add
"static <MUCPacketExtension> getFrom(Packet)" methods.

Make some MUC classes implement Element.
2014-07-14 19:22:02 +02:00
Florian Schmaus b0825f73fd Fix TLSUtils.AcceptAllTrustManager
Should not throw an Exception, but instead return a zero-sized
array. Also add some javadoc.
2014-07-09 09:42:31 +02:00
Florian Schmaus bdf9a75c4f Use XmlStringBuilder in RosterPacket and XMPPError 2014-07-07 12:30:36 +02:00
Florian Schmaus ed7dc1800d Throw IllegalStateException in StringUtils.hash()
instead of Log.

Also create UTF8 and SHA1 constant.
2014-07-07 00:11:00 +02:00
Florian Schmaus e469601468 Do not hardcode the char[] length in StringUtils 2014-07-07 00:03:11 +02:00
Florian Schmaus 8b16c49a31 Remove Packet.ID_NOT_AVAILABLE 2014-07-06 23:57:06 +02:00
Florian Schmaus f671b9e781 Use CharSequence instead of String in parseContent()
and parseContentDepth(). This also means that the type of some fields
changed from String to CharSequence.

Also add Matcher for CharSequences.
2014-07-06 21:10:40 +02:00
Florian Schmaus 54b18e3575 Make XHMTMLExtensionProvider use parseElement()
which makes the whole provider much simpler.

Also use CharSequence as Base for XHTML-IM bodies.
2014-07-05 15:04:35 +02:00
Florian Schmaus 94a16ba41e Merge branch '4.0'
Conflicts:
	build.gradle
	documentation/connections.html
	documentation/gettingstarted.html
	smack-core/src/main/java/org/jivesoftware/smack/SmackException.java
	smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java
	smack-core/src/test/java/org/jivesoftware/smack/test/util/TestUtils.java
	smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java
	smack-tcp/src/main/java/org/jivesoftware/smack/tcp/PacketReader.java
2014-07-05 14:37:22 +02:00
Florian Schmaus d8d88d9abd Make XHTMLText use XmlStringBuidler
also define all element and attribute names as constants.
2014-07-05 14:19:31 +02:00
Florian Schmaus 8526f8ab29 Introduce packet.Element
Re-work filetransfer/bytestream stanza toXML() method to use
XmlStringBuilder. Move the ELEMENT and NAMESPACE definitions in the
right place, ie. the stanza class.
2014-07-05 11:59:45 +02:00
Florian Schmaus 609c225865 Add smack-resolver-minidns 2014-06-25 08:27:20 +02:00
Florian Schmaus 56222d6ee2 Improve parseContent() and parseContentDepth()
The idea is that xml-roundtrip should *never* be expected from a
XmlPullParser. So what we need is a method that parses the content of an
element without relying on getText() returning text if on START_TAG or
END_TAG. This is already done by PubSubs ItemProvider.

Also add PacketParserUtils.parseElement() which will return the current
element as String and use this method in PubSub's ItemProvider.
2014-06-20 12:07:25 +02:00
Florian Schmaus 26b5bc0212 Properly escape Bookmarks and FormField XML
by using XmlStringBuilder. Fixes SMACK-577

Also extend LazyStringBuilder with a cache. And extend XmlStringBuilder
with some more convenience methods.

Move the ELEMENT and NAMESPACE definition from Form to DataForm, where
it belongs.
2014-06-19 16:52:19 +02:00
Florian Schmaus 46f4a553e0 Add javadoc to SmackException.ConnectionException
and HostAddress
2014-06-17 13:17:15 +02:00
Florian Schmaus 02651c668f Improve HostAddress, make some members final
also
- add getException()
- improve constructor logic
2014-06-17 11:00:46 +02:00
Florian Schmaus b083449cc3 Throw more exceptions when parsing Presences
when parsing core elements of Presences.
2014-06-10 18:42:17 +02:00
Florian Schmaus 009057e2e2 Streamline String to Enum transformation
for the core stanza Enums.
2014-06-10 18:35:24 +02:00
Júlio Cesar Bueno Cotta 9be0c480e3 Change IQ.Type to enum 2014-06-06 21:10:13 -03:00
Florian Schmaus f67d655fe7 Use jxmpp-core (0.1.0-alpha1-SNAPSHOT)
fixes also SMACK-570, since jxmpp-core's XmppStringUtil contains the fix
for SMACK-570.
2014-06-01 12:24:30 +02:00
Florian Schmaus 8977f5b3f0 Improve TLS/SSL support
Add TLSUtils. Make it possible to set the enabled SSL/TLS protocols and
ciphers and provide sane error reporting.
2014-05-30 12:28:19 +02:00
Florian Schmaus 3647a7fce5 Improve parsing. Add method for de-serializing Strings
Move some duplicate code from XMPP(TCP|BOSH)Connection to
PacketParserUtils. Remove TestUtils as the method now part of Smack's
public API in PacketParserUtils.
2014-05-28 08:18:44 +02:00
Florian Schmaus 4c76f2652d Reworked OSGi support of Smack (SMACK-343)
Because of OSGi, no subproject of Smack (which is the same as a OSGi
bundle) must export a package that is already exported by another
subproject.

Therefore it was necessary to move the TCP and BOSH code into their own
packages: org.jivesoftware.smack.(tcp|bosh).

OSGi classloader restrictions also made it necessary to create a
Declarative Service for smack-extensions, smack-experimental and
smack-lagacy (i.e. smack subprojects which should be initialized), in
order to initialize them accordingly, as smack-core is, when used in a
OSGi environment, unable to load and initialize classes from other smack
bundles. OSGi's "Service Component Runtime" (SCR) will now take care of
running the initialization code of the particular Smack bundle by
activating its Declarative Service.

That is also the reason why most initialization related method now have an
additional classloader argument.

Note that due the refactoring, some ugly changes in XMPPTCPConnection
and its PacketReader and PacketWriter where necessary.
2014-05-15 16:09:37 +02:00
Florian Schmaus 98333e362d Add 'null' check to parseContentDepth
Does not fix the actual problem, but at least prevents resource
allocation until OOM.
2014-05-11 10:18:49 +02:00
Florian Schmaus e0b8577930 Make IQ attributes final in parseIQ() 2014-05-11 10:15:14 +02:00
Florian Schmaus 90ea9ba2fc Make ProviderManager static
also remove initialize() from ProviderFileLoader, by simply putting the
code into the constructor.
2014-05-11 09:27:41 +02:00
Florian Schmaus 82654cd15e Use StringBuilder in parseContentDepth()
instead of StringBuffer, which comes with unnecessary synchronization
overhead.
2014-05-10 10:53:03 +02:00
Florian Schmaus 7041e90522 Properly sync PacketWriter's queue
by using a custom ArrayBlockingQueueWithShutdown. Fixes a race condition
where nextpacket() would wait for a notification that would never
arrive, because all all put(Packet) calls are still blocking.

SMACK-560
2014-05-05 19:26:42 +02:00
Florian Schmaus 91fd15ad86 Prefix subprojects with 'smack-'
instead of using the old baseName=smack appendix=project.name approach,
we are now going convention over configuration and renaming the
subprojects directories to the proper name.

Having a prefix is actually very helpful, because the resulting
libraries will be named like the subproject. And a core-4.0.0-rc1.jar is
not as explicit about what it actually *is* as a
smack-core-4.0.0-rc1.jar.

SMACK-265
2014-04-28 19:44:14 +02:00