Commit Graph

226 Commits

Author SHA1 Message Date
Chris Deering 0b4072ad66 Re-implementing the vCard provider using a pull parser. Extended unit tests. 2015-02-09 07:35:15 +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 86ea027301 Add StringUtils.requireNotNullOrEmpty and Objects.requireNonNull
and use this in a few places.
2015-01-26 20:47:09 +01:00
Florian Schmaus 2cba6a68eb Fix DataFormProvider parsing 'fixed' FormFields
b71039660b made FormField.setType(Type)
throw an illegal argument exception if type is fixed, but the
DataFormProvider was not changed, so it still would call
setType(Type.fixed).

Change DataFormProvider so that the non-argument constructer of
FormField is used when type == fixed.
2015-01-26 07:54:12 +01:00
Florian Schmaus d5b8647d9d Create smack-im subproject for XMPP-IM
Move Roster and Chat(Manager) code into their own packages within the
new smack-im subproject.

Apply Manager pattern to Roster.

Fixes SMACK-637.
2015-01-26 07:54:05 +01:00
Florian Schmaus b265d2d2a2 Add XDataManager.isSupported(String)
also make FormField and Option implement NamedElement and some other
minor changes to data form API.
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 1bc3e10cff Improve Message Delivery Receipt (XEP-184) API
add a new AutoReceiptMode enum that specifies how delivery receipt
requests are handled. Default is to send receipts if the requstor is
subscribed to the user's presence.

Also make sure that messages contain an id if a receipt request is
added to it.
2015-01-20 12:43:11 +01:00
Florian Schmaus 8409dddffd Add PacketUtil.extensionElementFrom()
and deprecate extensionElementfromCollection()
2015-01-19 08:41:21 +01:00
Florian Schmaus 6bf9498904 Add note about getMultiUserChat in MUC's javadoc 2015-01-19 08:38:11 +01:00
Florian Schmaus 440af7675a Rename SmackConfiguration.DEBUG_ENABLED to DEBUG 2015-01-19 08:26:42 +01:00
Florian Schmaus c36ffd18c2 Improve VCard API
move API out of VCard into VCardManager. Mark old methods as deprecated.
2015-01-17 11:45:02 +01:00
Florian Schmaus 2e23a6f150 Allows PacketCollector's to cancel each other
This is useful for cases where a result set is requested, as it's the
case in XEP-13 and XEP-313.

Also adds
XMPPConnection.createPacketCollector(PacketCollector.Configuration).
2015-01-16 20:55:32 +01:00
Florian Schmaus eb6b8df7c5 Add MultiUserChat.requestVoice() 2015-01-13 13:31:45 +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 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 50c7d0bc2c Don't log whole exceptions in VCardProvider
when trying to harden the parser.
2015-01-10 11:26:15 +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 82eb9b18dd Add and use AbstractConnectionClosedListener 2015-01-07 20:11:00 +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 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 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 d78b39d117 Remove ValidateElement.EmptyValidateElement
because it has the same semantic as BasicValidateElement.
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 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 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
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 019b9dc5d4 Remove unused import in bytestream Open IQ 2014-12-30 01:34:51 +01:00
Florian Schmaus ff8720698a Change muc.InvitationListner to use the MUC instance 2014-12-30 01:30:13 +01:00
Florian Schmaus 364fe12b38 Minor refactoring in DataForm.hasHiddenFormTypeField() 2014-12-28 00:14:16 +01:00
Florian Schmaus 755765120d Make FormField.Type an enum 2014-12-27 21:12:48 +01:00
Florian Schmaus 56bf54eab5 Don't use synchonrizedMap() for INSTANCES
in Managers. The getInstanceFor() method is already synchronized.
2014-12-27 20:55:30 +01:00
Florian Schmaus 2b664ee88b Improve PingManager javadoc 2014-12-26 21:29:46 +01:00
Florian Schmaus b17ecb4555 Use standard manager pattern in PingManager
- No need to use a synchronized map, as the getInstanceFor method is
  synchronized
- Put the PingManager in the map where it's created and not in the
  constructor
2014-12-26 21:25:30 +01:00