Commit Graph

2328 Commits

Author SHA1 Message Date
Florian Schmaus c682091a47 Fix SASL EXTERNAL with client cert provided JID
isAnonymous() is now a bit weakened since it also considers
allowNullorEmptyUsername.

SaslExternalMechanism of smack-sasl-provided now also doesn't throw an
UnsupportedOperationException.

Follow up on 7e4e3699a1
2015-01-13 13:31:30 +01:00
Florian Schmaus 1d83db898e Parse xml-not-well-formed as not-well-formed
for backwards compatibility.

SMACK-400
2015-01-12 13:43:35 +01:00
Florian Schmaus 47ced860ec Fix typo: s/Conditoin/Condition/ 2015-01-12 13:43:25 +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 f1a1215f35 Make DataForm type an enum 2015-01-10 20:10:46 +01:00
Florian Schmaus 98c69f6895 Add ServiceDiscoveryManager.serverSupportsFeature() 2015-01-10 19:36:33 +01:00
Florian Schmaus b71039660b Improve data form API
Add

DataForm.getField(String)
DataForm.getHiddenFormTypeField()
2015-01-10 18:05:05 +01:00
Florian Schmaus 64242ace72 Add PacketCollector.getCollectedCount() 2015-01-10 18:05:00 +01:00
Florian Schmaus e4bc6c2f37 Add support for 'ofrom' type (XEP-33)
of Extended Stanza Addressing.

Fixes SMACK-626.
2015-01-10 11:33:59 +01:00
Florian Schmaus 7e4e3699a1 Add allowEmptyOrNullUsername()
to ConnectionConfiguration.Builder().

And prepare SASL EXTERNAL for empty or null usernames.

Also clarify some parts regarding the user field.

Fixes SMACK-627
2015-01-10 11:26:15 +01:00
Florian Schmaus 50c7d0bc2c Don't log whole exceptions in VCardProvider
when trying to harden the parser.
2015-01-10 11:26:15 +01:00
Florian Schmaus 6a43bab4f5 Remove protected getConnectionListeners()
Also remove reconnectionFailed() from XMPPBOSHConnection, only
ReconnectionManager should call it.

Add and fix javadoc of ConnectionListener.
2015-01-10 11:26:10 +01:00
Florian Schmaus 8f8e0c7138 Use Async.go() in ReconnectionManager 2015-01-10 01:12:37 +01:00
Florian Schmaus 8c8ac546a9 Align thread names 2015-01-10 00:57:10 +01:00
Florian Schmaus 8e74f7faed Improve 'forward' code
Move Forwarded into forward.packet and remove deprecated methods. Also
make fields final.

Improve ForwardedProvider:
- use INSTANCE of DelayInformationProvider
- use loop label
- don't throw exceptions in certain cases, instead log
2015-01-09 11:32:00 +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 fcb4844d10 Improve DeliveryReceiptManager
Use anonymous inner classes for packet listeners so that the
processPacket() method is not exposed as part of the Managers public
API.

And some small fixes.
2015-01-08 23:15:18 +01:00
Florian Schmaus e380872a41 Add 'resumed' bool ConnectionListener's authenticated()
It's important to know if the stream was resumed. authenticated() is the
ideal callback for Managers to reset their state (e.g. cached values of
the connection state). But if the stream was resumed, the cached values
don't have to be reset.
2015-01-07 21:11:09 +01:00
Florian Schmaus 3dd1365a5a Improve Privacy List code
notably add a cache for the active and default privacy list to avoid
IQ get/response round-trips.

Also add a few methods to PrivacyListManager to get the privacy list
names. The already existing methods always returned the whole list
together with the name, which caused two round-trips.

Simplified some code.

Properly escape Privacy XML.
2015-01-07 20:54:23 +01:00
Florian Schmaus 67c0a7089b Move notifyReconnection in AbstractXMPPConnection 2015-01-07 20:11:01 +01:00
Florian Schmaus 82eb9b18dd Add and use AbstractConnectionClosedListener 2015-01-07 20:11:00 +01:00
Florian Schmaus b23c3226d2 Add MessageTypeFilter.NORMAL_OR_CHAT 2015-01-07 16:04:36 +01:00
vito-c e31b284afa Don't append closing body in XHTMLText.toString()
Also add XHTMLExtension.from(Message) and change XHTMLManager.addBody()
signature so that it expects a XHTMLText (Modifications to the original
patch by Florian Schmaus).
2015-01-07 15:00:28 +01:00
vito-c b77d61527c Add XHTMLText.appendCloseLineItemTag() 2015-01-07 14:38:38 +01:00
Florian Schmaus f6144c553c Try all Inet Addresses of the host when connecting
instead of the first resolved one.

