Commit Graph

2448 Commits

Author SHA1 Message Date
Florian Schmaus a848437284 Make digest() in EntityCapsManager synchronized
Fixes SMACK-617
2014-11-14 21:02:18 +01:00
Florian Schmaus 4000adb70c Fallback to host if DNS SRV lookup fails
Also fix javadoc for DNSUtil, _jabber SRV records are no longer tried.

Fixes SMACK-616.
2014-11-10 21:21:44 +01:00
Florian Schmaus 69f387b344 Don't use extending stanza addressing if not strictly necessary 2014-11-10 17:37:27 +01:00
Florian Schmaus 6168fca288 Message Evenents is in smack-legacy and documentation/legacy 2014-11-10 11:43:25 +01:00
Florian Schmaus 9e797c1b17 Enable PacketExtensions for IQs
This is actually only part one, i.e. with this commit if the user adds a
PacketExtension to an IQ it will be included in IQ.toXml(). Which was
previously only the case if the IQ subclass explicitly included packet
extensions.

The second part of the change is to change the IQ provider, so that
packet extensions are automatically parsed.

Cases where PacketExtensions are used for Message and IQ are slightly
changed. The IQ sublcass now only has a field with this
PacketExtension (see for example
bytestreams.ibb.packet.DataPacketExtension).

Also changed hoxt API: Removed unnecessary indirection and made the
API more Smack idiomatic.
2014-11-10 11:43:18 +01:00
Florian Schmaus a9c798f3bb Remove empty statements 2014-11-09 18:31:07 +01:00
Florian Schmaus 77a4867450 Change Packet.getExtensionsXML()
Remove the synchronized, as getExtensions() is properly synchronized and will
return a copy.

Return XmlStringBuilder instead of CharSequence to take advantage of
fast XmlStringBuilder.append(XmlStringBuilder).

Mark the method as final, as it should not be overwritten.
2014-11-05 20:25:51 +01:00
Florian Schmaus 10643cce7c Use LinkedHashMap for PacketExtensions in Packet
to keep the order in which the elements are added.

Some XEPs define a Schema using 'xs:sequence' (see for example XEP-60 §
17.1), so the order the PacketExtensions are added should be the same
they are transformed to a XML String.
2014-11-05 17:58:32 +01:00
Florian Schmaus b9167c5fe2 Add version.gradle 2014-11-04 14:43:41 +01:00
Florian Schmaus 775477dcc7 Smack 4.1.0-alpha6-SNAPSHOT 2014-11-02 12:21:15 +01:00
Florian Schmaus aecb3cc861 Smack 4.1.0-alpha5 2014-11-02 12:13:21 +01:00
Florian Schmaus fe3dcba9b2 Fix javadoc warnings and deprecated methods 2014-11-02 12:12:56 +01:00
Florian Schmaus c351382c73 Require jxmpp 0.4.0 2014-11-02 11:24:28 +01:00
Florian Schmaus fadef7d1bf Remove ServiceDiscoveryManager.getFeaturesList()
The method was redundant, getFeatures() did already return a copy of the
features. There is also no need to make it an unmodifiable List.
2014-11-01 13:16:22 +01:00
Florian Schmaus ed313c9629 Add IntelliJ and Mac OS X files to gitignore 2014-11-01 12:52:19 +01:00
Florian Schmaus 5647cac39c Move is(Connected|Authenticated) and getUser()
into AbstractXMPPConnection.

Also remove wasAuthenticated field from XMPPBOSHConnection, it is
already in AbstractXMPPConnection.
2014-11-01 12:42:53 +01:00
Florian Schmaus 6fec813ec0 Rework DiscoverInfo
Make Feature and Identity immutable and allow fast lookup of those two
in DiscoverInfo.
2014-10-31 23:44:04 +01:00
Florian Schmaus b60b20e312 Remove unnecessary multiplication in DiscoverInfo.hashCode() 2014-10-31 20:02:50 +01:00
Florian Schmaus 5fb17dc85f Use ServiceDiscoveryManager.supportsFeature() in AMPManager 2014-10-31 20:02:44 +01:00
Florian Schmaus c1aef37081 Undeprecate Packet.getExtension(String)
as there a valid uses for it, see for example ChatStateManager:173.
2014-10-31 17:12:24 +01:00
Florian Schmaus 5fcfe548f9 Validate ProviderManager arguments 2014-10-31 00:24:26 +01:00
Florian Schmaus a3de2ecc25 Add missing GCM namespace in experimental.providers 2014-10-31 00:24:13 +01:00
Florian Schmaus 0408d075b7 Merge invokePacketCollectors() and notifiyReceivedListeners()
into invokePacketCollectorsAndNotifyRecvListeners()
2014-10-30 23:36:40 +01:00
Florian Schmaus 1de2fc2a81 Refactor Bind and Roster IQ parsing code into providers 2014-10-30 13:21:36 +01:00
Florian Schmaus 0e4196ae4b Added javadoc about extended content to PacketExtension 2014-10-30 13:21:36 +01:00
Florian Schmaus e88583d287 Use switch/case in 'IQ parse(XmlPullParser)' 2014-10-30 13:21:36 +01:00
Florian Schmaus b5daee3032 Include the full content in UnparsedResultIQ
In order to prevent

