1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-16 09:12:06 +01:00
Commit graph

2865 commits

Author SHA1 Message Date
Florian Schmaus
36da216b4a Reworked Interceptor and InterceptorWrapper
Allows interceptor to remove themselves in the interceptPacket() method.

Same change for Interceptors as was done in
15d59299a2 for (send|recv)Listeners.
2014-10-10 12:22:23 +02:00
Florian Schmaus
c3528d082e Add invokePacketCollectors, remove duplicate code
Add javadoc about why we use CocurrentLinkedQueue for collectors.
2014-10-10 02:41:37 +02:00
Florian Schmaus
15d59299a2 Reworked (send|recv)Listeners, ListenerWrapper
instead of rely on ListenerWrapper checking the PacketFilter *and*
invoking the PacketListener we now use two for-each loops, where the
first filters the PacketListeners that should get invoked and use the
second for-each loop to actually invoke the PacketListener.

Before, the code was not thread safe if a PacketListener would remove
itself from the (send|recv)Listeners.

Also make packet(Listener|Filter) in ListenerWrapper final.
2014-10-10 00:44:51 +02:00
Florian Schmaus
03686fbaaf Use CopyOnWriteArraySet for connectionListener 2014-10-09 23:55:02 +02:00
Florian Schmaus
6dcba44557 Make PacketCollector fields final where possible 2014-10-09 23:51:33 +02:00
Florian Schmaus
36744ea0d1 Remove MUC DeafOccupantIntercepter
as it's a old (likely unused) Jive (Wildfire) proprietary extension.
2014-10-09 23:12:22 +02:00
Florian Schmaus
328b733f7e Don't use gradle 'configurations' in smack-core
Fixes SMACK-587
2014-10-09 19:53:53 +02:00
Florian Schmaus
ade6d528e8 Eclipse formatter: Set line length to 120
Also add new settings for Java8 features (currently not used in Smack,
as it is Java7 or higher).
2014-10-08 16:01:19 +02:00
Gilles Cornu
bd06e07065 Travis CI: Use Android builder 2014-10-08 16:01:19 +02:00
Florian Schmaus
452b2aca0f Add 'PacketParserUtils.addPacketextension()' 2014-10-08 16:01:19 +02:00
Florian Schmaus
6980c8e63d Rework Smack Provider design
this is the first stop towards fixing "SMACK-65: parsing should look for
depth", by providing the initial parsing depth to the provider. Some
methods (.e.g parseMessage) now use the depth as abort condition,
instead of a unclean String equals check.

parseIQ() and parseExtension() where both renamed to parse.

This also restricts the Exceptions thrown by the parse method, to just
XmlPullParserException, IOException and SmackException (not really a big
victory, but nevertheless a slight improvement).

StreamFeatureProvider is now gone, we simply use PacketExtensionProvider
for stream features.
2014-10-08 16:01:14 +02:00
Florian Schmaus
d04517cd08 Add message String to all SmackExceptions
SMACK-599
2014-10-07 21:50:39 +02:00
Florian Schmaus
387be5bded Add DeliveryReceiptRequest.addTo(Message) 2014-10-07 21:50:32 +02:00
Florian Schmaus
19ee9f016b Use CopyOnWriteArraySet in DeliveryReceiptManager 2014-10-05 16:27:52 +02:00
Florian Schmaus
8bf74c6e92 Add Packet to onReceiptReceived parameters
in ReceiptReceivedListener. SMACK-582
2014-10-05 12:56:32 +02:00
Florian Schmaus
1e803ab29d Use from(Packet) instead of getFrom(Packet) in DeliveryReceiptManager 2014-10-05 12:52:19 +02:00
Florian Schmaus
5f06234149 Use CopyOnWriteArraySet in InvitationsMonitor 2014-10-05 12:46:51 +02:00
Florian Schmaus
ccdd94c997 Add check if ANDROID_HOME is set to build.gradle 2014-10-05 12:40:33 +02:00
Florian Schmaus
b6285679cd Remove trailing comma in ConnectionException message
Also add SmackExceptionTest
2014-10-05 12:19:33 +02:00
Florian Schmaus
f7517ab6cc Apply Manager pattern to InvitationsMonitor
Don't remove listeners on disconnect (SMACK-571).
2014-10-05 12:04:46 +02:00
Florian Schmaus
a0fe337bcd Use Collections.emptyList() in MultiUserChat 2014-10-05 12:04:46 +02:00
Florian Schmaus
8529d1463f Use from(Packet) instead of getFrom(Packet) in MultiUserChat 2014-10-05 12:04:45 +02:00
Florian Schmaus
0fea113c8f Smack 4.1.0-alpha4-SNAPSHOT 2014-10-05 12:04:45 +02:00
Florian Schmaus
dd39f5643d Smack 4.1.0-alpha3 2014-10-04 18:28:24 +02:00
Florian Schmaus
414db1ebbe Add PingManager.pingMyServer(boolean,long) 2014-09-30 13:09:09 +02:00
Florian Schmaus
a942863ffe Move saslFeatureReceived check in connect()
so that APIs that need a fully connected but not yet authenticated
connection (e.g. AccountManager) can use the connection after connect()
returns.

