diff --git a/build.gradle b/build.gradle
index 837ce17ae..1c6f89a03 100644
--- a/build.gradle
+++ b/build.gradle
@@ -79,6 +79,14 @@ allprojects {
':smack-android',
':smack-android-extensions',
].collect{ project(it) }
+ androidOptionalProjects = [
+ ':smack-tcp',
+ ':smack-extensions',
+ ':smack-experimental',
+ ':smack-bosh',
+ ':smack-omemo',
+ ':smack-omemo-signal',
+ ].collect{ project(it) }
gplLicensedProjects = [
':smack-omemo-signal',
':smack-omemo-signal-integration-test',
diff --git a/config/checkstyle.xml b/config/checkstyle.xml
index de313cff0..8c9153aa2 100644
--- a/config/checkstyle.xml
+++ b/config/checkstyle.xml
@@ -60,6 +60,10 @@
+
+
+
+
diff --git a/documentation/gettingstarted.md b/documentation/gettingstarted.md
index f21df132f..2698ba811 100644
--- a/documentation/gettingstarted.md
+++ b/documentation/gettingstarted.md
@@ -6,24 +6,24 @@ Smack: Getting Started
This document will introduce you to the Smack API and provide an overview of
important classes and concepts.
-JAR Files and Requirements
---------------------------
+Smack Modules and Requirements
+-------------------------------
Smack is meant to be easily embedded into any existing Java application. The
-library ships as several JAR files to provide more flexibility over which
+library ships as several modulesto provide more flexibility over which
features applications require:
- * `smack-core.jar` -- provides core XMPP functionality. All XMPP features that are part of the XMPP RFCs are included.
- * `smack-im.jar` -- provides functinoality defined in RFC 6121 (XMPP-IM), like the Roster.
- * `smack-tcp.jar` -- support for XMPP over TCP. Includes XMPPTCPConnection class, which you usually want to use
- * `smack-extensions.jar` -- support for many of the extensions (XEPs) defined by the XMPP Standards Foundation, including multi-user chat, file transfer, user search, etc. The extensions are documented in the [extensions manual](extensions/index.md).
- * `smack-experimental.jar` -- support for experimental extensions (XEPs) defined by the XMPP Standards Foundation. The API and functionality of those extensions should be considered as unstable.
- * `smack-legacy.jar` -- support for legacy extensions (XEPs) defined by the XMPP Standards Foundation.
- * `smack-bosh.jar` -- support for BOSH (XEP-0124). This code should be considered as beta.
- * `smack-jingle.jar` -- support for Jingle. This code is old and currenlty unmaintained.
- * `smack-resolver-dnsjava.jar` -- support for resolving DNS SRV records with the help of dnsjava. Ideal for platforms that do not support the javax.naming API.
- * `smack-resolver-javax.jar` -- support for resolving DNS SRV records with the javax namespace API.
- * `smack-debug.jar` -- an enhanced GUI debugger for protocol traffic. It will automatically be used when found in the classpath and when [debugging](debugging.md) is enabled.
+ * `smack-core` -- provides core XMPP functionality. All XMPP features that are part of the XMPP RFCs are included.
+ * `smack-im` -- provides functinoality defined in RFC 6121 (XMPP-IM), like the Roster.
+ * `smack-tcp` -- support for XMPP over TCP. Includes XMPPTCPConnection class, which you usually want to use
+ * `smack-extensions` -- support for many of the extensions (XEPs) defined by the XMPP Standards Foundation, including multi-user chat, file transfer, user search, etc. The extensions are documented in the [extensions manual](extensions/index.md).
+ * `smack-experimental` -- support for experimental extensions (XEPs) defined by the XMPP Standards Foundation. The API and functionality of those extensions should be considered as unstable.
+ * `smack-legacy` -- support for legacy extensions (XEPs) defined by the XMPP Standards Foundation.
+ * `smack-bosh` -- support for BOSH (XEP-0124). This code should be considered as beta.
+ * `smack-resolver-minidns` -- support for resolving DNS SRV records with the help of MiniDNS. Ideal for platforms that do not support the javax.naming API. Also supports [DNSSEC](dnssec.md).
+ * `smack-resolver-dnsjava` -- support for resolving DNS SRV records with the help of dnsjava.
+ * `smack-resolver-javax` -- support for resolving DNS SRV records with the javax namespace API.
+ * `smack-debug` -- an enhanced GUI debugger for protocol traffic. It will automatically be used when found in the classpath and when [debugging](debugging.md) is enabled.
Configuration
-------------
@@ -46,10 +46,14 @@ The `XMPPTCPConnection` class is used to create a connection to an XMPP
server. Below are code examples for making a connection:
```
-// Create a connection to the jabber.org server.
-AbstractXMPPConnection conn1 = **new** XMPPTCPConnection("username", "password", "jabber.org");
-conn1.connect();
+// Create a connection and login to the example.org XMPP service.
+AbstractXMPPConnection connection = new XMPPTCPConnection("username", "password" "example.org");
+conn1.connect().login();
+```
+Further connection parameters can be configured by using a configuration builder:
+
+```
// Create a connection to the jabber.org server on a specific port.
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("username", "password")
@@ -59,7 +63,7 @@ XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.build();
AbstractXMPPConnection conn2 = **new** XMPPTCPConnection(config);
-conn2.connect();
+conn2.connect().login();
```
Note that maximum security will be used when connecting to the server by
diff --git a/smack-android/build.gradle b/smack-android/build.gradle
index c5c9a920d..caeaae305 100644
--- a/smack-android/build.gradle
+++ b/smack-android/build.gradle
@@ -9,9 +9,8 @@ smack-extensions and smack-experimental."""
dependencies {
// androidProjects lists all projects that are checked to compile against android.jar
// Filter out the optional Smack dependencies from androidProjects
- androidProjects.findAll {
- ![':smack-tcp', ':smack-extensions', ':smack-experimental', ':smack-bosh'].contains(it.getPath())
- }.each { project ->
+ (androidProjects - androidOptionalProjects)
+ .each { project ->
compile project
}
diff --git a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
index 0c72bd66b..8471e7592 100644
--- a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
+++ b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
@@ -524,7 +524,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
}
break;
case "error":
- //Some bosh error isn't stream error.
+ // Some BOSH error isn't stream error.
if ("urn:ietf:params:xml:ns:xmpp-streams".equals(parser.getNamespace(null))) {
throw new StreamErrorException(PacketParserUtils.parseStreamError(parser));
} else {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
index 6d9dc4007..4904bb27a 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
@@ -46,6 +46,7 @@ import org.jivesoftware.smack.SmackException.AlreadyConnectedException;
import org.jivesoftware.smack.SmackException.AlreadyLoggedInException;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
+import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.SmackException.ResourceBindingNotOfferedException;
import org.jivesoftware.smack.SmackException.SecurityRequiredByClientException;
import org.jivesoftware.smack.SmackException.SecurityRequiredException;
@@ -1541,7 +1542,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
final StanzaListener packetListener = new StanzaListener() {
@Override
- public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
+ public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException {
boolean removed = removeAsyncStanzaListener(this);
if (!removed) {
// We lost a race against the "no response" handling runnable. Avoid calling the callback, as the
@@ -1609,7 +1610,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public void addOneTimeSyncCallback(final StanzaListener callback, final StanzaFilter packetFilter) {
final StanzaListener packetListener = new StanzaListener() {
@Override
- public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
+ public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException {
try {
callback.processStanza(packet);
} finally {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java b/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java
index fb9b1b283..c5e5eb1aa 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java
@@ -18,6 +18,7 @@
package org.jivesoftware.smack;
import org.jivesoftware.smack.SmackException.NotConnectedException;
+import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.packet.Stanza;
/**
@@ -49,7 +50,8 @@ public interface StanzaListener {
* @param packet the stanza(/packet) to process.
* @throws NotConnectedException
* @throws InterruptedException
+ * @throws NotLoggedInException
*/
- public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException;
+ public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
index 71d7c3697..cc2a90e36 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
@@ -66,7 +66,15 @@ public final class Presence extends Stanza implements TypedCloneable {
private Type type = Type.available;
private String status = null;
+
+ /**
+ * The priority of the presence. The magic value {@link Integer#MIN_VALUE} is used to indicate that the original
+ * presence stanza did not had an explicit priority set. In which case the priority defaults to 0.
+ *
+ * @see RFC 6121 § 4.7.2.3.
+ */
private int priority = Integer.MIN_VALUE;
+
private Mode mode = null;
/**
@@ -201,6 +209,9 @@ public final class Presence extends Stanza implements TypedCloneable {
* @see RFC 6121 § 4.7.2.3. Priority Element
*/
public int getPriority() {
+ if (priority == Integer.MIN_VALUE) {
+ return 0;
+ }
return priority;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
index 991228c9e..9be532f4f 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
@@ -226,9 +226,13 @@ public class XMPPError extends AbstractError {
}
public static XMPPError.Builder from(Condition condition, String descriptiveText) {
- Map descriptiveTexts = new HashMap();
- descriptiveTexts.put("en", descriptiveText);
- return getBuilder().setCondition(condition).setDescriptiveTexts(descriptiveTexts);
+ XMPPError.Builder builder = getBuilder().setCondition(condition);
+ if (descriptiveText != null) {
+ Map descriptiveTexts = new HashMap<>();
+ descriptiveTexts.put("en", descriptiveText);
+ builder.setDescriptiveTexts(descriptiveTexts);
+ }
+ return builder;
}
public static Builder getBuilder() {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java
index 4034854d4..053c1a67e 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java
@@ -97,7 +97,6 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
| 1 | 1 |
+----+--------+
*/
- //in.read(buf, 0, 2);
fill(in, buf, 2);
boolean check = false;
@@ -160,7 +159,6 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
`failure' (STATUS value other than X'00') status, it MUST close the
connection.
*/
- //in.read(buf, 0, 2);
fill(in, buf, 2);
if (buf[1] == 0)
{
@@ -260,7 +258,6 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
o BND.PORT server bound port in network octet order
*/
- //in.read(buf, 0, 4);
fill(in, buf, 4);
if (buf[1] != 0)
@@ -279,17 +276,13 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
switch (buf[3] & 0xff)
{
case 1:
- //in.read(buf, 0, 6);
fill(in, buf, 6);
break;
case 3:
- //in.read(buf, 0, 1);
fill(in, buf, 1);
- //in.read(buf, 0, buf[0]+2);
fill(in, buf, (buf[0] & 0xff) + 2);
break;
case 4:
- //in.read(buf, 0, 18);
fill(in, buf, 18);
break;
default:
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
index ecba3ea7d..7cd75590b 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
@@ -272,7 +272,7 @@ public class StringUtils {
* array index.
*/
private static final char[] numbersAndLetters = ("0123456789abcdefghijklmnopqrstuvwxyz" +
- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ").toCharArray();
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ").toCharArray();
/**
* Returns a random String of numbers and letters (lower and upper case)
@@ -288,17 +288,7 @@ public class StringUtils {
* @return a random String of numbers and letters of the specified length.
*/
public static String insecureRandomString(int length) {
- if (length < 1) {
- return null;
- }
-
- final Random random = randGen.get();
- // Create a char buffer to put random letters and numbers in.
- char[] randBuffer = new char[length];
- for (int i = 0; i < randBuffer.length; i++) {
- randBuffer[i] = numbersAndLetters[random.nextInt(numbersAndLetters.length)];
- }
- return new String(randBuffer);
+ return randomString(length, randGen.get());
}
private static final ThreadLocal SECURE_RANDOM = new ThreadLocal() {
@@ -309,12 +299,16 @@ public class StringUtils {
};
public static String randomString(final int length) {
+ return randomString(length, SECURE_RANDOM.get());
+ }
+
+ private static String randomString(final int length, Random random) {
if (length < 1) {
return null;
}
byte[] randomBytes = new byte[length];
- SECURE_RANDOM.get().nextBytes(randomBytes);
+ random.nextBytes(randomBytes);
char[] randomChars = new char[length];
for (int i = 0; i < length; i++) {
randomChars[i] = getPrintableChar(randomBytes[i]);
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java
index f8a9477ce..585c84659 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java
@@ -172,7 +172,7 @@ public class StanzaCollectorTest
catch (InterruptedException e)
{
}
- //We cannot guarantee that this is going to pass due to the possible issue of timing between consumer 1
+ // We cannot guarantee that this is going to pass due to the possible issue of timing between consumer 1
// and main, but the probability is extremely remote.
assertNull(collector.pollResult());
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
index d266bcfd4..0c1bfa6d2 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
@@ -17,6 +17,7 @@
package org.jivesoftware.smackx.bytestreams.ibb;
import org.jivesoftware.smack.SmackException.NotConnectedException;
+import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
import org.jivesoftware.smack.packet.IQ;
@@ -65,7 +66,7 @@ class DataListener extends AbstractIqRequestHandler {
ibbSession.processIQPacket(data);
}
}
- catch (NotConnectedException | InterruptedException e) {
+ catch (NotConnectedException | InterruptedException | NotLoggedInException e) {
return null;
}
return null;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
index 8b06f541f..79a5b29e8 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
@@ -25,6 +25,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import org.jivesoftware.smack.SmackException.NotConnectedException;
+import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.AndFilter;
@@ -847,8 +848,9 @@ public class InBandBytestreamSession implements BytestreamSession {
* @param data
* @throws NotConnectedException
* @throws InterruptedException
+ * @throws NotLoggedInException
*/
- public void processIQPacket(Data data) throws NotConnectedException, InterruptedException {
+ public void processIQPacket(Data data) throws NotConnectedException, InterruptedException, NotLoggedInException {
inputStream.dataPacketListener.processStanza(data);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
index 2d3b7b83e..80de8ee8a 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.ConnectionCreationListener;
@@ -766,6 +765,25 @@ public final class ServiceDiscoveryManager extends Manager {
*/
public List findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
+ return findServicesDiscoverInfo(feature, stopOnFirst, useCache, null);
+ }
+
+ /**
+ * Find all services under the users service that provide a given feature.
+ *
+ * @param feature the feature to search for
+ * @param stopOnFirst if true, stop searching after the first service was found
+ * @param useCache if true, query a cache first to avoid network I/O
+ * @param encounteredExceptions an optional map which will be filled with the exceptions encountered
+ * @return a possible empty list of services providing the given feature
+ * @throws NoResponseException
+ * @throws XMPPErrorException
+ * @throws NotConnectedException
+ * @throws InterruptedException
+ * @since 4.2.2
+ */
+ public List findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache, Map super Jid, Exception> encounteredExceptions)
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List serviceDiscoInfo = null;
DomainBareJid serviceName = connection().getXMPPServiceDomain();
if (useCache) {
@@ -780,8 +798,9 @@ public final class ServiceDiscoveryManager extends Manager {
try {
info = discoverInfo(serviceName);
} catch (XMPPErrorException e) {
- // Be extra robust here: Return the empty linked list and log this situation
- LOGGER.log(Level.WARNING, "Could not discover information about service", e);
+ if (encounteredExceptions != null) {
+ encounteredExceptions.put(serviceName, e);
+ }
return serviceDiscoInfo;
}
// Check if the server supports the feature
@@ -800,25 +819,27 @@ public final class ServiceDiscoveryManager extends Manager {
// Get the disco items and send the disco packet to each server item
items = discoverItems(serviceName);
} catch (XMPPErrorException e) {
- LOGGER.log(Level.WARNING, "Could not discover items about service", e);
+ if (encounteredExceptions != null) {
+ encounteredExceptions.put(serviceName, e);
+ }
return serviceDiscoInfo;
}
for (DiscoverItems.Item item : items.getItems()) {
+ Jid address = item.getEntityID();
try {
// TODO is it OK here in all cases to query without the node attribute?
// MultipleRecipientManager queried initially also with the node attribute, but this
// could be simply a fault instead of intentional.
- info = discoverInfo(item.getEntityID());
+ info = discoverInfo(address);
}
catch (XMPPErrorException | NoResponseException e) {
- // Don't throw this exceptions if one of the server's items fail
- LOGGER.log(Level.WARNING, "Exception while discovering info for feature " + feature
- + " of " + item.getEntityID() + " node: " + item.getNode(), e);
+ if (encounteredExceptions != null) {
+ encounteredExceptions.put(address, e);
+ }
continue;
}
if (info.containsFeature(feature)) {
serviceDiscoInfo.add(info);
- //serviceAddresses.add(item.getEntityID().asDomainBareJid());
if (stopOnFirst) {
break;
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java
index 80681ad2f..5d9498bfe 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java
@@ -303,7 +303,7 @@ public class OutgoingFileTransfer extends FileTransfer {
transferThread = new Thread(new Runnable() {
@Override
public void run() {
- //Create packet filter
+ // Create packet filter.
try {
outputStream = negotiateStream(fileName, fileSize, description);
} catch (XMPPErrorException e) {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java
index 552a018ef..5f74e70a3 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java
@@ -84,7 +84,7 @@ public final class JingleManager extends Manager {
JingleSessionHandler sessionHandler = jingleSessionHandlers.get(fullJidAndSessionId);
if (sessionHandler != null) {
- //Handle existing session
+ // Handle existing session
return sessionHandler.handleJingleSessionRequest(jingle);
}
@@ -96,19 +96,19 @@ public final class JingleManager extends Manager {
description.getNamespace());
if (jingleDescriptionHandler == null) {
- //Unsupported Application
+ // Unsupported Application
LOGGER.log(Level.WARNING, "Unsupported Jingle application.");
return jutil.createSessionTerminateUnsupportedApplications(fullFrom, sid);
}
return jingleDescriptionHandler.handleJingleRequest(jingle);
}
- //Unknown session
+ // Unknown session
LOGGER.log(Level.WARNING, "Unknown session.");
return jutil.createErrorUnknownSession(jingle);
}
});
- //Register transports.
+ // Register transports.
JingleTransportMethodManager transportMethodManager = JingleTransportMethodManager.getInstanceFor(connection);
transportMethodManager.registerTransportManager(JingleIBBTransportManager.getInstanceFor(connection));
transportMethodManager.registerTransportManager(JingleS5BTransportManager.getInstanceFor(connection));
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportManager.java
index 1c52512ec..500a7b0a8 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportManager.java
@@ -59,6 +59,6 @@ public final class JingleIBBTransportManager extends JingleTransportManager theirChoice.candidate.getPriority()) {
@@ -288,7 +288,7 @@ public class JingleS5BTransportSession extends JingleTransportSession getMessages(final List nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
- List messages = new ArrayList();
+ List messages = new ArrayList(nodes.size());
OfflineMessageRequest request = new OfflineMessageRequest();
for (String node : nodes) {
OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node);
@@ -165,12 +169,17 @@ public class OfflineMessageManager {
try {
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
// Collect the received offline messages
- Message message = messageCollector.nextResult();
- while (message != null && pendingNodes > 0) {
- pendingNodes--;
- messages.add(message);
+ Message message;
+ do {
message = messageCollector.nextResult();
- }
+ if (message != null) {
+ messages.add(message);
+ pendingNodes--;
+ } else if (message == null && pendingNodes > 0) {
+ LOGGER.log(Level.WARNING,
+ "Did not receive all expected offline messages. " + pendingNodes + " are missing.");
+ }
+ } while (message != null && pendingNodes > 0);
}
finally {
// Stop queuing offline messages
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java
index 5dd2ad0b2..c153c16da 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java
@@ -704,7 +704,7 @@ public class VCard extends IQ {
}
private boolean hasContent() {
- //noinspection OverlyComplexBooleanExpression
+ // noinspection OverlyComplexBooleanExpression
return hasNameField()
|| hasOrganizationFields()
|| emailHome != null
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java
index 9320678c1..ecc730059 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/iqversion/VersionTest.java
@@ -55,8 +55,8 @@ public class VersionTest extends InitExtensions {
assertTrue(replyPacket instanceof Version);
Version reply = (Version) replyPacket;
- //getFrom check is pending for SMACK-547
- //assertEquals("juliet@capulet.lit/balcony", reply.getFrom());
+ // getFrom check is pending for SMACK-547
+ // assertEquals("juliet@capulet.lit/balcony", reply.getFrom());
assertThat("capulet.lit", equalsCharSequence(reply.getTo()));
assertEquals("s2c1", reply.getStanzaId());
assertEquals(IQ.Type.result, reply.getType());
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java
index 8f2fcd3c7..f954f9dbf 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java
@@ -124,7 +124,7 @@ public class PingTest extends InitExtensions {
@Test
public void checkFailedPingToEntityError() throws Exception {
ThreadedDummyConnection threadedCon = getAuthentiactedDummyConnection();
- //@formatter:off
+ // @formatter:off
String reply =
"" +
"" +
@@ -132,7 +132,7 @@ public class PingTest extends InitExtensions {
"" +
"" +
"";
- //@formatter:on
+ // @formatter:on
IQ serviceUnavailable = (IQ) PacketParserUtils.parseStanza(reply);
threadedCon.addIQReply(serviceUnavailable);
@@ -160,7 +160,7 @@ public class PingTest extends InitExtensions {
@Test
public void checkPingToServerError() throws Exception {
ThreadedDummyConnection con = getAuthentiactedDummyConnection();
- //@formatter:off
+ // @formatter:off
String reply =
"" +
"" +
@@ -168,7 +168,7 @@ public class PingTest extends InitExtensions {
"" +
"" +
"";
- //@formatter:on
+ // @formatter:on
IQ serviceUnavailable = (IQ) PacketParserUtils.parseStanza(reply);
con.addIQReply(serviceUnavailable);
@@ -194,13 +194,13 @@ public class PingTest extends InitExtensions {
DiscoverInfo info = new DiscoverInfo();
info.addFeature(Ping.NAMESPACE);
- //@formatter:off
+ // @formatter:off
String reply =
"" +
"" +
"" +
"";
- //@formatter:on
+ // @formatter:on
IQ discoReply = (IQ) PacketParserUtils.parseStanza(reply);
con.addIQReply(discoReply);
@@ -216,13 +216,13 @@ public class PingTest extends InitExtensions {
DiscoverInfo info = new DiscoverInfo();
info.addFeature(Ping.NAMESPACE);
- //@formatter:off
+ // @formatter:off
String reply =
"" +
"" +
"" +
"";
- //@formatter:on
+ // @formatter:on
IQ discoReply = (IQ) PacketParserUtils.parseStanza(reply);
con.addIQReply(discoReply);
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java
index 5bbf0b383..5e7514146 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java
@@ -50,7 +50,7 @@ public class DataFormTest {
@Test
public void test() throws Exception {
- //Build a Form
+ // Build a Form.
DataForm df = new DataForm(DataForm.Type.submit);
String instruction = "InstructionTest1";
df.addInstruction(instruction);
@@ -77,7 +77,7 @@ public class DataFormTest {
@Test
public void testLayout() throws Exception {
- //Build a Form
+ // Build a Form.
DataForm df = new DataForm(DataForm.Type.submit);
String instruction = "InstructionTest1";
df.addInstruction(instruction);
@@ -119,7 +119,7 @@ public class DataFormTest {
@Test
public void testValidation() throws Exception {
- //Build a Form
+ // Build a Form.
DataForm df = new DataForm(DataForm.Type.submit);
String instruction = "InstructionTest1";
df.addInstruction(instruction);
diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
index e69aed853..49cc92684 100644
--- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
+++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
@@ -251,9 +251,10 @@ public final class Roster extends Manager {
connection.addSyncStanzaListener(presencePacketListener, PRESENCE_PACKET_FILTER);
connection.addAsyncStanzaListener(new StanzaListener() {
+ @SuppressWarnings("fallthrough")
@Override
public void processStanza(Stanza stanza) throws NotConnectedException,
- InterruptedException {
+ InterruptedException, NotLoggedInException {
Presence presence = (Presence) stanza;
Jid from = presence.getFrom();
SubscribeAnswer subscribeAnswer = null;
@@ -279,13 +280,26 @@ public final class Roster extends Manager {
break;
}
+ if (subscribeAnswer == null) {
+ return;
+ }
+
Presence response;
- if (subscribeAnswer == SubscribeAnswer.Approve) {
+ switch (subscribeAnswer) {
+ case ApproveAndAlsoRequestIfRequired:
+ BareJid bareFrom = from.asBareJid();
+ RosterUtil.askForSubscriptionIfRequired(Roster.this, bareFrom);
+ // The fall through is intended.
+ case Approve:
response = new Presence(Presence.Type.subscribed);
- }
- else {
+ break;
+ case Deny:
response = new Presence(Presence.Type.unsubscribed);
+ break;
+ default:
+ throw new AssertionError();
}
+
response.setTo(presence.getFrom());
connection.sendStanza(response);
}
diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterUtil.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterUtil.java
index 0d46406e3..03b1c6ad5 100644
--- a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterUtil.java
+++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterUtil.java
@@ -23,6 +23,7 @@ import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.XMPPConnection;
@@ -86,6 +87,33 @@ public class RosterUtil {
}
}
+ /**
+ * Pre-approve the subscription if it is required and possible.
+ *
+ * @param roster The roster which should be used for the pre-approval.
+ * @param jid The XMPP address which should be pre-approved.
+ * @throws NotLoggedInException
+ * @throws NotConnectedException
+ * @throws InterruptedException
+ * @since 4.2.2
+ */
+ public static void preApproveSubscriptionIfRequiredAndPossible(Roster roster, BareJid jid)
+ throws NotLoggedInException, NotConnectedException, InterruptedException {
+ if (!roster.isSubscriptionPreApprovalSupported()) {
+ return;
+ }
+
+ RosterEntry entry = roster.getEntry(jid);
+ if (entry == null || (!entry.canSeeMyPresence() && !entry.isApproved())) {
+ try {
+ roster.preApprove(jid);
+ } catch (FeatureNotSupportedException e) {
+ // Should never happen since we checked for the feature above.
+ throw new AssertionError(e);
+ }
+ }
+ }
+
public static void askForSubscriptionIfRequired(Roster roster, BareJid jid)
throws NotLoggedInException, NotConnectedException, InterruptedException {
RosterEntry entry = roster.getEntry(jid);
diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/SubscribeListener.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/SubscribeListener.java
index 7c045aaaf..85abba6dd 100644
--- a/smack-im/src/main/java/org/jivesoftware/smack/roster/SubscribeListener.java
+++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/SubscribeListener.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2015 Florian Schmaus
+ * Copyright 2015-2017 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,13 +23,29 @@ import org.jxmpp.jid.Jid;
/**
- * Handle incoming requests to subscribe to our presence.
+ * Handle incoming requests to subscribe to our presence. The
+ * {@link #processSubscribe(Jid, Presence)} method may return a subscribe
+ * answer. If no subscribe answer is returned, the next listener will be
+ * notified and asked. If no listener returns an answer, then nothing happens.
*
*/
public interface SubscribeListener {
public enum SubscribeAnswer {
+ /**
+ * Approve the subscription request.
+ */
Approve,
+
+ /**
+ * Approve the subscription request and also request subscription from the other party if not already subscribed.
+ * @since 4.2.2
+ */
+ ApproveAndAlsoRequestIfRequired,
+
+ /**
+ * Deny the subscription request.
+ */
Deny,
}
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java
index 587885229..940381398 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java
@@ -58,7 +58,7 @@ public class MamIntegrationTest extends AbstractSmackIntegrationTest {
EntityBareJid userOne = conOne.getUser().asEntityBareJid();
EntityBareJid userTwo = conTwo.getUser().asEntityBareJid();
- //Make sure MAM is archiving messages
+ // Make sure MAM is archiving messages.
mamManagerConTwo.updateArchivingPreferences(null, null, MamPrefsIQ.DefaultBehavior.always);
Message message = new Message(userTwo);
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractOmemoIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractOmemoIntegrationTest.java
index e7b0ce63b..faa03adb8 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractOmemoIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/AbstractOmemoIntegrationTest.java
@@ -55,7 +55,7 @@ public abstract class AbstractOmemoIntegrationTest extends AbstractSmackIntegrat
throw new TestNotPossibleException("Server does not support OMEMO (PubSub)");
}
- //Check for OmemoService
+ // Check for OmemoService
if (!OmemoService.isServiceRegistered()) {
throw new TestNotPossibleException("No OmemoService registered.");
}
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoInitializationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoInitializationTest.java
index e019dce82..4409a449e 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoInitializationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoInitializationTest.java
@@ -57,14 +57,14 @@ public class OmemoInitializationTest extends AbstractOmemoIntegrationTest {
*/
@SmackIntegrationTest
public void initializationTest() throws XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, SmackException.NotLoggedInException, CorruptedOmemoKeyException, NotAPubSubNodeException {
- //test keys.
+ // test keys.
setUpOmemoManager(alice);
assertNotNull("IdentityKey must not be null after initialization.", store.loadOmemoIdentityKeyPair(alice));
assertTrue("We must have " + OmemoConstants.TARGET_PRE_KEY_COUNT + " preKeys.",
store.loadOmemoPreKeys(alice).size() == OmemoConstants.TARGET_PRE_KEY_COUNT);
assertNotNull("Our signedPreKey must not be null.", store.loadCurrentSignedPreKeyId(alice));
- //Is deviceId published?
+ // Is deviceId published?
assertTrue("Published deviceList must contain our deviceId.",
OmemoService.fetchDeviceList(alice, alice.getOwnJid())
.getDeviceIds().contains(alice.getDeviceId()));
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoIntegrationTestHelper.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoIntegrationTestHelper.java
index 78895cf08..4cbc88e7a 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoIntegrationTestHelper.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoIntegrationTestHelper.java
@@ -63,7 +63,7 @@ final class OmemoIntegrationTestHelper {
try {
omemoManager.requestDeviceListUpdateFor(omemoManager.getOwnJid());
} catch (SmackException.NotConnectedException | InterruptedException | SmackException.NoResponseException e) {
- //ignore
+ // ignore
}
CachedDeviceList deviceList = OmemoService.getInstance().getOmemoStoreBackend().loadCachedDeviceList(omemoManager, omemoManager.getOwnJid());
@@ -71,26 +71,26 @@ final class OmemoIntegrationTestHelper {
try {
pm.getLeafNode(OmemoConstants.PEP_NODE_BUNDLE_FROM_DEVICE_ID(id)).deleteAllItems();
} catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | PubSubException.NotALeafNodeException | XMPPException.XMPPErrorException | NotAPubSubNodeException e) {
- //Silent
+ // Silent
}
try {
pm.deleteNode(OmemoConstants.PEP_NODE_BUNDLE_FROM_DEVICE_ID(id));
} catch (SmackException.NoResponseException | InterruptedException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) {
- //Silent
+ // Silent
}
}
try {
pm.getLeafNode(OmemoConstants.PEP_NODE_DEVICE_LIST).deleteAllItems();
} catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | PubSubException.NotALeafNodeException | XMPPException.XMPPErrorException | NotAPubSubNodeException e) {
- //Silent
+ // Silent
}
try {
pm.deleteNode(OmemoConstants.PEP_NODE_DEVICE_LIST);
} catch (SmackException.NoResponseException | InterruptedException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) {
- //Silent
+ // Silent
}
}
@@ -100,7 +100,7 @@ final class OmemoIntegrationTestHelper {
try {
roster.removeEntry(r);
} catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | XMPPException.XMPPErrorException | SmackException.NotLoggedInException e) {
- //Silent
+ // Silent
}
}
}
@@ -128,7 +128,7 @@ final class OmemoIntegrationTestHelper {
static void unidirectionalTrust(OmemoManager alice, OmemoManager bob) throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, CannotEstablishOmemoSessionException {
- //Fetch deviceList
+ // Fetch deviceList
alice.requestDeviceListUpdateFor(bob.getOwnJid());
LOGGER.log(Level.INFO, "Current deviceList state: " + alice.getOwnDevice() + " knows " + bob.getOwnDevice() + ": "
+ OmemoService.getInstance().getOmemoStoreBackend().loadCachedDeviceList(alice, bob.getOwnJid()));
@@ -136,12 +136,12 @@ final class OmemoIntegrationTestHelper {
alice.getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(alice, bob.getOwnJid())
.getActiveDevices().contains(bob.getDeviceId()));
- //Create sessions
+ // Create sessions
alice.buildSessionsWith(bob.getOwnJid());
assertTrue("Trusting party must have a session with the other end at this point.",
!alice.getOmemoService().getOmemoStoreBackend().loadAllRawSessionsOf(alice, bob.getOwnJid()).isEmpty());
- //Trust the other party
+ // Trust the other party
alice.getOmemoService().getOmemoStoreBackend().trustOmemoIdentity(alice, bob.getOwnDevice(),
alice.getOmemoService().getOmemoStoreBackend().getFingerprint(alice, bob.getOwnDevice()));
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoKeyTransportTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoKeyTransportTest.java
index cb745c1d1..90cabb88b 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoKeyTransportTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoKeyTransportTest.java
@@ -79,7 +79,7 @@ public class OmemoKeyTransportTest extends AbstractOmemoIntegrationTest {
bob.addOmemoMessageListener(new OmemoMessageListener() {
@Override
public void onOmemoMessageReceived(String decryptedBody, Message encryptedMessage, Message wrappingMessage, OmemoMessageInformation omemoInformation) {
- //Don't care
+ // Don't care
}
@Override
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMessageSendingTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMessageSendingTest.java
index bcdc29ed3..01fe16bd3 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMessageSendingTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMessageSendingTest.java
@@ -101,23 +101,23 @@ public class OmemoMessageSendingTest extends AbstractOmemoIntegrationTest {
final SimpleResultSyncPoint messageOneSyncPoint = new SimpleResultSyncPoint();
final SimpleResultSyncPoint messageTwoSyncPoint = new SimpleResultSyncPoint();
- //Subscribe to one another
+ // Subscribe to one another
subscribe(alice, bob, "Bob");
subscribe(bob, alice,"Alice");
- //initialize OmemoManagers
+ // initialize OmemoManagers
setUpOmemoManager(alice);
setUpOmemoManager(bob);
- //Save initial bundles
+ // Save initial bundles
OmemoBundleElement aliceBundle = store.packOmemoBundle(alice);
OmemoBundleElement bobsBundle = store.packOmemoBundle(bob);
- //Trust
+ // Trust
unidirectionalTrust(alice, bob);
unidirectionalTrust(bob, alice);
- //Register messageListeners
+ // Register messageListeners
bob.addOmemoMessageListener(new OmemoMessageListener() {
@Override
public void onOmemoMessageReceived(String decryptedBody, Message encryptedMessage, Message wrappingMessage, OmemoMessageInformation omemoInformation) {
@@ -151,7 +151,7 @@ public class OmemoMessageSendingTest extends AbstractOmemoIntegrationTest {
}
});
- //Prepare Alice message for Bob
+ // Prepare Alice message for Bob
Message encryptedA = alice.encrypt(bob.getOwnJid(), alicesSecret);
ChatManager.getInstanceFor(alice.getConnection()).chatWith(bob.getOwnJid().asEntityBareJidIfPossible())
.send(encryptedA);
@@ -163,11 +163,11 @@ public class OmemoMessageSendingTest extends AbstractOmemoIntegrationTest {
TestCase.fail("Bob must have received Alice message.");
}
- //Check if Bob published a new Bundle
+ // Check if Bob published a new Bundle
assertNotSame("Bob must have published another bundle at this point, since we used a PreKeyMessage.",
bobsBundle, OmemoService.fetchBundle(alice, bob.getOwnDevice()));
- //Prepare Bobs response
+ // Prepare Bobs response
Message encryptedB = bob.encrypt(alice.getOwnJid(), bobsSecret);
ChatManager.getInstanceFor(bob.getConnection()).chatWith(alice.getOwnJid().asEntityBareJidIfPossible())
.send(encryptedB);
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoStoreTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoStoreTest.java
index e79e65c34..663ae948c 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoStoreTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoStoreTest.java
@@ -56,7 +56,7 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
@SmackIntegrationTest
public void storeTest() throws Exception {
- //########### PRE-INITIALIZATION ############
+ // ########### PRE-INITIALIZATION ############
assertEquals("Creating an OmemoManager without MUST have set the default deviceId.", alice.getDeviceId(), OmemoService.getInstance().getOmemoStoreBackend().getDefaultDeviceId(alice.getOwnJid()));
assertEquals("OmemoManager must be equal, since both got created without giving a deviceId.", alice, bob);
@@ -69,11 +69,11 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
OmemoStore,?,?,?,?,?,?,?,?> store = OmemoService.getInstance().getOmemoStoreBackend();
OmemoFingerprint finger = new OmemoFingerprint("FINGER");
- //DefaultDeviceId
+ // DefaultDeviceId
store.setDefaultDeviceId(alice.getOwnJid(), 777);
assertEquals("defaultDeviceId setting/getting must equal.", 777, store.getDefaultDeviceId(alice.getOwnJid()));
- //Trust/Distrust/Decide
+ // Trust/Distrust/Decide
bob.shutdown();
bob = OmemoManager.getInstanceFor(conTwo, 998);
assertFalse("Bobs device MUST be undecided at this point",
@@ -89,7 +89,7 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
assertFalse("Bobs device MUST be untrusted at this point.",
store.isTrustedOmemoIdentity(alice, bob.getOwnDevice(), finger));
- //Dates
+ // Dates
assertNull("Date of last received message must be null when no message was received ever.",
store.getDateOfLastReceivedMessage(alice, bob.getOwnDevice()));
Date now = new Date();
@@ -102,7 +102,7 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
assertEquals("Date of last signed prekey renewal must match our date.",
now, store.getDateOfLastSignedPreKeyRenewal(alice));
- //Keys
+ // Keys
assertNull("IdentityKeyPair must be null at this point.",
store.loadOmemoIdentityKeyPair(alice));
assertNull("IdentityKey of contact must be null at this point.",
@@ -118,7 +118,7 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
100, store.generateOmemoPreKeys(1, 100).size());
- //LastPreKeyId
+ // LastPreKeyId
assertEquals("LastPreKeyId must be 0 at this point.",
0, store.loadLastPreKeyId(alice));
store.storeLastPreKeyId(alice, 1234);
@@ -126,7 +126,7 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
assertEquals("LastPreKeyId set/get must equal.", 1234, store.loadLastPreKeyId(alice));
store.storeLastPreKeyId(alice, 0);
- //CurrentSignedPreKeyId
+ // CurrentSignedPreKeyId
assertEquals("CurrentSignedPreKeyId must be 0 at this point.",
0, store.loadCurrentSignedPreKeyId(alice));
store.storeCurrentSignedPreKeyId(alice, 554);
@@ -137,10 +137,10 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
deletePath(alice);
- //################# POST-INITIALIZATION #################
+ // ################# POST-INITIALIZATION #################
setUpOmemoManager(alice);
- //Keys
+ // Keys
assertNotNull("IdentityKeyPair must not be null after initialization",
store.loadOmemoIdentityKeyPair(alice));
assertNotSame("LastPreKeyId must not be 0 after initialization.",
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java
index d45d92861..84b6c7d98 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java
@@ -45,7 +45,7 @@ public abstract class JingleNegotiator {
private static final Logger LOGGER = Logger.getLogger(JingleNegotiator.class.getName());
- //private XMPPConnection connection; // The connection associated
+ // private XMPPConnection connection; // The connection associated
protected JingleSession session;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
index e5a0b1b4e..cda33ae3b 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
@@ -148,7 +148,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
public JingleSession(XMPPConnection conn, JingleSessionRequest request, Jid initiator, Jid responder,
List jingleMediaManagers) {
this(conn, initiator, responder, generateSessionId(), jingleMediaManagers);
- //sessionRequest = request; // unused
+ // sessionRequest = request; // unused
}
/**
@@ -317,7 +317,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// Acknowledge the IQ reception
// Not anymore. The state machine generates an appropriate response IQ that
// gets sent back at the end of this routine.
- //sendAck(iq);
+ // sendAck(iq);
} catch (JingleException e) {
// Send an error message, if present
@@ -829,7 +829,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
addExpectedId(jout.getStanzaId());
sendStanza(jout);
- //triggerSessionEstablished();
+ // triggerSessionEstablished();
}
}
@@ -1143,7 +1143,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
*/
public void startIncoming() {
- //updatePacketListener();
+ // updatePacketListener();
}
@Override
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java
index b5fad8e47..8ae50fa98 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java
@@ -118,7 +118,7 @@ public class JingleSessionRequest {
session = manager.createIncomingJingleSession(this);
// Acknowledge the IQ reception
session.setSid(this.getSessionID());
- //session.sendAck(this.getJingle());
+ // session.sendAck(this.getJingle());
session.updatePacketListener();
session.receivePacketAndRespond(this.getJingle());
}
@@ -135,7 +135,7 @@ public class JingleSessionRequest {
session = manager.createIncomingJingleSession(this);
// Acknowledge the IQ reception
session.setSid(this.getSessionID());
- //session.sendAck(this.getJingle());
+ // session.sendAck(this.getJingle());
session.updatePacketListener();
session.terminate("Declined");
} catch (Exception e) {
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStatePending.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStatePending.java
index 9d7e6a6e1..71e1f2a84 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStatePending.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStatePending.java
@@ -93,7 +93,7 @@ public class JingleSessionStatePending extends JingleSessionState {
default:
// Anything other action is an error.
- //response = createJingleError(inJingle, JingleError.OUT_OF_ORDER);
+ // response = createJingleError(inJingle, JingleError.OUT_OF_ORDER);
break;
}
@@ -106,8 +106,8 @@ public class JingleSessionStatePending extends JingleSessionState {
private IQ receiveContentAcceptAction(Jingle inJingle) {
// According to XEP-167 the only thing we can do is ack.
- //setSessionState(JingleSessionStateEnum.ACTIVE);
- //return createAck(inJingle);
+ // setSessionState(JingleSessionStateEnum.ACTIVE);
+ // return createAck(inJingle);
// This is now handled by the media negotiator for the matching segment.
return null;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java
index be6193d6d..656fe6f65 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java
@@ -49,7 +49,7 @@ public class MediaNegotiator extends JingleNegotiator {
private static final Logger LOGGER = Logger.getLogger(MediaNegotiator.class.getName());
- //private JingleSession session; // The session this negotiation
+ // private JingleSession session; // The session this negotiation
private final JingleMediaManager mediaManager;
@@ -252,7 +252,7 @@ public class MediaNegotiator extends JingleNegotiator {
// If there are suitable/matching payload types then accept this content.
if (bestCommonAudioPt != null) {
// Let thre transport negotiators sort-out connectivity and content-accept instead.
- //response = createAudioPayloadTypesOffer();
+ // response = createAudioPayloadTypesOffer();
setNegotiatorState(JingleNegotiatorState.PENDING);
} else {
// Don't really know what to send here. XEP-166 is not clear.
@@ -291,7 +291,7 @@ public class MediaNegotiator extends JingleNegotiator {
// and send an accept if we have an agreement...
ptChange = !bestCommonAudioPt.equals(oldBestCommonAudioPt);
if (oldBestCommonAudioPt == null || ptChange) {
- //response = createAcceptMessage();
+ // response = createAcceptMessage();
}
} else {
throw new JingleException(JingleError.NO_COMMON_PAYLOAD);
@@ -319,7 +319,7 @@ public class MediaNegotiator extends JingleNegotiator {
if (bestCommonAudioPt == null) {
// Update the best common audio PT
bestCommonAudioPt = calculateBestCommonAudioPt(remoteAudioPts);
- //response = createAcceptMessage();
+ // response = createAcceptMessage();
}
offeredPayloads = description.getAudioPayloadTypesList();
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/JMFInit.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/JMFInit.java
index 1db8ba357..19fd04c2b 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/JMFInit.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/JMFInit.java
@@ -117,7 +117,7 @@ public class JMFInit extends Frame implements Runnable {
throw td;
}
catch (Throwable t) {
- //Do nothing
+ // Do nothing.
}
Class> jsauto;
@@ -226,7 +226,7 @@ public class JMFInit extends Frame implements Runnable {
}
}
catch (Throwable tt) {
- //Do nothing
+ // Do nothing.
}
}
@@ -270,7 +270,7 @@ public class JMFInit extends Frame implements Runnable {
}
}
catch (Throwable tt) {
- //Do nothing
+ // Do nothing.
}
}
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java
index 00f2bb150..108c5aea1 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java
@@ -152,9 +152,9 @@ public class JmfMediaManager extends JingleMediaManager {
// should be and put it there.
runLinuxPreInstall();
- //if (jmfProperties.length() == 0) {
+ // if (jmfProperties.length() == 0) {
new JMFInit(null, false);
- //}
+ // }
}
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/ImageReceiver.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/ImageReceiver.java
index 5e93dad8d..c3642d6dd 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/ImageReceiver.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/ImageReceiver.java
@@ -146,7 +146,7 @@ public class ImageReceiver extends Canvas {
public void drawTile(int x, int y, BufferedImage bufferedImage) {
tiles[x][y] = bufferedImage;
- //repaint(x * tileWidth, y * tileWidth, tileWidth, tileWidth);
+ // repaint(x * tileWidth, y * tileWidth, tileWidth, tileWidth);
this.getGraphics().drawImage(bufferedImage, tileWidth * x, tileWidth * y, this);
}
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java
index e097cf659..a1d3da9c9 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java
@@ -221,8 +221,8 @@ public class ICECandidate extends TransportCandidate implements Comparable localCandidates) {
- //TODO candidate is being checked trigger
- //candidatesChecking.add(cand);
+ // TODO candidate is being checked trigger
+ // candidatesChecking.add(cand);
final ICECandidate checkingCandidate = this;
@@ -287,8 +287,8 @@ public class ICECandidate extends TransportCandidate implements Comparable negociatorsMap = new HashMap();
- //ICENegociator iceNegociator = null;
+ // ICENegociator iceNegociator = null;
public ICEResolver(XMPPConnection connection, String server, int port) {
super();
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java
index 483461d46..34e2ae3cf 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java
@@ -110,7 +110,7 @@ public class TcpUdpBridgeClient {
byte[] b = new byte[500];
int s = in.read(b);
- //if (s == -1) continue;
+ // if (s == -1) continue;
LOGGER.fine("TCP Client:" + new String(b, 0, s, "UTF-8"));
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeServer.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeServer.java
index 92270d56b..60fa3f073 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeServer.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeServer.java
@@ -112,7 +112,7 @@ public class TcpUdpBridgeServer {
byte[] b = new byte[500];
int s = in.read(b);
- //if (s == -1) continue;
+ // if (s == -1) continue;
LOGGER.fine("TCP Server:" + new String(b, 0, s, "UTF-8"));
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java
index 3c21a246b..9665d2100 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java
@@ -352,8 +352,8 @@ public abstract class TransportCandidate {
* Subclasses should provide better methods if they can...
*/
public void check(final List localCandidates) {
- //TODO candidate is being checked trigger
- //candidatesChecking.add(cand);
+ // TODO candidate is being checked trigger
+ // candidatesChecking.add(cand);
Thread checkThread = new Thread(new Runnable() {
@Override
@@ -372,8 +372,8 @@ public abstract class TransportCandidate {
}
triggerCandidateChecked(isUsable);
- //TODO candidate is being checked trigger
- //candidatesChecking.remove(cand);
+ // TODO candidate is being checked trigger
+ // candidatesChecking.remove(cand);
}
}, "Transport candidate check");
@@ -680,7 +680,7 @@ public abstract class TransportCandidate {
socket.receive(packet);
- //LOGGER.fine("ECHO Packet Received in: " + socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort() + " From: " + packet.getAddress().getHostAddress() + ":" + packet.getPort());
+ // LOGGER.fine("ECHO Packet Received in: " + socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort() + " From: " + packet.getAddress().getHostAddress() + ":" + packet.getPort());
boolean accept = false;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
index dcbc3e96e..f864b2ce5 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
@@ -61,7 +61,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
public final static int CANDIDATES_ACCEPT_PERIOD = 4000;
// The session this nenotiator belongs to
- //private final JingleSession session;
+ // private final JingleSession session;
// The transport manager
private final TransportResolver resolver;
@@ -137,7 +137,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
*/
private void setAcceptedLocalCandidate(TransportCandidate bestLocalCandidate) {
for (int i = 0; i < resolver.getCandidateCount(); i++) {
- //TODO FIX The EQUAL Sentence
+ // TODO FIX The EQUAL Sentence
if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp())
&& resolver.getCandidate(i).getPort() == bestLocalCandidate.getPort()) {
acceptedLocalCandidate = resolver.getCandidate(i);
@@ -145,7 +145,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
}
}
LOGGER.fine("BEST: ip=" + bestLocalCandidate.getIp() + " port=" + bestLocalCandidate.getPort() + " has not been offered.");
- //throw new XMPPException("Local transport candidate has not be offered.");
+ // throw new XMPPException("Local transport candidate has not be offered.");
}
/**
@@ -316,7 +316,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
// Once we are in pending state, look for any valid remote
// candidate, and send an "accept" if we have one...
TransportCandidate bestRemote = getBestRemoteCandidate();
- //State state = getState();
+ // State state = getState();
if ((bestRemote != null)
&& ((getNegotiatorState() == JingleNegotiatorState.PENDING))) {
@@ -359,7 +359,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
if (candidate instanceof ICECandidate) {
ICECandidate iceCandidate = (ICECandidate) candidate;
if (iceCandidate.getType().equals(Type.relay)) {
- //TODO Check if the relay is reacheable
+ // TODO Check if the relay is reacheable.
addValidRemoteCandidate(iceCandidate);
foundRemoteRelay = true;
}
@@ -409,7 +409,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
}
bestRemote = getBestRemoteCandidate();
- //State state = getState();
+ // State state = getState();
if ((bestRemote != null)
&& ((getNegotiatorState() == JingleNegotiatorState.PENDING))) {
if (!acceptedRemoteCandidates.contains(bestRemote)) {
@@ -699,7 +699,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
IQ response = null;
// Parse the Jingle and get any proposed transport candidates
- //addRemoteCandidates(obtainCandidatesList(jin));
+ // addRemoteCandidates(obtainCandidatesList(jin));
// Start offering candidates
sendTransportCandidatesOffer();
@@ -723,7 +723,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
IQ response = null;
// Parse the Jingle and get any proposed transport candidates
- //addRemoteCandidates(obtainCandidatesList(jin));
+ // addRemoteCandidates(obtainCandidatesList(jin));
// // Start offering candidates
// sendTransportCandidatesOffer();
@@ -771,7 +771,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
if (isEstablished()) {
LOGGER.fine(cand.getIp() + " is set active");
- //setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
+ // setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
}
}
return response;
@@ -785,9 +785,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
IQ response = null;
LOGGER.fine("Transport stabilished");
- //triggerTransportEstablished(getAcceptedLocalCandidate(), getBestRemoteCandidate());
+ // triggerTransportEstablished(getAcceptedLocalCandidate(), getBestRemoteCandidate());
- //setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
+ // setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
return response;
}
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java
index 94dcb81e3..22b5ac4f0 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java
@@ -232,7 +232,7 @@ public abstract class JingleTransportProvider extends ExtensionElementProvider
+ // Device List
OmemoDeviceListVAxolotlElement omemoDeviceListElement = (OmemoDeviceListVAxolotlElement) payloadItem.getPayload();
int ourDeviceId = getDeviceId();
getOmemoService().getOmemoStoreBackend().mergeCachedDeviceList(OmemoManager.this, from, omemoDeviceListElement);
if (from == null) {
- //Unknown sender, no more work to do.
- //TODO: This DOES happen for some reason. Figure out when...
+ // Unknown sender, no more work to do.
+ // TODO: This DOES happen for some reason. Figure out when...
continue;
}
if (!from.equals(getOwnJid())) {
- //Not our deviceList, so nothing more to do
+ // Not our deviceList, so nothing more to do
continue;
}
if (omemoDeviceListElement.getDeviceIds().contains(ourDeviceId)) {
- //We are on the list. Nothing more to do
+ // We are on the list. Nothing more to do
continue;
}
- //Our deviceList and we are not on it! We don't want to miss all the action!!!
+ // Our deviceList and we are not on it! We don't want to miss all the action!!!
LOGGER.log(Level.INFO, "Our deviceId was not on the list!");
Set deviceListIds = omemoDeviceListElement.copyDeviceIds();
- //enroll at the deviceList
+ // enroll at the deviceList
deviceListIds.add(ourDeviceId);
final OmemoDeviceListVAxolotlElement newOmemoDeviceListElement = new OmemoDeviceListVAxolotlElement(deviceListIds);
diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
index 3c357b7ed..044c4f570 100644
--- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
+++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
@@ -190,7 +190,7 @@ public abstract class OmemoService(null, null, "");
}
@@ -257,7 +257,7 @@ public abstract class OmemoService(getOmemoStoreBackend().packOmemoBundle(omemoManager)));
@@ -369,12 +369,12 @@ public abstract class OmemoService deviceListIds) {
boolean publish = false;
int ownDeviceId = omemoManager.getDeviceId();
- //Clear devices that we didn't receive a message from for a while
+ // Clear devices that we didn't receive a message from for a while
Iterator it = deviceListIds.iterator();
while (OmemoConfiguration.getDeleteStaleDevices() && it.hasNext()) {
int id = it.next();
if (id == ownDeviceId) {
- //Skip own id
+ // Skip own id
continue;
}
@@ -601,11 +601,11 @@ public abstract class OmemoService bundles = getOmemoStoreBackend().keyUtil().BUNDLE.bundles(bundle, device);
- //Select random Bundle
+ // Select random Bundle
int randomIndex = new Random().nextInt(bundles.size());
T_Bundle randomPreKeyBundle = new ArrayList<>(bundles.values()).get(randomIndex);
- //Build raw session
+ // Build raw session
processBundle(omemoManager, randomPreKeyBundle, device);
}
@@ -701,9 +701,9 @@ public abstract class OmemoService messageRecipientKeys = message.getHeader().getKeys();
- //Do we have a key with our ID in the message?
+ // Do we have a key with our ID in the message?
for (OmemoVAxolotlElement.OmemoHeader.Key k : messageRecipientKeys) {
- //Only decrypt with our deviceID
+ // Only decrypt with our deviceID
if (k.getId() != omemoManager.getDeviceId()) {
continue;
}
@@ -785,7 +785,7 @@ public abstract class OmemoService> receivers = new HashMap<>();
for (BareJid recipient : recipients) {
try {
@@ -820,7 +820,7 @@ public abstract class OmemoService result = new ArrayList<>();
for (Forwarded f : mamQueryResult.forwardedMessages) {
if (OmemoManager.stanzaContainsOmemoElement(f.getForwardedStanza())) {
- //Decrypt OMEMO messages
+ // Decrypt OMEMO messages
try {
result.add(processLocalMessage(omemoManager, f.getForwardedStanza().getFrom().asBareJid(), (Message) f.getForwardedStanza()));
} catch (NoRawSessionException | CorruptedOmemoKeyException | CryptoFailedException e) {
@@ -1140,7 +1140,7 @@ public abstract class OmemoService>
sessions = omemoSessions.get(omemoManager);
if (sessions == null) {
@@ -228,12 +228,12 @@ public abstract class OmemoStore ourRawSessions = loadAllRawSessionsOf(omemoManager, omemoManager.getOwnJid());
ourRawSessions.remove(omemoManager.getDeviceId()); //Just to make sure we have no session with ourselves...
sessions.putAll(createOmemoSessionsFromRawSessions(omemoManager, omemoManager.getOwnJid(), ourRawSessions));
- //Sessions with contacts
+ // Sessions with contacts
for (RosterEntry rosterEntry : Roster.getInstanceFor(omemoManager.getConnection()).getEntries()) {
HashMap contactDevices = loadAllRawSessionsOf(omemoManager, rosterEntry.getJid().asBareJid());
sessions.putAll(createOmemoSessionsFromRawSessions(omemoManager, rosterEntry.getJid().asBareJid(), contactDevices));
@@ -284,7 +284,7 @@ public abstract class OmemoStore
session = sessions.get(device);
- //No OmemoSession found
+ // No OmemoSession found
if (session == null) {
T_IdKey identityKey = null;
try {
diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoSession.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoSession.java
index 9674b6afc..119137387 100644
--- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoSession.java
+++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoSession.java
@@ -129,9 +129,9 @@ public abstract class OmemoSession but different namespace " + parser.getNamespace());
break;
@@ -1879,7 +1882,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
try {
listener.processStanza(ackedStanza);
}
- catch (InterruptedException | NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException | NotLoggedInException e) {
LOGGER.log(Level.FINER, "Received exception", e);
}
}
@@ -1892,7 +1895,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
try {
listener.processStanza(ackedStanza);
}
- catch (InterruptedException | NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException | NotLoggedInException e) {
LOGGER.log(Level.FINER, "Received exception", e);
}
}
diff --git a/version.gradle b/version.gradle
index 11c576833..75cedf110 100644
--- a/version.gradle
+++ b/version.gradle
@@ -2,7 +2,7 @@ allprojects {
ext {
shortVersion = '4.3.0-alpha1'
isSnapshot = true
- jxmppVersion = '0.5.0'
+ jxmppVersion = '0.6.0'
smackMinAndroidSdk = 8
}
}