Commit Graph

432 Commits

Author SHA1 Message Date
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 f05b208120 Remove some duplicate IQ code
and some dead code in Socks5PacketUtils.
2014-07-04 23:51:00 +02:00
Florian Schmaus afd1f6bc36 Remove some duplicate code from smackx.filetransfer
packet.IQ provides all the utility functions we need. An extension should
never (re-)implemented it's own core functionality.
2014-07-04 23:17:15 +02:00
Florian Schmaus 09425609af Refactor FileTransfer(Manager|Negotiator)
to use WeakHashMaps and extend Manager.

SMACK-579
2014-07-02 09:52:40 +02:00
Florian Schmaus fdaf7940fb Remove decorators for "Legacy Delayed Delivery"
(aka. XEP-91) in favor of Delayed Delivery (XEP-203)

SMACK-578
2014-07-01 23:29:45 +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 2ce7656180 Fix PrivateDataResult.getChildElementXML()
that method never worked correctly since 11 years, ie. the PrivateData
was never added as element text. It's not surprisingly that this was not
discovered in more then a decade, since Smack usually never *sends*
those stanza but only receives them.

But that's no reason to not fix it. :)
2014-06-19 16:52:19 +02:00
Florian Schmaus eec0df386c s/JEP/XEP/
also s;jabber.org/jeps;xmpp.org/extensions;
2014-06-14 11:48:46 +02:00
Florian Schmaus 273c2d7da9 Fix PingManager, use 'nextPingIn' to schedule
pings, instead of 'pingInterval'. Fixes SMACK-575.
2014-06-12 18:43:51 +02:00
Florian Schmaus fe51a17324 MessageEventManager's PacketFilter should ignore error type messages
Fixes SMACK-573
2014-06-10 18:56:50 +02:00
Florian Schmaus 92bf90d059 Use new PacketExtensionFilter constructor
in OfflineMessageManager
2014-06-10 18:54:53 +02:00
Florian Schmaus 3e18a23e47 Merge branch '4.0'
Conflicts:
	build.gradle
	smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
2014-06-07 12:24:51 +02:00
Júlio Cesar Bueno Cotta 9be0c480e3 Change IQ.Type to enum 2014-06-06 21:10:13 -03:00
Florian Schmaus 36a86f2dfc Improve getMultipleRecipientServiceAddress
and MultipleRecipient (XEP-33) related code in general (e.g. use
constants where possible).

For getMultipleRecipientServiceAddress() this means that
- the "synchronized (services)" block is removed
- ServiceDiscoveryManager is only retrieved once
2014-06-05 15:38:27 +02:00
Florian Schmaus 0680553ef7 Make getMulitipleRecipientServiceAddress() more robust
the method should not throw if one of server's items fail to query.
2014-06-05 15:16:46 +02:00
Florian Schmaus 8bf30b960c Don't remove the MUC listeners after a disconnect
keep state of XMPPConnection between disconnects.

Fixes SMACK-571
2014-06-02 16:58:53 +02: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 8cc2a76e7f Refactor Message Event (XEP-22) code to current design 2014-05-29 21:04:56 +02:00
Florian Schmaus c3ae73472e Do not filter groupchat messages without body
for MessageListeners in MultiUserChat

SMACK-568
2014-05-29 17:49:52 +02:00
Florian Schmaus 2a091debc1 Add FlexiblePacketTypeFilter
and make constructors of MessageTypeFilter and IQTypeFilter
private, because we now provide constants instead.
2014-05-29 17:45:32 +02:00
Florian Schmaus 6fd4bb850e Remove schedule() from XMPPConnection interface
The idea that we abstract the scheduling of tasks on Android over this
method turned out to be unnecessary. schedule() was also not really part
of the *public* XMPPConnection API, so it's good that it's gone.
2014-05-28 08:18:45 +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 beecb8a675 Make XMPPConnection an interface
create AbstractXMPPConnection.
2014-05-28 08:18:41 +02:00
Florian Schmaus 6dd180e9d3 Improve Entity Capabilities code
Most importantly, rename reload() method of persistent cache to
"DiscoverInfo lookup(String nodeVer)" and lazily load the data from the
persistent cache to the memory cache.
2014-05-25 17:56:32 +02:00
Florian Schmaus d790db5729 Don't throw an IOException if IBBStream got closed by the remote
Smack should not throw an IOException in case a stream got closed by
the remote peer and the user is trying to read() from the stream. This
commit fixes that, by making Smack return '-1' if the stream got
closed by the remote. An IOException will only be thrown if the user
tries to read from a stream that got already closed by *himself*.

SMACK-468
2014-05-23 13:13:24 +02:00
Florian Schmaus a19181ce04 Make XMPPConnection.schedule() protected
This method was never intended to be part of the public API. It's also
critical that the given Runnables complete within a reasonable
time frame so that they don't block following ones.
2014-05-23 13:13:24 +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 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 7a5533c823 Fix NPE in DiscoverInfo.Identities XmlStringBuilder
The 'name' attribute of an service discovery identity is
optional. Thanks to Jens Offenbach for reporting.
2014-05-07 12:46:24 +02:00
Florian Schmaus 2375c59791 Extend JivePropertiesManager
with getPropertiesNames() and getProperties()
2014-04-28 20:23:26 +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