1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-05 08:05:58 +01:00
Commit graph

71 commits

Author SHA1 Message Date
Florian Schmaus
c2b214f8d8 Remove reply timeout from RemoteCommand
it was unused because of the value from nextResultOrThrow() was used
anyways (which uses the default of the connection instance).
2014-04-23 10:08:54 +02:00
Florian Schmaus
069e7d7e60 Use connection specific reply timeout value
instead of the global default one.
2014-04-23 10:08:51 +02:00
Florian Schmaus
439f4cd291 Use volatile instead of synchronized
in LastActivityManager.
2014-04-23 09:43:48 +02:00
Florian Schmaus
865168688d Fix PrivateDataManager getInstanceFor() always returns null 2014-04-22 21:36:05 +02:00
Florian Schmaus
bd5ceded37 Provide a MUC method to create *or* join a room
MulitUserChat.create() will throw an SmackException if the MUC service
does not return a 201 status when entering a room. Some MUC
implementations don't return the 201 status but instead behave like
the room already existed.

If the user doesn't care about the room beeing locked until the
initial configuration has been send, he can now use the new
MutliUserChat.createOrJoin(String) method.

Also remove some duplicate code by creating the private enter() method.

Fixes SMACK-557
2014-04-17 12:14:35 +02:00
Florian Schmaus
0136c3eb81 Return List instead of Collection where appropriate 2014-04-14 14:09:53 +02:00
Florian Schmaus
61fd3c9dd0 Add FromMode regarding 'from' attribute of outgoing stanzas
XMPP Servers should ignore the 'from' attribute of outgoing
stanzas. Makes the behavior how Smack populates the 'from' attribute of
outgoing stanzas configurable. Fixes SMACK-547
2014-04-14 11:01:26 +02:00
Florian Schmaus
4cff008708 Return Collections (or sublcasses) instead of Iterators
This allows us to exploid Java 8 streams and Java 5 for-each
loops. The returned Collections are usually unmodifiable. We decided
against returning Iterable because this would mean determining the
size in O(n) compared to Collection.size() which is often faster
(e.g. O(1)).
2014-04-09 20:03:10 +02:00
Florian Schmaus
6ea1d65e73 Remove star imports in VCardProvider 2014-04-09 20:03:10 +02:00
Florian Schmaus
f33b9f08d4 VCardProvider should treat tel code element optional
SMACK-555
2014-04-09 20:03:10 +02:00
Georg Lukas
ab70cfec24 Refactoring: All connection classes begin with XMPP now
This commit renames classes as follows:
 * TCPConnection --> XMPPTCPConnection
 * BOSHConnection --> XMPPBOSHConnection

There are two reasons for this rename. First, it is there to indicate
that the classes actually _are_ XMPP connections, using different
transport mechanisms. Second, it makes auto-completion in IDEs easier,
the developer can type XMPP<complete> and choose the right backend.
2014-04-09 20:03:07 +02:00
Florian Schmaus
0c29fdb769 Use WeakHashMap in BookmarkManager and PrivateDataManager
Also remove the "other user" constructor fo PrivateDataManager, as
this feature is not specified by XEP-49.

Fixes SMACK-554
2014-04-04 11:55:06 +02:00
Florian Schmaus
ef43ba6322 Fix or suppress warnings 2014-04-03 23:06:26 +02:00
Florian Schmaus
d8a5610d7b Use Locale.US when doing String operations
on machine readable output. The default locale may not provide the
wanted mapping. See also
http://developer.android.com/reference/java/util/Locale.html#default_locale

SMACK-467
2014-04-03 22:50:13 +02:00
Florian Schmaus
246e7b85f8 Use connection's reply timeout value in MultiUserChat 2014-04-03 10:58:50 +02:00
Florian Schmaus
665d65836c Cleanup of pingMyServer() API
only throw NotConnectedException, otherwise return false. Before as
some sort of exception was always thrown in the error case.
2014-03-28 16:20:09 +01:00
Florian Schmaus
c4f86762cb Reworked DiscoverInfo and DiscoverItems
- Change the return type from Iterator to List
- Remove the synchronized blocks
2014-03-28 14:46:30 +01:00
Florian Schmaus
cc026a7e85 Raise source compatibility to 1.7 (Java7)
Now that Java 8 is released, it's time to raise Smack's source
compatibility. Let's also use some of the "new" Java 7 features like
"catch multiple".
2014-03-24 19:23:06 +01:00
Florian Schmaus
18d0dbdc5f Fix Socks5BytestreamManager.determineProxies()
We need to catch XMPPErrorException and *NoResponseException* and
blacklist those entities.
2014-03-23 14:57:18 +01:00
Florian Schmaus
010a86444a Streamline LastActivity API, add enable/disable
Allow LastActivity to be enabled/disabled. The API is now similar to the
ones of the other Managers. Added unit tests.
2014-03-23 14:19:05 +01:00
Florian Schmaus
978f692eb0 Use XmlStringBuilder in most toXML() bodies
Also change StringUtils.escapeForXML() and Packet.toXML() to return
CharSequence instead of String. XmlStringBuilder now has 'optX' methods.