<iq to='...' from='...' type='result' id='1'>
  <mynode xmlns='my:namespace' myattr='...'>
    <somenode\>
  </mynode>
</iq>

showing up as UnparsedResultIQ like this:

<iq to='...' from='...' type='result' id='1'>
  <somenode\>
</iq>
2014-10-30 13:21:36 +01:00
Florian Schmaus e63fe22647 Add support for XEP-335: JSON Containers
and GCM JSON payloads for Google's GCM Cloud Connection Server.
2014-10-30 13:21:33 +01:00
Florian Schmaus ed66c838e1 Invoke PacketCollectors in ListenerNotification
Also make executorService a non-ScheduledExecutorService. This was an
artifact from times where executorService as used to schedule
Runnables. But now it's just used to queue the receive packets in
Runnables and call the packet collectors and listeners.
2014-10-29 19:38:45 +01:00
Florian Schmaus b73bb27463 Improve Packet javadoc 2014-10-29 14:05:38 +01:00
Florian Schmaus 6b21455b32 Asynchronous invoke Stanza Acknowledged Listeners 2014-10-29 10:18:08 +01:00
Florian Schmaus ac41fda1e5 Add Stream Management javadoc
- rename idStanzaAcknowledged to stanzaIdAcknowledged
- introduce smWasEnabledAtLeastOnce and throw
  StreamManagementNotEnabledExceptions
- enable SM is SM resumption is enabled
2014-10-29 10:06:33 +01:00
Florian Schmaus 92bc3452da Handle spurious interrupts in XMPPTCPConnection
Also remove unnecessary done() check in nextStreamElement() and remove
wrong comment in !instantShutdown branch. There is no mechanism to
forcible close the socket.
2014-10-28 15:11:48 +01:00
Florian Schmaus 765e83ca81 Send a final SM Ack on shutdown() 2014-10-28 15:11:48 +01:00
Florian Schmaus 65ccec995e Add XMPPTCPConnection.sendSMAcknowledgement 2014-10-28 15:11:48 +01:00
Florian Schmaus d60b63a89a Remove hashCode/equals from Message and Packet
Those where never correctly implemented and are not really used. If you
want to compare Packets, compare their toXML() result.

N.B. that we keep hashCode/equals for Message.(Subject|Body) because
those are correct and are in-use ('bodies' and 'subjects' are Sets in
Message).
2014-10-28 15:11:48 +01:00
Florian Schmaus 416f42deb7 Make fields in Packet and Message final 2014-10-28 15:11:48 +01:00
Florian Schmaus f94f7590a6 Store packet extensions in a HashMap
allowing O(1) lookups for PacketExtensions

The one EntityCapsManagerTest becomes obsolete with this change, as
duplicate extension elements (RFC 6120 § 8.4) are now no longer possible
after the stanza has been parsed (they still may be received on the
wire, but only the last duplicate will be added).
2014-10-28 15:11:43 +01:00
Florian Schmaus 9f56842ee4 Notify packet sending listeners in new thread
sendListeners are now invoked *after* the packet has been put on the
wire.

Also sending listener exceptions are not catched and not only
NotConnectedExceptions. And a exception does not cause a 'break' but a
'continue' now. Log level is WARNING now.
2014-10-25 16:35:58 +02:00
Florian Schmaus 51d84647f3 s/connection()/connection/ in PingManager 2014-10-24 12:59:41 +02:00
Florian Schmaus 53bba50f91 Call pingServerIfNecessary in new thread
in order to prevent the BroadcastReceiver from timing out.

To prevent:

10-24 10:59:35.096 W/BroadcastQueue( 1044): Timeout of broadcast BroadcastRecord{43400df0 u0 org.igniterealtime.smackx.ping.ACTION} - receiver=android.os.BinderProxy@42d37cc0, started 60000ms ago
10-24 10:59:35.096 W/BroadcastQueue( 1044): Receiver during timeout: BroadcastFilter{42cee7b0 u0 ReceiverList{42cfd9f0 16003 org.projectmaxs.transport.xmpp/10149/u0 remote:42d37cc0}}

