Commit Graph

2448 Commits

Author SHA1 Message Date
Florian Schmaus 780872f2ef Remove superflous throwAlreadyConnected…Exception
in XMPPTCPConnection. connectInternal() is only called by
AbstractXMPPConnection.connect() which does already invoke this method.
2015-01-26 07:54:12 +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 616768a5a9 Add smack-bosh to Android Projects
Replace SaslException with SmackException in XMPPBOSHConnection, that is
the exception which is used in XMPPTCPConnection for the same purpose.

Also make androidProjects a multi-line list.
2015-01-26 07:54:12 +01:00
Florian Schmaus 4b10f36e9e Report failed DNS SRV lookup in ConnectionException
instead of just logging a warning if the XMPP domain has no DNS SRV
lookups, create the failedAddresses list now within DNSUtil and add the
information that the SRV lookup failed.
2015-01-26 07:54:12 +01:00
Florian Schmaus 30ec2bd072 Cleanup XMPPTCPConnection, mostly exception handling
In initConnection, only initReaderAndWriter() throws IOException.

connectUsingConfiguration doesn't need to take an argument.

PacketReader.init does not throw a SmackException.

Use Async.go() in PacketWriter, just like it's already done in PacketReader.
2015-01-26 07:54:12 +01:00
Florian Schmaus d9c97fabfb Make connectUsingConfiguration more robust
If 'return' is not reached, then always throw a
ConnectionException.

Also make it clear that populateHostAddresses adds at least one address.
2015-01-26 07:54:11 +01:00
Florian Schmaus e6045c6593 Add AbstractXMPPConnection.setConcurrencyLevel(int)
Also limit the max pool size of the remove callbacks service and use the
same keep alive time for idle threads as the cached executor service
uses.

Note that it would be possible to merge those two. But this could lead
to tasks from the cached executor service blocking the removal of
callbacks, which we don't want.
2015-01-26 07:54:11 +01:00
Florian Schmaus 605c29a6fc Fix javadox in XMPPConnection 2015-01-26 07:54:11 +01:00
Florian Schmaus cbb477ebeb Add AbstractXMPPConnection.setReplyToUnkownIq(boolean)
and some javadoc related to IQ request handlers.
2015-01-26 07:54:11 +01:00
Florian Schmaus e3f1865821 Add XEP-224: Attention to the supported extensions 2015-01-26 07:54:10 +01:00
Florian Schmaus dc4720a00b Add '@Override' annotation to Roster's packet listener 2015-01-26 07:54:10 +01:00
Florian Schmaus 0581580831 Make Roster.unfiledEntries a CopyOnWriteArraySet 2015-01-26 07:54:10 +01:00
Florian Schmaus bb85d2b437 Make Roster.rosterListeners a LinkedHashSet 2015-01-26 07:54:10 +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 e722018808 Improve IQ.Type javadoc 2015-01-21 23:48:46 +01:00
Florian Schmaus dc6af6dd99 Add IQ.isRequestIQ()
and check IQ argument in IQReplyFilter.
2015-01-21 23:39:03 +01:00
Florian Schmaus 2f739662e5 Make IQ.setType(Type) throw IllegalArgumentException
when argument is 'null'.
2015-01-21 13:20:34 +01:00
Florian Schmaus 0f028fdf50 Make IQ.type private
to prevent subclasses form setting type to null.
2015-01-21 13:17:23 +01:00
Florian Schmaus 6a542824bc Add XMPPError.toString() 2015-01-21 10:02:34 +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 d97de5f42c Fix typo in DNSUtil.setIdnaTransformer 2015-01-21 09:50:50 +01:00
Florian Schmaus 607a5d0c01 Set IDNA Transformer in smack-java7 initializer 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 142f78c135 Rename Roster.getPresenceMapKey() to getMapKey()
since this method is not only used to determine the key for the
presence map, but also for the 'entries' map.

The logic is in both cases the same: If somehow an entry with an
resourcepart went into the roster (RFC 6121 does not explicity forbid
JIDs with an resourcepart in the roster), then use the full JID as
key, otherwise use the bare JID.