Also some small refactorizations (e.g. getSocketFactory())
2015-01-07 14:35:23 +01:00
Florian Schmaus 717090d272 Rework incoming packet listeners and Roster
Differentiate between asynchronous and synchronous ones. Asynchronous
are the ones where the invocation order may not be the same as the order
in which the stanzas arrived.

Since it's no longer guaranteed that when a unit test calls

processPacket(stanza)

the stanza will be completely processed when the call returns, it was
necessary to extend the unit tests (mostly Roster and ChatManager) with
a packet listener that waits for his invocation. Since we now also use
LinkedHashMaps as Map for the packet listeners (SMACK-531, SMACK-424),
adding a packet listeners as last also means that it will be called as
last. We exploit this behavior change now in the unit tests.

Rename 'recvListeners' to 'syncRecvListeners' in AbstractXMPPConnection.

Rename 'rosterInitialized' to 'loaded' in Roster.

Add Roster.isLoaded().

Reset 'loaded' to false in
Roster.setOfflinePresencesAndResetLoaded() (was setOfflinePresences()).

Fixes SMACK-583, SMACK-532, SMACK-424
2015-01-07 14:35:23 +01:00
Florian Schmaus e5c6c9bdf8 Remove unused private field in Session 2015-01-07 14:35:23 +01:00
Florian Schmaus b23df7d2b8 Decrease logging verbosity in FileUtils.readFile(File) 2015-01-07 14:35:23 +01:00
Florian Schmaus 525fece291 Improved Roster(Push|Result)Listener 2015-01-07 14:35:23 +01:00
Florian Schmaus d7d4c8a4fd Use switch-case in Roster.hasValidSubscriptionType() 2015-01-07 14:35:23 +01:00
Florian Schmaus 61cc6a36da Use async packet listener in AdHocCommandManager
also some minor cleanup and logging.
2015-01-07 14:35:22 +01:00
Florian Schmaus f78a615d09 Add note about AdHocCommandManager's session sweeping 2015-01-07 14:35:22 +01:00
Florian Schmaus 9c2f6dcfbc Add IQTypeFilter.GET_OR_SET 2015-01-07 14:35:22 +01:00
Florian Schmaus d78b39d117 Remove ValidateElement.EmptyValidateElement
because it has the same semantic as BasicValidateElement.
2015-01-07 14:35:22 +01:00
Florian Schmaus c770b12348 Add log statements around socket.connect() of XMPPTCPConnection 2015-01-07 14:35:22 +01:00
Florian Schmaus a24c813ed1 Add XMPPTCPConnectionConfiguration.getConnectTimeout() 2015-01-07 14:35:22 +01:00
Christoph Fiehe 665e7914f2 Enable OSGi compliance via 'DynamicImport-Package: *'
on package layer instead of Declarative Service (DS) approach.
Restructuring and cleanup of initialization process to ensure that all
internal config files are found by the corresponding bundle
classloaders.

SMACK-343
2015-01-03 13:14:02 +01:00
Florian Schmaus 1f38e4ca0d Use new XmlStringBuilder.append(Collection<? extends Element>) in MUCUser 2015-01-02 00:14:04 +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 06add179ec Cleanup EmbeddedExtensionProvider
- Change method modifiers keyword order to JLS
- Use attributecount when creating the HashMap
- Rename 'tag' to event'
- Use diamond operator
- Use Smack formatting style
2015-01-01 17:49:52 +01:00
Florian Schmaus a87323cc33 Make casts in PubSub unnecessary 2015-01-01 17:43:17 +01:00
Florian Schmaus 5c086eeefa Add Node.getSubscriptionsAsOwner() in PubSub API
To retrieve the subscriptions of a PubSub node as owner. Fixes
SMACK-623.
2015-01-01 17:43:14 +01:00
Florian Schmaus f029b576a5 Add XMPPConnection.addAsyncPacketListener(PacketListener, PacketFilter)
and use this method in packet listeners that previously used Async.go().
2014-12-30 20:45:17 +01:00
Florian Schmaus 1d2f9749b6 Use weak ref connection in PrivacyListManager 2014-12-30 20:20:41 +01:00
Florian Schmaus ecc13e2e91 Invoke MUC invitation listener async
Basically the same fix as 191c4429da was
for file transfer listeners, just for MUC invitation listeners.
2014-12-30 20:04:29 +01:00
Florian Schmaus d6ab0cf463 Add ChatManager.createChat(String)
Also some minor refactors in Chat and changes in ChatManager.
2014-12-30 19:55:15 +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
Florian Schmaus e6593cb200 Use createMessage() where possible in MultiUserChat 2014-12-30 12:13:58 +01:00
Florian Schmaus cba681a967 Add MultiUserChat.toString() 2014-12-30 12:10:12 +01:00
Florian Schmaus ca687087d5 Remove extra whitespace in AbstractDebugger 2014-12-30 12:07:20 +01:00