Also move "connected = true" after saslFeatureReceived check, as if the
check would throw, the boolean would still be 'true' resulting in an
inconsistent state.

Otherwise this could result in

D/SMACK﹕ SENT (12): <stream:stream xmlns='jabber:client' to='*server*' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
D/SMACK﹕ SENT (12): <iq id='miS03-37' to='*server*' type='get'><query xmlns='jabber:iq:register'></query></iq>
D/SMACK﹕ RCV (12): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='4280133582' from='*server*' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism >DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='a4WL1hRFRX38OouQz3okC+ayK2o='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>
D/SMACK﹕ SENT (12): <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls>
D/SMACK﹕ RCV (12): <iq from='*server*' id='miS03-37' type='result'><query xmlns='jabber:iq:register'><instructions>Choose a username and password to register with this server</instructions><username></username><password/></query></iq>
D/SMACK﹕ SENT (12): <iq id='miS03-39' to='*server*' type='set'><query xmlns='jabber:iq:register'><password>s0r73pgojeopmssjaairu6kcmk3v4l</password>< username>nqcjloj4v6uk52bug16hrrhspfanlr</username></query></iq>
D/SMACK﹕ RCV (12): <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
W/AbstractXMPPConnection﹕ Connection closed with error
    javax.net.ssl.SSLException: Connection closed by peer
            at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
            at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.ja va:405)
            at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.<init>(OpenSSLSocket Impl.java:661)
            at com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.ja va:632)
            at org.jivesoftware.smack.tcp.XMPPTCPConnection.initReaderAndWriter(XMPPTCPConnect ion.java:661)
            at org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnecti on.java:768)
2014-09-29 20:06:48 +02:00
Florian Schmaus
7521ef951a Ensure that connection is authenticated in PingManager 2014-09-29 17:04:18 +02:00
Florian Schmaus
50e068b6a7 Merge branch '4.0'
Conflicts:
	build.gradle