See also SMACK-19.
2015-01-20 12:43:18 +01:00
Florian Schmaus 9d775c8418 Fix documentation wrt FormField and DataForm Type 2015-01-20 12:43:18 +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 293f90c6c6 Add StanzaIdUtil 2015-01-19 18:51:53 +01:00
Florian Schmaus bf9fb7d2d9 Add Roster.isSubscribedToMyPresence(String) 2015-01-19 18:51:53 +01:00
Florian Schmaus b06c3e3607 Use getPresenceMapKey() in Roster.getEntry()
In order to use the bare JID as key for the entries Map if no entry for
the full JID exists already, otherwise use the full JID.
2015-01-19 18:51:47 +01:00
Florian Schmaus 8c9b3d5c62 Improve RosterPacket.ItemType javadoc 2015-01-19 16:12:16 +01:00
Florian Schmaus 1f59a755d8 Move variables into loop in Roster.waitUntilLoaded() 2015-01-19 16:11:12 +01:00
Florian Schmaus 4a5732d679 Fix Packet's javadoc
ID_NOT_AVAILABLE was removed in
8b16c49a31
2015-01-19 14:04:05 +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 f42d697d7c Consider JulDebugger as last alternative
same intention as 8bfc887f63. JUL defaults
don't "print" any log messages of level FINE (or lower).
2015-01-19 08:26:42 +01:00
Florian Schmaus 440af7675a Rename SmackConfiguration.DEBUG_ENABLED to DEBUG 2015-01-19 08:26:42 +01:00
Florian Schmaus 672d131280 Fix AbstractXMPPConnection.login() javadoc
non-SASL auth is no longer supported by Smack.
2015-01-19 08:26:41 +01:00
Florian Schmaus cb67f1d5c3 Switch 'username' paramater to CharSequence
instead of String. So that jxmpp-jids Localpart class can also be used
as argument.
Note that the username is not always the localpart!
2015-01-19 08:26:38 +01:00
Florian Schmaus 31d573753b Raise log level of InterruptedException
in SynchronizationPoint.
2015-01-18 20:44:12 +01:00
Florian Schmaus ed67ed8e11 SASL, username and password related javadoc improvements 2015-01-18 20:42:27 +01:00
Florian Schmaus 9ae66cc747 Use Exception.getString in HostAddress
instead of getMessage(), because some Exceptions, e.g. Android's
NetworkOnMainThreadException, will return null on
getMessage(). Exception.toString() does what we want, i.e. returns
- the exception class name
- and the return value of getLocalizedMessage()
2015-01-18 19:21:58 +01:00
Florian Schmaus 0bcd3d9356 Synchronize connect() and login()
Those methods being not synchronized was never an issue, but they should
mutally exclusive and not be called multiple times concurrently.
2015-01-18 11:16:12 +01:00
Florian Schmaus 4c218c96f6 Move Stream Management code into o.j.smack.sm
from o.jsmack.tcp.sm, as XEP-198 Stream Management is not an "XMPP over
TCP" exclusive feature. It could also be use together with the Websocket
binding of XMPP, so we may have a smack-streammangement in the
future. This change prepares for that by moving the SM code out of the
XMPP TCP package namespace.
2015-01-18 11:07:47 +01:00
Gligor Selimovic 79fe40bf97 Fixed Exception in packet listener Workgroup
Prevent java.util.ConcurrentModificationException by using a
CopyOnWriteArraySet.
2015-01-17 20:06:06 +01:00
Florian Schmaus 6d7f3904d9 Throw NotConnectedException on login()
if connect() was not previously called. Previously calling login() with
arguments would not check for the preconditions.

The check to throw needs to be performed in AbstractXMPPConnection
before every 'abstract login(Non)Anonymously()' call. That's the two
lines that check the preconditions are duplicated.

Also fix NPE in
XMPPTCPConnection.throwNotConnectedExceptionIfAppropriate() when
packetWrite is null (i.e. if the connection was never connected before).
2015-01-17 17:53:36 +01:00
Florian Schmaus 75fd1683d1 Fix stanzaIdAcknowledgedListeners not being called
Replace isNotEmpty(id) with isNullOrEmpty(id)
2015-01-17 14:11:21 +01:00
Florian Schmaus 25bcb6b891 Deprecate setLegacySessionDisabled(boolean) 2015-01-17 12:36:35 +01:00
Florian Schmaus 9ec7d628c8 TLSUtils.disableHostnameVerificationForTlsCertificates()
(yeah, I know)

Sometimes "a friend" has setup an XMPP service which uses a self-signed
cert. While we can get a decent amount of security by using techniques
like e.g. the MemorizingTrustManager, there's still a pitfall. If the
service's TLS certificates contains no or the wrong service/hostname
information, Smack will throw an CertificateException. Therefore provide
an API call to disable hostname verification.
2015-01-17 12:17:28 +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 2ea469be10 Add javadoc to XMPPTCPConnectionConfiguration 2015-01-17 10:34:37 +01:00