Remove XmlUtils in favor of XmlStringBuilder
2014-03-22 16:59:15 +01:00
Florian Schmaus
fcc8414a92 "not connected" is now a checked Exception thrown by sendPacket()
There is a unsolveable race condition between the connection state and
sendPacket(), i.e. the connection could go down, right after the
method calling sendPacket is called, but before sendPacket() is
invoked. Before this change, sendPacket() has thrown an unchecked
IllegalStateException, which could be ignored by the Smack user, who
would also not notice the race condition. We have decided to throw a
checked Exception in this case now, to make the Smack user aware of
this situation.

SMACK-426
2014-03-19 15:56:41 +01:00
Florian Schmaus
c592b4f046 Improve Exceptions (SMACK-426) 2014-03-19 09:00:10 +01:00
Florian Schmaus
ae64b0ad4b Fix javadoc in MUCInitialPresence.History 2014-03-19 09:00:10 +01:00
Florian Schmaus
91f0a091df Fix javadoc warning in xdata.Form 2014-03-19 09:00:10 +01:00
Florian Schmaus
4db967079f getInstanceFor() for ChatManager and AccountManager 2014-03-19 08:59:45 +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
64e7b8a868 Move getRoster() to XMPPConnection
Also remove the Exceptions from the signature of getRoster().

Extend ConnectionListener with connected() and authenticated()
callbacks, required by Roster to be notified so that the Roster can be
loaded *after* login.
2014-03-15 11:21:49 +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
67722aea93 Fix typo: s/interna_server_error/internal_server_error/ 2014-03-11 19:30:55 +01:00
Florian Schmaus
7341421ca9 Announce support for vcard-temp/XEP-54
Add VCardManager to setup the vcard-temp feature. Fixes SMACK-414.
2014-03-11 19:18:08 +01:00
Florian Schmaus
d8a8f79701 Cleanup of deprecated methods (SMACK-432) 2014-03-11 19:04:25 +01:00
Florian Schmaus
bd6828db38 Make EntityCapsManager's node version configurable
Also some cleanup of caps code.
2014-03-11 09:20:55 +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
0058631ed6 AMP should use provider/packet packages and JUL
- Move AMPExtensionProvider to amp.provider
- Move AMPExtension to amp.packet
- Move java.util.logging for logging

SMACK-544
2014-03-10 17:03:07 +01:00
Florian Schmaus
6110872062 Cleanup of PrivacyList API
Use Type enum instead of String for PrivacyItem's constructor. Add
getName() to PrivacyList. Remove PrivacyRule, as it just adds unnecessary
complexity spliting PrivacyItem and PrivacyRule, they belong
together. Don't mix camel-case and c-style method names. Some minor
improvements. Add parser test.
2014-03-10 15:32:17 +01:00
Florian Schmaus
489816c61f Renamed Connection to XMPPConnection 2014-03-10 09:45:50 +01:00
Florian Schmaus
f7fc38e1f4 Refactor Managers to subclass abstract Manager
Also use ServiceDiscoveryManager.supportsFeature() where possible.
2014-03-09 14:59:45 +01:00
Florian Schmaus
93eea8ab8d Move gradle subproject configuration into the subproject 2014-03-09 14:59:45 +01:00
Lars Noschinski
86a4bfa43f Remove deprecated constructor for FromMatchesFilter (SMACK-71) 2014-03-09 11:20:32 +01:00
Georg Lukas
62de78ef7c SMACK-53: create VersionProvider and VersionManager
The VersionProvider is used to parse Version IQs. Integration:

	providerManager.addIQProvider("query", Version.NAMESPACE, new VersionProvider());

The VersionManager is used to reply to Version IQs. Integration:

	VersionManger.getInstanceFor(connection).setVersion(
		new Version("App Name", "1.23", "Operating System"));
2014-03-09 11:20:31 +01:00
Vyacheslav Blinov
61bf5cd4ce Advanced Message Processing implementation (XEP-0079)
Fixes SMACK-544
2014-03-09 11:20:31 +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
Florian Schmaus
768700b301 Move Roster Item Exchange code to legacy project
XEP-93 has been deprecated and superseded by XEP-144.
2014-03-09 11:20:30 +01:00
Florian Schmaus
fa289eac04 Migrated Roster Item Exchange to new manager design
The finalize approach was flawed anyway, it would have never been
called. Because if the packetListener was still referenced from a
connection, and the connection was still strong referenced, then a
strong reference from a gc root would still exists to the manager, which
would prevent it from being gc'ed and finalized being called.
2014-03-09 11:20:30 +01:00
Florian Schmaus
84a3fd7bd9 s/XMPPConnection/TCPConnection 2014-03-09 11:20:30 +01:00
Lars Noschinski
6c7296a37b Add and use IQReplyFilter (SMACK-533)
In the absence of checks on the from address, it is possible for other
clients to fake an answer to an IQ request.

This commit adds an IQReplyFilter, which drops all packets which are not
a valid reply to an IQ request. In particular, it checks for packet id,
from address and packet type.

Most(?) places waiting for a reply to an IQ request are converted to use
the IQReplyFilter.

For a discussion of the issues, see the thread "Spoofing of iq ids and
misbehaving servers" from 2014-01 on the jdev@jabber.org mailing list
and following discussion in February and March.
2014-03-07 16:13:07 +01:00