2014-09-29 14:00:48 +02:00
Florian Schmaus
039fac7ab7 Fix PingManager.ping(String,long)
ignoring timeout. SMACK-609
2014-09-29 13:52:13 +02:00
Florian Schmaus
6c892fec96 Fix StringIndexOutOfBoundsException in ConnectionException 2014-09-29 08:58:39 +02:00
Florian Schmaus
aa90cfadc5 Smack 4.1.0-alpha3-SNAPSHOT 2014-09-27 20:09:58 +02:00
Florian Schmaus
4d7b1cd53b Smack 4.1.0-alpha2 2014-09-27 19:50:02 +02:00
Florian Schmaus
29d5ca68ce Update the (second) flattr link in README.md 2014-09-27 17:18:19 +02:00
Abmar Barros
ae385e6b44 Enabling additional and returned extensions in getItems() 2014-09-26 16:56:08 +02:00
Florian Schmaus
47dd63e6b2 Don't use instanceof in a parse(IQ|PacketExtension)
Instead of using instanceof *every time* we parse an IQ or
PacketExtension, we now check the type of the Provider only once when
adding it.
2014-09-26 10:45:25 +02:00
Florian Schmaus
7977f119e8 Update flattr link in README.md 2014-09-26 10:45:25 +02:00
Florian Schmaus
9580784bbf DisabledSmackClasses now also take package names
So that whole packages can be disabled.
2014-09-25 09:42:55 +02:00
Florian Schmaus
b0f774a2cf Ensure that Smack is initialized when calling ProviderManager 2014-09-24 22:50:46 +02:00
Florian Schmaus
13f4f36995 Use non-deprecated method in DelayInformationManager 2014-09-24 19:23:49 +02:00
Florian Schmaus
b945e591ff Add MessageWithBodies and DelayedStanza Filter 2014-09-24 19:23:49 +02:00
Florian Schmaus
b81c00d340 Add message String to ConnectionException 2014-09-24 13:34:25 +02:00
Florian Schmaus
7219f4b90c Make smack-android-extensions depend on smack-android
so that Users that want Smack on Android with Smack Extensions just have
to depend on smack-android-extensions.
2014-09-24 12:48:01 +02:00
Florian Schmaus
bfebf6a4a5 Add ServerPingWithAlarmManager to smack-android 2014-09-22 10:13:33 +02:00
Florian Schmaus
d8c77de785 Remove duplicate code in pubusb LeafNode
Make fields of GetItemsRequest and NodeExtension final and use
XmlStringBuilder.
2014-09-21 20:49:11 +02:00
Florian Schmaus
bd0fb973c8 Add new RSMSet constructors
and fix typo in RSMSetManager
2014-09-20 16:54:36 +02:00
Florian Schmaus
5a9e353f2c Filter sun.security.* from smack-java7 Import-Package
Quoting Jens Offenbach:
"The header entry [sun.* in Import-Package] MUST be removed because
its a native package and not exported by the OSGi framework. The bundle
cannot be resolved. It is up to the OSGi framework deployer to declare
this package as beeing "bootdelegated". This tells the classloader of
the bundle to delegate a corresponding package request to the installed
JRE. Only remove this entry and leave the "magic" of resolution to OSGi"

SMACK-343
2014-09-20 13:22:34 +02:00
Florian Schmaus
b78a711ebd Add support for XEP-0352: Client State Indication
SMACK-607
2014-09-19 23:52:14 +02:00
Florian Schmaus
a2ffaeca1f Make smack-android/smack-java7 declare minimal dependencies 2014-09-19 11:27:40 +02:00
Florian Schmaus
37eeb07376 Add smack-java7 declarative service
So that everything is correctly initialized. Otherwise we get an NPE
like:

02:55:01 PM SENT (242792115): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'>=</auth>
02:55:01 PM RCV  (242792115): <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImVjLXhtcHAiLG5vbmNlPSJyWWpCYj Znc1I4WUVKZXNZUXV2bXBFQWNoRVVGRGowTnJnUFcxRjFmIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLT gsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
org.jivesoftware.smack.SmackException$NoResponseException
    at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 247)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection.login(XMPPTCPConnection.java:374)
    ...
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.ja va:932)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.ja va:1)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
    at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
    at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)
    at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
    at com.foobar.mgmt.tree.xmpp.skeleton.impl.activator.Activator.start(Activator.ja va:33)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextI mpl.java:711)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(Bundl eContextImpl.java:702)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextI mpl.java:683)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java :381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.j ava:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java: 1176)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartL evelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartL evelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelMa nager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(Star tLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartL evelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartL evelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.jav a:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.j ava:340)
Sep 18, 2014 2:55:06 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener
Warnung: Connection closed with error
java.lang.NullPointerException
    at org.jivesoftware.smack.util.stringencoder.Base64.decode(Base64.java:87)
    at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java: 206)
    at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication. java:325)
    at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication. java:310)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1105)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:969)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:988)

SMACK-343
2014-09-19 09:48:28 +02:00
Florian Schmaus
58e430af42 PacketExtension.from(Packet), deprecate getFrom()
add 'from(Packet)' to DataForm
2014-09-16 22:22:25 +02:00