Commit Graph

22 Commits

Author SHA1 Message Date
Florian Schmaus 363354f237 Make DirectoryRosterStore use elements for whitespace content
If whitespace (e.g. \n \t) needs to be preserved, then XML elements
should be used instead of attributes. Since we do this now in
DirectoryRosterStore, there is also no longer a need for an
specialized StringUtils.escapeForXML().

Also introduce XmlStringBuilder, which should become the default way
to implement Packet.toXML() and the like.
2014-03-20 14:35:38 +01:00
Florian Schmaus 1bf57cb6a1 Move file related methods to FileUtils 2014-03-20 13:26:57 +01:00
Florian Schmaus d349940537 Move DNS resolving into connect()
It was misplaced in ConnectionConfiguration anyways, as the sole
instantiation of a ConnectionConfiguration should not cause any network
I/O.
2014-03-19 13:14:03 +01:00
Florian Schmaus dbab9b8995 Unify StringUtils.escapeForXML()
Rework StringUtils.escapeForXML() so that it can be used also for
StringUtils.xmlAttribEncodeBinary(). escapeForXML() now uses a
switch/case statement, which should leave the (JIT) compiler more room
for optimizations.

Removing the "do not escape unicode character references", because
this behavior, introduced with
8264ebdfb5, is incorrect.
2014-03-19 13:13:02 +01:00
Florian Schmaus a46d02ca32 Remove old Apache commons collections from codebase
ChatManager's Chat instances are now removed by Chat.close(), removing
the need for a Map with Hard to Weak references.

ChatStateManager can simply use WeakHashMap.
2014-03-17 14:47:55 +01:00
Florian Schmaus 4b56446e40 Introduce SmackException
SmackException (and it's subclasses) is for all errors/exceptions not
defined by any XMPP specification. XMPPException is now an abstract
class for all errors defined by the XMPP specifications.

Methods that involve an IQ exchange now either return the result, which
is obtained by IQ response, or they throw an XMPPErrorException if an IQ
error was the result of the IQ set/get. If there was no response from
the server within the default packet timeout, a NoResponseException will
be thrown.

XMPP SASL errors are now also reported accordingly.

SMACK-426
2014-03-14 01:46:42 +01:00
Georg Lukas d5195c4004 Update XMPPError to RFC6120
Fixes SMACK-445
2014-03-11 20:40:39 +01:00
Florian Schmaus b9f07046d3 Remove java.beans dependency
The java.beans package is not available on all platforms (e.g. Android).
2014-03-11 19:06:28 +01:00
Florian Schmaus 4fb5b85806 Re-activate all ignored unit-tests
Make all unit tests functional again.
2014-03-10 22:41:34 +01:00
Florian Schmaus b8a5437b28 Fix all javadoc warnings 2014-03-10 21:58:12 +01:00
Florian Schmaus 489816c61f Renamed Connection to XMPPConnection 2014-03-10 09:45:50 +01:00
Vyacheslav Blinov 06f88674ee SMACK-541 Fix of XHTMLExtensionProvider on Android
This fixes issue there on android in XHTMLExtension bodys contained "null" instead of actual xhtml tags
This happened due to difference in XPP implementation in KXmlPullParser (on Android) MXParser (in other cases)
This fix replaces usage of getText method of XPP with restoration of xhtml tags using XPP api.
2014-03-09 11:20:31 +01:00
Florian Schmaus 585e20e93e Rework XMPP Date/Time related code
- Fix "packet.Time is not thread-safe" (SMACK-543)
- Update packet.Time to XEP-0202

Add SDM.supportsFeature(), since this is a pattern that repeats over and
over again in Smack. Also add abstract Manager class, that takes care of
the weak reference to Connection, as this is also a repeating pattern in
Smack.
2014-03-09 11:20:31 +01:00
Lars Noschinski 57231648c8 Remove remainders of non-SASL authentication (SMACK-446) 2014-03-07 16:15:24 +01:00
Florian Schmaus 54a421e84e Make JUL Loggers final (SMACK-536) 2014-02-26 22:00:27 +01:00
Florian Schmaus 3093333533 Reworked Smack initialization
Move extension relevant configuration options from SmackConfiguration to
the extension. Introduced disabledSmackClasses that can be configured
via a system property or configuration file.
2014-02-23 17:48:07 +01:00
Florian Schmaus 352c362e90 Remove the dependency on javax.xml.transform
Not all platforms support this API (e.g. Android). Strip the
prettyPrint() method since it wasn't used anyway.

Also move XmlUtil in a more appropriate package.
2014-02-20 14:47:05 +01:00
Florian Schmaus 7bd7b3d24c Improve packet send and result collecting API
Instead of repeating the same pattern, when sending an IQ get/set packet
and collecting the response

PacketFilter filter = new PacketIDFilter(request.getPacketID()),
PacketCollector collector = connection.createPacketCollector(filter);
connection.sendPacket(reg);
IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Stop queuing results
collector.cancel();
if (result == null) {
    throw new XMPPException("No response from server.");
}
else if (result.getType() == IQ.Type.ERROR) {
    throw new XMPPException(result.getError());
}

the API got redesigned, so that the above code block can be replaced
with

Packet result = connection.createPacketCollectorAndSend(request).nextResultOrThrow();
2014-02-18 19:39:47 +01:00
Florian Schmaus d069e1be64 Normalize newlines to '\n'
Change all \r\n into unix style newlines. Add missing newlines at the
end of a file and activate the newline checkstyle module, that enforces
'\n' as newline and a newline at the end of every file.
2014-02-17 23:58:40 +01:00
Florian Schmaus 1e57f1c659 Activate checkstyle and add missing license headers
Delete also all "All rights reserved" statements, as they are
unnecessary and conflict with checkstyle's header check. Delete unused
imports.
2014-02-17 20:09:55 +01:00
Florian Schmaus 2e11470aee Code cleanup: unused imports, values, blocks, etc. 2014-02-17 08:24:10 +01:00
Florian Schmaus 201152ef42 Migrate from Ant to Gradle (SMACK-265) 2014-02-14 18:46:33 +01:00