10-24 10:59:38.201 E/ActivityManager( 1044): ANR in org.projectmaxs.transport.xmpp
10-24 10:59:38.201 E/ActivityManager( 1044): PID: 16003
10-24 10:59:38.201 E/ActivityManager( 1044): Reason: Broadcast of Intent { act=org.igniterealtime.smackx.ping.ACTION flg=0x14 (has extras) }
10-24 10:59:38.201 E/ActivityManager( 1044): Load: 18.97 / 31.7 / 45.71
10-24 10:59:38.201 E/ActivityManager( 1044): CPU usage from 20588ms to 0ms ago:
10-24 10:59:38.201 E/ActivityManager( 1044):   0.4% 1044/system_server: 0.2% user + 0.1% kernel / faults: 188 minor 1 major
10-24 10:59:38.201 E/ActivityManager( 1044):   0.4% 9089/kworker/0:3: 0% user + 0.4% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0.1% 1567/mpdecision: 0% user + 0.1% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0.1% 28507/kworker/u:5: 0% user + 0.1% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 7/kworker/u:0H: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 148/mmcqd/0: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 14687/com.teslacoilsw.launcher: 0% user + 0% kernel / faults: 6 minor
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 3/ksoftirqd/0: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 1111/MC_Thread: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 1135/wpa_supplicant: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 1283/com.android.phone: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 11469/com.getpebble.android: 0% user + 0% kernel / faults: 1 minor
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 14971/com.google.android.apps.unveil: 0% user + 0% kernel / faults: 6 minor
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 28677/watch_server: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   0% 31539/kworker/0:2: 0% user + 0% kernel
10-24 10:59:38.201 E/ActivityManager( 1044): 1.2% TOTAL: 0.4% user + 0.5% kernel + 0.2% iowait
10-24 10:59:38.201 E/ActivityManager( 1044): CPU usage from 2536ms to 3060ms later:
10-24 10:59:38.201 E/ActivityManager( 1044):   9.2% 1044/system_server: 1.8% user + 7.4% kernel / faults: 56 minor
10-24 10:59:38.201 E/ActivityManager( 1044):     5.5% 1058/ActivityManager: 0% user + 5.5% kernel
10-24 10:59:38.201 E/ActivityManager( 1044):   1.3% 23415/kworker/0:1H: 0% user + 1.3% kernel
10-24 10:59:38.201 E/ActivityManager( 1044): 0% TOTAL: 0% user + 0% kernel + 0% iowait
10-24 10:59:38.208 I/ActivityManager( 1044): Killing 16003:org.projectmaxs.transport.xmpp/u0a149 (adj 0): background ANR
2014-10-24 11:45:28 +02:00
Florian Schmaus 10cca256c6 Remove unnecessary code in Message 2014-10-24 11:45:22 +02:00
Florian Schmaus ce8ccf3647 Make Message and Presence class final
In order to prevent users from trying to subclass those two, trying to
add their custom attributes (or attribute values) in the element of
those two, instead of using extension elements aka. PacketExtension.

See

- http://stackoverflow.com/q/26516386/
- http://stackoverflow.com/q/26507753/
- http://stackoverflow.com/q/26542601/
2014-10-24 11:14:41 +02:00
Florian Schmaus 25887e3427 s/SmackTcpSmackInitalizer/SmackTcpSmackInitializer/
This prevented Stream Management from working as the
StreamFeatureProvider was not loaded.

The typo existed from 46a4402a69 up to this
commit.
2014-10-23 17:42:54 +02:00
Florian Schmaus 177ab983d4 Merge branch '4.0'
Conflicts:
	build.gradle
	smack-tcp/src/main/java/org/jivesoftware/smack/tcp/PacketReader.java
2014-10-22 22:25:20 +02:00
Florian Schmaus 1ade4cbc64 Smack 4.0.6-SNAPSHOT 2014-10-22 22:21:04 +02:00
Florian Schmaus 04446e54db Smack 4.0.5 2014-10-22 22:11:07 +02:00
Florian Schmaus 674df78741 Fix parsing exception causing infinite loop
Fixes SMACK-613
2014-10-22 20:00:05 +02:00
Florian Schmaus 5f9c342f7e Don't check for END_DOCUMENT parsePackets()
instead use the event switch/case and log a warning if this ever
happens, as it's likely a programming error.
2014-10-21 23:44:39 +02:00
Florian Schmaus e090067358 Use switch/case instead if/else-if in parsePackets() 2014-10-21 23:37:37 +02:00