mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-24 15:22:07 +01:00
Enable trailing whitespace checkstyle check
for all source code regions, including javadoc.
This commit is contained in:
parent
9d61a6de7d
commit
e8923b9d16
545 changed files with 3713 additions and 3715 deletions
|
@ -44,21 +44,19 @@
|
||||||
<!--
|
<!--
|
||||||
Explaining the following Regex
|
Explaining the following Regex
|
||||||
|
|
||||||
^ \s* [\S && [^ \*/]]+ \s+ $
|
\s+ $
|
||||||
| | | | | +- End of Line (6)
|
| +- End of Line (2)
|
||||||
| | | | +- At least one whitespace (5)
|
+- At least one whitespace (1)
|
||||||
| | | +- At least one or more of the previous character class (4)
|
|
||||||
| | +- All non-whitespace characters except '*' and '/' (to exclude javadoc) (3)
|
|
||||||
| +- Zero or more space characters (2)
|
|
||||||
+- Start of Line (1)
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
Matches trailing whitespace (5) in lines containing at least one (4) non-whitespace character
|
Matches trailing whitespace (2) in lines containing at least one (1) non-whitespace character
|
||||||
that is not one of the characters used by javadoc (3).
|
|
||||||
-->
|
-->
|
||||||
<property name="format" value="^\s*[\S&&[^\*/]]+\s+$"/>
|
<property name="format" value="\s+$"/>
|
||||||
<property name="message" value="Line containing trailing whitespace character(s)"/>
|
<property name="message" value="Line containing trailing whitespace character(s)"/>
|
||||||
</module>
|
</module>
|
||||||
|
<!-- <module name="RegexpSingleline"> -->
|
||||||
|
<!-- <property name="format" value="fqdn"/> -->
|
||||||
|
<!-- </module> -->
|
||||||
<module name="RegexpSingleline">
|
<module name="RegexpSingleline">
|
||||||
<property name="format" value="^\s*//[^\s]"/>
|
<property name="format" value="^\s*//[^\s]"/>
|
||||||
<property name="message" value="Comment start ('//') followed by non-space character. You would not continue after a punctuation without a space, would you?"/>
|
<property name="message" value="Comment start ('//') followed by non-space character. You would not continue after a punctuation without a space, would you?"/>
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.proxy.ProxyInfo;
|
||||||
/**
|
/**
|
||||||
* Configuration to use while establishing the connection to the XMPP server via
|
* Configuration to use while establishing the connection to the XMPP server via
|
||||||
* HTTP binding.
|
* HTTP binding.
|
||||||
*
|
*
|
||||||
* @see XMPPBOSHConnection
|
* @see XMPPBOSHConnection
|
||||||
* @author Guenther Niess
|
* @author Guenther Niess
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -64,7 +64,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
|
||||||
/**
|
/**
|
||||||
* Creates a connection to an XMPP server via HTTP binding.
|
* Creates a connection to an XMPP server via HTTP binding.
|
||||||
* This is specified in the XEP-0206: XMPP Over BOSH.
|
* This is specified in the XEP-0206: XMPP Over BOSH.
|
||||||
*
|
*
|
||||||
* @see XMPPConnection
|
* @see XMPPConnection
|
||||||
* @author Guenther Niess
|
* @author Guenther Niess
|
||||||
*/
|
*/
|
||||||
|
@ -109,7 +109,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a HTTP Binding connection to an XMPP server.
|
* Create a HTTP Binding connection to an XMPP server.
|
||||||
*
|
*
|
||||||
* @param username the username to use.
|
* @param username the username to use.
|
||||||
* @param password the password to use.
|
* @param password the password to use.
|
||||||
* @param https true if you want to use SSL
|
* @param https true if you want to use SSL
|
||||||
|
@ -131,7 +131,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a HTTP Binding connection to an XMPP server.
|
* Create a HTTP Binding connection to an XMPP server.
|
||||||
*
|
*
|
||||||
* @param config The configuration which is used for this connection.
|
* @param config The configuration which is used for this connection.
|
||||||
*/
|
*/
|
||||||
public XMPPBOSHConnection(BOSHConfiguration config) {
|
public XMPPBOSHConnection(BOSHConfiguration config) {
|
||||||
|
@ -191,7 +191,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
// If there is no feedback, throw an remote server timeout error
|
// If there is no feedback, throw an remote server timeout error
|
||||||
if (!connected && !done) {
|
if (!connected && !done) {
|
||||||
done = true;
|
done = true;
|
||||||
String errorMessage = "Timeout reached for the connection to "
|
String errorMessage = "Timeout reached for the connection to "
|
||||||
+ getHost() + ":" + getPort() + ".";
|
+ getHost() + ":" + getPort() + ".";
|
||||||
throw new SmackException(errorMessage);
|
throw new SmackException(errorMessage);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the connection by setting presence to unavailable and closing the
|
* Closes the connection by setting presence to unavailable and closing the
|
||||||
* HTTP client. The shutdown logic will be used during a planned disconnection or when
|
* HTTP client. The shutdown logic will be used during a planned disconnection or when
|
||||||
* dealing with an unexpected disconnection. Unlike {@link #disconnect()} the connection's
|
* dealing with an unexpected disconnection. Unlike {@link #disconnect()} the connection's
|
||||||
* BOSH stanza reader will not be removed; thus connection's state is kept.
|
* BOSH stanza reader will not be removed; thus connection's state is kept.
|
||||||
|
@ -289,7 +289,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a HTTP request to the connection manager with the provided body element.
|
* Send a HTTP request to the connection manager with the provided body element.
|
||||||
*
|
*
|
||||||
* @param body the body which will be sent.
|
* @param body the body which will be sent.
|
||||||
* @throws BOSHException
|
* @throws BOSHException
|
||||||
*/
|
*/
|
||||||
|
@ -405,7 +405,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
/**
|
/**
|
||||||
* A listener class which listen for a successfully established connection
|
* A listener class which listen for a successfully established connection
|
||||||
* and connection errors and notifies the BOSHConnection.
|
* and connection errors and notifies the BOSHConnection.
|
||||||
*
|
*
|
||||||
* @author Guenther Niess
|
* @author Guenther Niess
|
||||||
*/
|
*/
|
||||||
private class BOSHConnectionListener implements BOSHClientConnListener {
|
private class BOSHConnectionListener implements BOSHClientConnListener {
|
||||||
|
|
|
@ -28,10 +28,10 @@ import com.jcraft.jzlib.InflaterInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides XMPP "zlib" compression with the help of JZLib.
|
* This class provides XMPP "zlib" compression with the help of JZLib.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
* @see <a href="http://www.jcraft.com/jzlib/">JZLib</a>
|
* @see <a href="http://www.jcraft.com/jzlib/">JZLib</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JzlibInputOutputStream extends XMPPInputOutputStream {
|
public class JzlibInputOutputStream extends XMPPInputOutputStream {
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class IQTest extends SmackTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that sending an IQ to a full JID that is offline returns an IQ ERROR instead
|
* Check that sending an IQ to a full JID that is offline returns an IQ ERROR instead
|
||||||
* of being route to some other resource of the same user.
|
* of being route to some other resource of the same user.
|
||||||
*/
|
*/
|
||||||
public void testFullJIDToOfflineUser() {
|
public void testFullJIDToOfflineUser() {
|
||||||
// Request the version from the server.
|
// Request the version from the server.
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.test.SmackTestCase;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes set of login tests.
|
* Includes set of login tests.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
StanzaCollector collector = getConnection(0).createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||||
StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||||
|
|
||||||
// User1 sends a message to the bare JID of User0
|
// User1 sends a message to the bare JID of User0
|
||||||
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
|
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);
|
||||||
chat.sendMessage("Test 1");
|
chat.sendMessage("Test 1");
|
||||||
chat.sendMessage("Test 2");
|
chat.sendMessage("Test 2");
|
||||||
|
@ -325,7 +325,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
StanzaCollector coll3 = conn3.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||||
StanzaCollector coll4 = conn4.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
StanzaCollector coll4 = conn4.createStanzaCollector(new MessageTypeFilter(Message.Type.chat));
|
||||||
|
|
||||||
// Send a message from this resource to indicate most recent activity
|
// Send a message from this resource to indicate most recent activity
|
||||||
conn3.sendStanza(new Message("admin@" + getXMPPServiceDomain()));
|
conn3.sendStanza(new Message("admin@" + getXMPPServiceDomain()));
|
||||||
|
|
||||||
// User1 sends a message to the bare JID of User0
|
// User1 sends a message to the bare JID of User0
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.packet.PrivacyItem;
|
||||||
/**
|
/**
|
||||||
* This class supports automated tests about privacy communication from the
|
* This class supports automated tests about privacy communication from the
|
||||||
* server to the client.
|
* server to the client.
|
||||||
*
|
*
|
||||||
* @author Francisco Vives
|
* @author Francisco Vives
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
private CountDownLatch countDownLatch;
|
private CountDownLatch countDownLatch;
|
||||||
|
|
||||||
private XMPPTCPConnectionTestListener(CountDownLatch latch) {
|
private XMPPTCPConnectionTestListener(CountDownLatch latch) {
|
||||||
countDownLatch = latch;
|
countDownLatch = latch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private XMPPTCPConnectionTestListener() {
|
private XMPPTCPConnectionTestListener() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ package org.jivesoftware.smack;
|
||||||
/**
|
/**
|
||||||
* Run all tests defined in RosterTest but initialize the roster before connection is logged in and
|
* Run all tests defined in RosterTest but initialize the roster before connection is logged in and
|
||||||
* authenticated.
|
* authenticated.
|
||||||
*
|
*
|
||||||
* @author Henning Staib
|
* @author Henning Staib
|
||||||
*/
|
*/
|
||||||
public class RosterInitializedBeforeConnectTest extends RosterSmackTest {
|
public class RosterInitializedBeforeConnectTest extends RosterSmackTest {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.jivesoftware.smack.test.SmackTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases for adding the {@link RosterListener} in different connection states.
|
* Test cases for adding the {@link RosterListener} in different connection states.
|
||||||
*
|
*
|
||||||
* @author Henning Staib
|
* @author Henning Staib
|
||||||
*/
|
*/
|
||||||
public class RosterListenerTest extends SmackTestCase {
|
public class RosterListenerTest extends SmackTestCase {
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class RosterSmackTest extends SmackTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void entriesAdded(Collection<String> addresses) {}
|
public void entriesAdded(Collection<String> addresses) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
roster.addRosterListener(latchCounter);
|
roster.addRosterListener(latchCounter);
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ public class RosterSmackTest extends SmackTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test presence management.<p>
|
* Test presence management.<p>
|
||||||
*
|
*
|
||||||
* 1. Log in user0 from a client and user1 from 2 clients
|
* 1. Log in user0 from a client and user1 from 2 clients
|
||||||
* 2. Create presence subscription of type BOTH between 2 users
|
* 2. Create presence subscription of type BOTH between 2 users
|
||||||
* 3. Check that presence is correctly delivered to both users
|
* 3. Check that presence is correctly delivered to both users
|
||||||
|
@ -699,12 +699,12 @@ public class RosterSmackTest extends SmackTestCase {
|
||||||
public void entriesUpdated(Collection<String> addresses) {}
|
public void entriesUpdated(Collection<String> addresses) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void entriesDeleted(Collection<String> addresses) {
|
public void entriesDeleted(Collection<String> addresses) {
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void entriesAdded(Collection<String> addresses) {}
|
public void entriesAdded(Collection<String> addresses) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the PrivacyProvider class with valids privacy xmls
|
* Test the PrivacyProvider class with valids privacy xmls
|
||||||
*
|
*
|
||||||
* @author Francisco Vives
|
* @author Francisco Vives
|
||||||
*/
|
*/
|
||||||
public class PrivacyProviderTest extends SmackTestCase {
|
public class PrivacyProviderTest extends SmackTestCase {
|
||||||
|
@ -47,7 +47,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the parser with an xml with all kind of stanzas.
|
* Check the parser with an xml with all kind of stanzas.
|
||||||
* To create the xml string based from an xml file, replace:\n with: "\n + "
|
* To create the xml string based from an xml file, replace:\n with: "\n + "
|
||||||
*/
|
*/
|
||||||
public void testFull() {
|
public void testFull() {
|
||||||
|
@ -296,7 +296,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the parser with an xml with empty lists. It includes the active,
|
* Check the parser with an xml with empty lists. It includes the active,
|
||||||
* default and special list.
|
* default and special list.
|
||||||
* To create the xml string based from an xml file, replace:\n with: "\n + "
|
* To create the xml string based from an xml file, replace:\n with: "\n + "
|
||||||
*/
|
*/
|
||||||
|
@ -338,7 +338,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the parser with an xml with empty lists. It includes the active,
|
* Check the parser with an xml with empty lists. It includes the active,
|
||||||
* default and special list.
|
* default and special list.
|
||||||
* To create the xml string based from an xml file, replace:\n with: "\n + "
|
* To create the xml string based from an xml file, replace:\n with: "\n + "
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -452,7 +452,7 @@ public class PrivacyTest extends SmackTestCase {
|
||||||
// Look for the same server and original items
|
// Look for the same server and original items
|
||||||
receivedItem = privacyItems.get(j);
|
receivedItem = privacyItems.get(j);
|
||||||
index = 0;
|
index = 0;
|
||||||
while ((index < originalPrivacyItems.length)
|
while ((index < originalPrivacyItems.length)
|
||||||
&& (originalPrivacyItems[index].getOrder() != receivedItem.getOrder())) {
|
&& (originalPrivacyItems[index].getOrder() != receivedItem.getOrder())) {
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ public class PrivacyTest extends SmackTestCase {
|
||||||
/**
|
/**
|
||||||
* This class supports automated tests about privacy communication from the
|
* This class supports automated tests about privacy communication from the
|
||||||
* server to the client.
|
* server to the client.
|
||||||
*
|
*
|
||||||
* @author Francisco Vives
|
* @author Francisco Vives
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -36,17 +36,17 @@ import org.xmlpull.v1.XmlPullParserFactory;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all the test cases which provides a pre-configured execution context. This
|
* Base class for all the test cases which provides a pre-configured execution context. This
|
||||||
* means that any test case that subclassifies this base class will have access to a pool of
|
* means that any test case that subclassifies this base class will have access to a pool of
|
||||||
* connections and to the user of each connection. The maximum number of connections in the pool
|
* connections and to the user of each connection. The maximum number of connections in the pool
|
||||||
* can be controlled by the message {@link #getMaxConnections()} which every subclass must
|
* can be controlled by the message {@link #getMaxConnections()} which every subclass must
|
||||||
* implement.<p>
|
* implement.<p>
|
||||||
*
|
*
|
||||||
* This base class defines a default execution context (i.e. host, port, chat domain and muc
|
* This base class defines a default execution context (i.e. host, port, chat domain and muc
|
||||||
* domain) which can be found in the file "config/test-case.xml". However, each subclass could
|
* domain) which can be found in the file "config/test-case.xml". However, each subclass could
|
||||||
* redefine the default configuration by providing its own configuration file (if desired). The
|
* redefine the default configuration by providing its own configuration file (if desired). The
|
||||||
* name of the configuration file must be of the form <test class name>.xml (e.g. RosterTest.xml).
|
* name of the configuration file must be of the form <test class name>.xml (e.g. RosterTest.xml).
|
||||||
* The file must be placed in the folder "config". This folder is where the default configuration
|
* The file must be placed in the folder "config". This folder is where the default configuration
|
||||||
* file is being held.
|
* file is being held.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
|
@ -81,21 +81,21 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum number of connections to initialize for this test case. All the
|
* Returns the maximum number of connections to initialize for this test case. All the
|
||||||
* initialized connections will be connected to the server using a new test account for
|
* initialized connections will be connected to the server using a new test account for
|
||||||
* each conection.
|
* each conection.
|
||||||
*
|
*
|
||||||
* @return the maximum number of connections to initialize for this test case.
|
* @return the maximum number of connections to initialize for this test case.
|
||||||
*/
|
*/
|
||||||
protected abstract int getMaxConnections();
|
protected abstract int getMaxConnections();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a SocketFactory that will be used to create the socket to the XMPP server. By
|
* Returns a SocketFactory that will be used to create the socket to the XMPP server. By
|
||||||
* default no SocketFactory is used but subclasses my want to redefine this method.<p>
|
* default no SocketFactory is used but subclasses my want to redefine this method.<p>
|
||||||
*
|
*
|
||||||
* A custom SocketFactory allows fine-grained control of the actual connection to the XMPP
|
* A custom SocketFactory allows fine-grained control of the actual connection to the XMPP
|
||||||
* server. A typical use for a custom SocketFactory is when connecting through a SOCKS proxy.
|
* server. A typical use for a custom SocketFactory is when connecting through a SOCKS proxy.
|
||||||
*
|
*
|
||||||
* @return a SocketFactory that will be used to create the socket to the XMPP server.
|
* @return a SocketFactory that will be used to create the socket to the XMPP server.
|
||||||
*/
|
*/
|
||||||
protected SocketFactory getSocketFactory() {
|
protected SocketFactory getSocketFactory() {
|
||||||
|
@ -111,7 +111,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
* <p>
|
* <p>
|
||||||
* Connections are connected by default.
|
* Connections are connected by default.
|
||||||
* Overwrite this method if the test case needs unconnected connections.
|
* Overwrite this method if the test case needs unconnected connections.
|
||||||
*
|
*
|
||||||
* @return <code>true</code> if connections should NOT be connected automatically,
|
* @return <code>true</code> if connections should NOT be connected automatically,
|
||||||
* <code>false</code> if connections should be connected automatically.
|
* <code>false</code> if connections should be connected automatically.
|
||||||
*/
|
*/
|
||||||
|
@ -123,11 +123,11 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
* Returns the XMPPTCPConnection located at the requested position. Each test case holds a
|
* Returns the XMPPTCPConnection located at the requested position. Each test case holds a
|
||||||
* pool of connections which is initialized while setting up the test case. The maximum
|
* pool of connections which is initialized while setting up the test case. The maximum
|
||||||
* number of connections is controlled by the message {@link #getMaxConnections()} which
|
* number of connections is controlled by the message {@link #getMaxConnections()} which
|
||||||
* every subclass must implement.<p>
|
* every subclass must implement.<p>
|
||||||
*
|
*
|
||||||
* If the requested position is greater than the connections size then an
|
* If the requested position is greater than the connections size then an
|
||||||
* IllegalArgumentException will be thrown.
|
* IllegalArgumentException will be thrown.
|
||||||
*
|
*
|
||||||
* @param index the position in the pool of the connection to look for.
|
* @param index the position in the pool of the connection to look for.
|
||||||
* @return the XMPPTCPConnection located at the requested position.
|
* @return the XMPPTCPConnection located at the requested position.
|
||||||
*/
|
*/
|
||||||
|
@ -156,9 +156,9 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the user (e.g. johndoe) that is using the connection
|
* Returns the name of the user (e.g. johndoe) that is using the connection
|
||||||
* located at the requested position.
|
* located at the requested position.
|
||||||
*
|
*
|
||||||
* @param index the position in the pool of the connection to look for.
|
* @param index the position in the pool of the connection to look for.
|
||||||
* @return the user of the user (e.g. johndoe).
|
* @return the user of the user (e.g. johndoe).
|
||||||
*/
|
*/
|
||||||
|
@ -167,9 +167,9 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the password of the user (e.g. johndoe) that is using the connection
|
* Returns the password of the user (e.g. johndoe) that is using the connection
|
||||||
* located at the requested position.
|
* located at the requested position.
|
||||||
*
|
*
|
||||||
* @param index the position in the pool of the connection to look for.
|
* @param index the position in the pool of the connection to look for.
|
||||||
* @return the password of the user (e.g. johndoe).
|
* @return the password of the user (e.g. johndoe).
|
||||||
*/
|
*/
|
||||||
|
@ -180,7 +180,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Returns the bare XMPP address of the user (e.g. johndoe@jabber.org) that is
|
* Returns the bare XMPP address of the user (e.g. johndoe@jabber.org) that is
|
||||||
* using the connection located at the requested position.
|
* using the connection located at the requested position.
|
||||||
*
|
*
|
||||||
* @param index the position in the pool of the connection to look for.
|
* @param index the position in the pool of the connection to look for.
|
||||||
* @return the bare XMPP address of the user (e.g. johndoe@jabber.org).
|
* @return the bare XMPP address of the user (e.g. johndoe@jabber.org).
|
||||||
*/
|
*/
|
||||||
|
@ -191,7 +191,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Returns the full XMPP address of the user (e.g. johndoe@jabber.org/Smack) that is
|
* Returns the full XMPP address of the user (e.g. johndoe@jabber.org/Smack) that is
|
||||||
* using the connection located at the requested position.
|
* using the connection located at the requested position.
|
||||||
*
|
*
|
||||||
* @param index the position in the pool of the connection to look for.
|
* @param index the position in the pool of the connection to look for.
|
||||||
* @return the full XMPP address of the user (e.g. johndoe@jabber.org/Smack).
|
* @return the full XMPP address of the user (e.g. johndoe@jabber.org/Smack).
|
||||||
*/
|
*/
|
||||||
|
@ -213,7 +213,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default groupchat service domain.
|
* Returns the default groupchat service domain.
|
||||||
*
|
*
|
||||||
* @return the default groupchat service domain.
|
* @return the default groupchat service domain.
|
||||||
*/
|
*/
|
||||||
protected String getChatDomain() {
|
protected String getChatDomain() {
|
||||||
|
@ -222,7 +222,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default MUC service domain.
|
* Returns the default MUC service domain.
|
||||||
*
|
*
|
||||||
* @return the default MUC service domain.
|
* @return the default MUC service domain.
|
||||||
*/
|
*/
|
||||||
protected String getMUCDomain() {
|
protected String getMUCDomain() {
|
||||||
|
@ -273,7 +273,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
if (!getConnection(0).getAccountManager().supportsAccountCreation())
|
if (!getConnection(0).getAccountManager().supportsAccountCreation())
|
||||||
fail("Server does not support account creation");
|
fail("Server does not support account creation");
|
||||||
|
|
||||||
// Create the account and try logging in again as the
|
// Create the account and try logging in again as the
|
||||||
// same user.
|
// same user.
|
||||||
try {
|
try {
|
||||||
createAccount(i, currentUser, currentPassword);
|
createAccount(i, currentUser, currentPassword);
|
||||||
|
@ -345,7 +345,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
con.login(getUsername(i), getUsername(i));
|
con.login(getUsername(i), getUsername(i));
|
||||||
}
|
}
|
||||||
else if (!getConnection(i).isAuthenticated()) {
|
else if (!getConnection(i).isAuthenticated()) {
|
||||||
getConnection(i).login(getUsername(i), getUsername(i));
|
getConnection(i).login(getUsername(i), getUsername(i));
|
||||||
}
|
}
|
||||||
// Delete the created account for the test
|
// Delete the created account for the test
|
||||||
getConnection(i).getAccountManager().deleteAccount();
|
getConnection(i).getAccountManager().deleteAccount();
|
||||||
|
@ -366,22 +366,22 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the context of the test case. We will first try to load the configuration from
|
* Initializes the context of the test case. We will first try to load the configuration from
|
||||||
* a file whose name is conformed by the test case class name plus an .xml extension
|
* a file whose name is conformed by the test case class name plus an .xml extension
|
||||||
* (e.g RosterTest.xml). If no file was found under that name then we will try to load the
|
* (e.g RosterTest.xml). If no file was found under that name then we will try to load the
|
||||||
* default configuration for all the test cases from the file "config/test-case.xml".
|
* default configuration for all the test cases from the file "config/test-case.xml".
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void init() {
|
private void init() {
|
||||||
try {
|
try {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
// Try to load the configutation from an XML file specific for this test case
|
// Try to load the configutation from an XML file specific for this test case
|
||||||
Enumeration<URL> resources =
|
Enumeration<URL> resources =
|
||||||
ClassLoader.getSystemClassLoader().getResources(getConfigurationFilename());
|
ClassLoader.getSystemClassLoader().getResources(getConfigurationFilename());
|
||||||
while (resources.hasMoreElements()) {
|
while (resources.hasMoreElements()) {
|
||||||
found = parseURL(resources.nextElement());
|
found = parseURL(resources.nextElement());
|
||||||
}
|
}
|
||||||
// If none was found then try to load the configuration from the default configuration
|
// If none was found then try to load the configuration from the default configuration
|
||||||
// file (i.e. "config/test-case.xml")
|
// file (i.e. "config/test-case.xml")
|
||||||
if (!found) {
|
if (!found) {
|
||||||
resources = ClassLoader.getSystemClassLoader().getResources("config/test-case.xml");
|
resources = ClassLoader.getSystemClassLoader().getResources("config/test-case.xml");
|
||||||
|
@ -401,8 +401,8 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Returns true if the given URL was found and parsed without problems. The file provided
|
* Returns true if the given URL was found and parsed without problems. The file provided
|
||||||
* by the URL must contain information useful for the test case configuration, such us,
|
* by the URL must contain information useful for the test case configuration, such us,
|
||||||
* host and port of the server.
|
* host and port of the server.
|
||||||
*
|
*
|
||||||
* @param url the url of the file to parse.
|
* @param url the url of the file to parse.
|
||||||
* @return true if the given URL was found and parsed without problems.
|
* @return true if the given URL was found and parsed without problems.
|
||||||
*/
|
*/
|
||||||
|
@ -487,11 +487,11 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the configuration file related to <b>this</b> test case. By default all
|
* Returns the name of the configuration file related to <b>this</b> test case. By default all
|
||||||
* the test cases will use the same configuration file. However, it's possible to override the
|
* the test cases will use the same configuration file. However, it's possible to override the
|
||||||
* default configuration by providing a file of the form <test case class name>.xml
|
* default configuration by providing a file of the form <test case class name>.xml
|
||||||
* (e.g. RosterTest.xml).
|
* (e.g. RosterTest.xml).
|
||||||
*
|
*
|
||||||
* @return the name of the configuration file related to this test case.
|
* @return the name of the configuration file related to this test case.
|
||||||
*/
|
*/
|
||||||
private String getConfigurationFilename() {
|
private String getConfigurationFilename() {
|
||||||
|
@ -502,7 +502,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribes all connections with each other: They all become friends
|
* Subscribes all connections with each other: They all become friends
|
||||||
*
|
*
|
||||||
* @throws XMPPException
|
* @throws XMPPException
|
||||||
*/
|
*/
|
||||||
protected void letsAllBeFriends() throws XMPPException {
|
protected void letsAllBeFriends() throws XMPPException {
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smack;
|
||||||
* methods defined by the {@link ConnectionListener} interface. This is a
|
* methods defined by the {@link ConnectionListener} interface. This is a
|
||||||
* convenience class which should be used in case you do not need to implement
|
* convenience class which should be used in case you do not need to implement
|
||||||
* all methods.
|
* all methods.
|
||||||
*
|
*
|
||||||
* @author Henning Staib
|
* @author Henning Staib
|
||||||
*/
|
*/
|
||||||
public class AbstractConnectionListener implements ConnectionListener {
|
public class AbstractConnectionListener implements ConnectionListener {
|
||||||
|
|
|
@ -100,7 +100,7 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
public abstract class AbstractXMPPConnection implements XMPPConnection {
|
public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
private static final Logger LOGGER = Logger.getLogger(AbstractXMPPConnection.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(AbstractXMPPConnection.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Counter to uniquely identify connections that are created.
|
* Counter to uniquely identify connections that are created.
|
||||||
*/
|
*/
|
||||||
private static final AtomicInteger connectionCounter = new AtomicInteger(0);
|
private static final AtomicInteger connectionCounter = new AtomicInteger(0);
|
||||||
|
@ -293,7 +293,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new XMPPConnection to an XMPP server.
|
* Create a new XMPPConnection to an XMPP server.
|
||||||
*
|
*
|
||||||
* @param configuration The configuration which is used to establish the connection.
|
* @param configuration The configuration which is used to establish the connection.
|
||||||
*/
|
*/
|
||||||
protected AbstractXMPPConnection(ConnectionConfiguration configuration) {
|
protected AbstractXMPPConnection(ConnectionConfiguration configuration) {
|
||||||
|
@ -355,12 +355,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* <p>
|
* <p>
|
||||||
* Listeners will be preserved from a previous connection.
|
* Listeners will be preserved from a previous connection.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @throws XMPPException if an error occurs on the XMPP protocol level.
|
* @throws XMPPException if an error occurs on the XMPP protocol level.
|
||||||
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
|
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @return a reference to this object, to chain <code>connect()</code> with <code>login()</code>.
|
* @return a reference to this object, to chain <code>connect()</code> with <code>login()</code>.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public synchronized AbstractXMPPConnection connect() throws SmackException, IOException, XMPPException, InterruptedException {
|
public synchronized AbstractXMPPConnection connect() throws SmackException, IOException, XMPPException, InterruptedException {
|
||||||
// Check if not already connected
|
// Check if not already connected
|
||||||
|
@ -395,11 +395,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* Abstract method that concrete subclasses of XMPPConnection need to implement to perform their
|
* Abstract method that concrete subclasses of XMPPConnection need to implement to perform their
|
||||||
* way of XMPP connection establishment. Implementations are required to perform an automatic
|
* way of XMPP connection establishment. Implementations are required to perform an automatic
|
||||||
* login if the previous connection state was logged (authenticated).
|
* login if the previous connection state was logged (authenticated).
|
||||||
*
|
*
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws XMPPException
|
* @throws XMPPException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
protected abstract void connectInternal() throws SmackException, IOException, XMPPException, InterruptedException;
|
protected abstract void connectInternal() throws SmackException, IOException, XMPPException, InterruptedException;
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs in to the server using the strongest SASL mechanism supported by
|
* Logs in to the server using the strongest SASL mechanism supported by
|
||||||
* the server. If more than the connection's default stanza timeout elapses in each step of the
|
* the server. If more than the connection's default stanza timeout elapses in each step of the
|
||||||
* authentication process without a response from the server, a
|
* authentication process without a response from the server, a
|
||||||
* {@link SmackException.NoResponseException} will be thrown.
|
* {@link SmackException.NoResponseException} will be thrown.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -427,11 +427,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* {@link ConnectionConfiguration.Builder#setCallbackHandler(javax.security.auth.callback.CallbackHandler)}.
|
* {@link ConnectionConfiguration.Builder#setCallbackHandler(javax.security.auth.callback.CallbackHandler)}.
|
||||||
* For more advanced login settings see {@link ConnectionConfiguration}.
|
* For more advanced login settings see {@link ConnectionConfiguration}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @throws XMPPException if an error occurs on the XMPP protocol level.
|
* @throws XMPPException if an error occurs on the XMPP protocol level.
|
||||||
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
|
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
|
||||||
* @throws IOException if an I/O error occurs during login.
|
* @throws IOException if an I/O error occurs during login.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public synchronized void login() throws XMPPException, SmackException, IOException, InterruptedException {
|
public synchronized void login() throws XMPPException, SmackException, IOException, InterruptedException {
|
||||||
// The previously used username, password and resource take over precedence over the
|
// The previously used username, password and resource take over precedence over the
|
||||||
|
@ -445,13 +445,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Same as {@link #login(CharSequence, String, Resourcepart)}, but takes the resource from the connection
|
* Same as {@link #login(CharSequence, String, Resourcepart)}, but takes the resource from the connection
|
||||||
* configuration.
|
* configuration.
|
||||||
*
|
*
|
||||||
* @param username
|
* @param username
|
||||||
* @param password
|
* @param password
|
||||||
* @throws XMPPException
|
* @throws XMPPException
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @see #login
|
* @see #login
|
||||||
*/
|
*/
|
||||||
public synchronized void login(CharSequence username, String password) throws XMPPException, SmackException,
|
public synchronized void login(CharSequence username, String password) throws XMPPException, SmackException,
|
||||||
|
@ -462,14 +462,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Login with the given username (authorization identity). You may omit the password if a callback handler is used.
|
* Login with the given username (authorization identity). You may omit the password if a callback handler is used.
|
||||||
* If resource is null, then the server will generate one.
|
* If resource is null, then the server will generate one.
|
||||||
*
|
*
|
||||||
* @param username
|
* @param username
|
||||||
* @param password
|
* @param password
|
||||||
* @param resource
|
* @param resource
|
||||||
* @throws XMPPException
|
* @throws XMPPException
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @see #login
|
* @see #login
|
||||||
*/
|
*/
|
||||||
public synchronized void login(CharSequence username, String password, Resourcepart resource) throws XMPPException,
|
public synchronized void login(CharSequence username, String password, Resourcepart resource) throws XMPPException,
|
||||||
|
@ -580,7 +580,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* Get the name of the SASL mechanism that was used to authenticate this connection. This returns the name of
|
* Get the name of the SASL mechanism that was used to authenticate this connection. This returns the name of
|
||||||
* mechanism which was used the last time this connection was authenticated, and will return <code>null</code> if
|
* mechanism which was used the last time this connection was authenticated, and will return <code>null</code> if
|
||||||
* this connection was not authenticated before.
|
* this connection was not authenticated before.
|
||||||
*
|
*
|
||||||
* @return the name of the used SASL mechanism.
|
* @return the name of the used SASL mechanism.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
|
@ -674,7 +674,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the SASLAuthentication manager that is responsible for authenticating with
|
* Returns the SASLAuthentication manager that is responsible for authenticating with
|
||||||
* the server.
|
* the server.
|
||||||
*
|
*
|
||||||
* @return the SASLAuthentication manager that is responsible for authenticating with
|
* @return the SASLAuthentication manager that is responsible for authenticating with
|
||||||
* the server.
|
* the server.
|
||||||
*/
|
*/
|
||||||
|
@ -708,9 +708,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* information such as "On vacation". Typically, just the status text of the presence
|
* information such as "On vacation". Typically, just the status text of the presence
|
||||||
* stanza is set with online information, but most XMPP servers will deliver the full
|
* stanza is set with online information, but most XMPP servers will deliver the full
|
||||||
* presence stanza with whatever data is set.
|
* presence stanza with whatever data is set.
|
||||||
*
|
*
|
||||||
* @param unavailablePresence the optional presence stanza to send during shutdown.
|
* @param unavailablePresence the optional presence stanza to send during shutdown.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
|
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
|
||||||
if (unavailablePresence != null) {
|
if (unavailablePresence != null) {
|
||||||
|
@ -871,7 +871,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* <p>
|
* <p>
|
||||||
* Compared to {@link #firePacketInterceptors(Stanza)}, the listeners will be invoked in a new thread.
|
* Compared to {@link #firePacketInterceptors(Stanza)}, the listeners will be invoked in a new thread.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param packet the stanza to process.
|
* @param packet the stanza to process.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
|
@ -946,7 +946,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* Since the thread that requested to send the stanza will invoke all interceptors, it
|
* Since the thread that requested to send the stanza will invoke all interceptors, it
|
||||||
* is important that interceptors perform their work as soon as possible so that the
|
* is important that interceptors perform their work as soon as possible so that the
|
||||||
* thread does not remain blocked for a long period.
|
* thread does not remain blocked for a long period.
|
||||||
*
|
*
|
||||||
* @param packet the stanza that is going to be sent to the server
|
* @param packet the stanza that is going to be sent to the server
|
||||||
*/
|
*/
|
||||||
private void firePacketInterceptors(Stanza packet) {
|
private void firePacketInterceptors(Stanza packet) {
|
||||||
|
@ -970,7 +970,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Initialize the {@link #debugger}. You can specify a customized {@link SmackDebugger}
|
* Initialize the {@link #debugger}. You can specify a customized {@link SmackDebugger}
|
||||||
* by setup the system property <code>smack.debuggerClass</code> to the implementation.
|
* by setup the system property <code>smack.debuggerClass</code> to the implementation.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException if the reader or writer isn't yet initialized.
|
* @throws IllegalStateException if the reader or writer isn't yet initialized.
|
||||||
* @throws IllegalArgumentException if the SmackDebugger can't be loaded.
|
* @throws IllegalArgumentException if the SmackDebugger can't be loaded.
|
||||||
*/
|
*/
|
||||||
|
@ -1208,7 +1208,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Sets whether the connection has already logged in the server. This method assures that the
|
* Sets whether the connection has already logged in the server. This method assures that the
|
||||||
* {@link #wasAuthenticated} flag is never reset once it has ever been set.
|
* {@link #wasAuthenticated} flag is never reset once it has ever been set.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void setWasAuthenticated() {
|
protected void setWasAuthenticated() {
|
||||||
// Never reset the flag if the connection has ever been authenticated
|
// Never reset the flag if the connection has ever been authenticated
|
||||||
|
@ -1284,7 +1284,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a class which associates a stanza filter with a listener.
|
* Create a class which associates a stanza filter with a listener.
|
||||||
*
|
*
|
||||||
* @param packetListener the stanza listener.
|
* @param packetListener the stanza listener.
|
||||||
* @param packetFilter the associated filter or null if it listen for all packets.
|
* @param packetFilter the associated filter or null if it listen for all packets.
|
||||||
*/
|
*/
|
||||||
|
@ -1312,7 +1312,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a class which associates a stanza filter with an interceptor.
|
* Create a class which associates a stanza filter with an interceptor.
|
||||||
*
|
*
|
||||||
* @param packetInterceptor the interceptor.
|
* @param packetInterceptor the interceptor.
|
||||||
* @param packetFilter the associated filter or null if it intercepts all packets.
|
* @param packetFilter the associated filter or null if it intercepts all packets.
|
||||||
*/
|
*/
|
||||||
|
@ -1681,7 +1681,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Install a parsing exception callback, which will be invoked once an exception is encountered while parsing a
|
* Install a parsing exception callback, which will be invoked once an exception is encountered while parsing a
|
||||||
* stanza.
|
* stanza.
|
||||||
*
|
*
|
||||||
* @param callback the callback to install
|
* @param callback the callback to install
|
||||||
*/
|
*/
|
||||||
public void setParsingExceptionCallback(ParsingExceptionCallback callback) {
|
public void setParsingExceptionCallback(ParsingExceptionCallback callback) {
|
||||||
|
@ -1690,7 +1690,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current active parsing exception callback.
|
* Get the current active parsing exception callback.
|
||||||
*
|
*
|
||||||
* @return the active exception callback or null if there is none
|
* @return the active exception callback or null if there is none
|
||||||
*/
|
*/
|
||||||
public ParsingExceptionCallback getParsingExceptionCallback() {
|
public ParsingExceptionCallback getParsingExceptionCallback() {
|
||||||
|
|
|
@ -107,12 +107,12 @@ public abstract class ConnectionConfiguration {
|
||||||
private final X509TrustManager customX509TrustManager;
|
private final X509TrustManager customX509TrustManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private final String[] enabledSSLProtocols;
|
private final String[] enabledSSLProtocols;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private final String[] enabledSSLCiphers;
|
private final String[] enabledSSLCiphers;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public abstract class ConnectionConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retuns the path to the keystore file. The key store file contains the
|
* Retuns the path to the keystore file. The key store file contains the
|
||||||
* certificates that may be used to authenticate the client to the server,
|
* certificates that may be used to authenticate the client to the server,
|
||||||
* in the event the server requests or requires it.
|
* in the event the server requests or requires it.
|
||||||
*
|
*
|
||||||
|
@ -271,7 +271,7 @@ public abstract class ConnectionConfiguration {
|
||||||
* Returns the configured HostnameVerifier of this ConnectionConfiguration or the Smack default
|
* Returns the configured HostnameVerifier of this ConnectionConfiguration or the Smack default
|
||||||
* HostnameVerifier configured with
|
* HostnameVerifier configured with
|
||||||
* {@link SmackConfiguration#setDefaultHostnameVerifier(HostnameVerifier)}.
|
* {@link SmackConfiguration#setDefaultHostnameVerifier(HostnameVerifier)}.
|
||||||
*
|
*
|
||||||
* @return a configured HostnameVerifier or <code>null</code>
|
* @return a configured HostnameVerifier or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public HostnameVerifier getHostnameVerifier() {
|
public HostnameVerifier getHostnameVerifier() {
|
||||||
|
@ -305,7 +305,7 @@ public abstract class ConnectionConfiguration {
|
||||||
/**
|
/**
|
||||||
* Returns the socket factory used to create new xmppConnection sockets.
|
* Returns the socket factory used to create new xmppConnection sockets.
|
||||||
* This is useful when connecting through SOCKS5 proxies.
|
* This is useful when connecting through SOCKS5 proxies.
|
||||||
*
|
*
|
||||||
* @return socketFactory used to create new sockets.
|
* @return socketFactory used to create new sockets.
|
||||||
*/
|
*/
|
||||||
public SocketFactory getSocketFactory() {
|
public SocketFactory getSocketFactory() {
|
||||||
|
@ -413,7 +413,7 @@ public abstract class ConnectionConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the optional XMPP address to be requested as the SASL authorization identity.
|
* Returns the optional XMPP address to be requested as the SASL authorization identity.
|
||||||
*
|
*
|
||||||
* @return the authorization identifier.
|
* @return the authorization identifier.
|
||||||
* @see <a href="http://tools.ietf.org/html/rfc6120#section-6.3.8">RFC 6120 § 6.3.8. Authorization Identity</a>
|
* @see <a href="http://tools.ietf.org/html/rfc6120#section-6.3.8">RFC 6120 § 6.3.8. Authorization Identity</a>
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
|
@ -689,7 +689,7 @@ public abstract class ConnectionConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the path to the keystore file. The key store file contains the
|
* Sets the path to the keystore file. The key store file contains the
|
||||||
* certificates that may be used to authenticate the client to the server,
|
* certificates that may be used to authenticate the client to the server,
|
||||||
* in the event the server requests or requires it.
|
* in the event the server requests or requires it.
|
||||||
*
|
*
|
||||||
|
@ -752,8 +752,8 @@ public abstract class ConnectionConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the enabled SSL/TLS ciphers.
|
* Set the enabled SSL/TLS ciphers.
|
||||||
*
|
*
|
||||||
* @param enabledSSLCiphers the enabled SSL/TLS ciphers
|
* @param enabledSSLCiphers the enabled SSL/TLS ciphers
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
*/
|
*/
|
||||||
public B setEnabledSSLCiphers(String[] enabledSSLCiphers) {
|
public B setEnabledSSLCiphers(String[] enabledSSLCiphers) {
|
||||||
|
@ -764,7 +764,7 @@ public abstract class ConnectionConfiguration {
|
||||||
/**
|
/**
|
||||||
* Set the HostnameVerifier used to verify the hostname of SSLSockets used by XMPP connections
|
* Set the HostnameVerifier used to verify the hostname of SSLSockets used by XMPP connections
|
||||||
* created with this ConnectionConfiguration.
|
* created with this ConnectionConfiguration.
|
||||||
*
|
*
|
||||||
* @param verifier
|
* @param verifier
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
*/
|
*/
|
||||||
|
@ -795,7 +795,7 @@ public abstract class ConnectionConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Smack debugger factory used to construct Smack debuggers.
|
* Set the Smack debugger factory used to construct Smack debuggers.
|
||||||
*
|
*
|
||||||
* @param debuggerFactory the Smack debugger factory.
|
* @param debuggerFactory the Smack debugger factory.
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
*/
|
*/
|
||||||
|
@ -832,7 +832,7 @@ public abstract class ConnectionConfiguration {
|
||||||
*
|
*
|
||||||
* Some SASL mechanisms (e.g. SASL External) may also signal the username (as "authorization identity"), in
|
* Some SASL mechanisms (e.g. SASL External) may also signal the username (as "authorization identity"), in
|
||||||
* which case Smack should not throw an IllegalArgumentException when the username is not set.
|
* which case Smack should not throw an IllegalArgumentException when the username is not set.
|
||||||
*
|
*
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
*/
|
*/
|
||||||
public B allowEmptyOrNullUsernames() {
|
public B allowEmptyOrNullUsernames() {
|
||||||
|
@ -843,7 +843,7 @@ public abstract class ConnectionConfiguration {
|
||||||
/**
|
/**
|
||||||
* Perform anonymous authentication using SASL ANONYMOUS. Your XMPP service must support this authentication
|
* Perform anonymous authentication using SASL ANONYMOUS. Your XMPP service must support this authentication
|
||||||
* mechanism. This method also calls {@link #addEnabledSaslMechanism(String)} with "ANONYMOUS" as argument.
|
* mechanism. This method also calls {@link #addEnabledSaslMechanism(String)} with "ANONYMOUS" as argument.
|
||||||
*
|
*
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
*/
|
*/
|
||||||
public B performSaslAnonymousAuthentication() {
|
public B performSaslAnonymousAuthentication() {
|
||||||
|
@ -902,7 +902,7 @@ public abstract class ConnectionConfiguration {
|
||||||
* Enable the given SASL mechanisms. If you never add a mechanism to the set of enabled ones, <b>all mechanisms
|
* Enable the given SASL mechanisms. If you never add a mechanism to the set of enabled ones, <b>all mechanisms
|
||||||
* known to Smack</b> will be enabled. Only explicitly enable particular SASL mechanisms if you want to limit
|
* known to Smack</b> will be enabled. Only explicitly enable particular SASL mechanisms if you want to limit
|
||||||
* the used mechanisms to the enabled ones.
|
* the used mechanisms to the enabled ones.
|
||||||
*
|
*
|
||||||
* @param saslMechanisms a collection of names of mechanisms to enable.
|
* @param saslMechanisms a collection of names of mechanisms to enable.
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
*/
|
*/
|
||||||
|
@ -935,7 +935,7 @@ public abstract class ConnectionConfiguration {
|
||||||
* service domain, which should typically match.
|
* service domain, which should typically match.
|
||||||
* Calling this will also SASL CRAM, since this mechanism does not support authzid.
|
* Calling this will also SASL CRAM, since this mechanism does not support authzid.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param authzid The BareJid to be requested as the authorization identifier.
|
* @param authzid The BareJid to be requested as the authorization identifier.
|
||||||
* @return a reference to this builder.
|
* @return a reference to this builder.
|
||||||
* @see <a href="http://tools.ietf.org/html/rfc6120#section-6.3.8">RFC 6120 § 6.3.8. Authorization Identity</a>
|
* @see <a href="http://tools.ietf.org/html/rfc6120#section-6.3.8">RFC 6120 § 6.3.8. Authorization Identity</a>
|
||||||
|
|
|
@ -30,7 +30,7 @@ public interface ConnectionCreationListener {
|
||||||
/**
|
/**
|
||||||
* Notification that a new connection has been created. The new connection
|
* Notification that a new connection has been created. The new connection
|
||||||
* will not yet be connected to the server.
|
* will not yet be connected to the server.
|
||||||
*
|
*
|
||||||
* @param connection the newly created connection.
|
* @param connection the newly created connection.
|
||||||
*/
|
*/
|
||||||
void connectionCreated(XMPPConnection connection);
|
void connectionCreated(XMPPConnection connection);
|
||||||
|
|
|
@ -23,7 +23,7 @@ package org.jivesoftware.smack;
|
||||||
*
|
*
|
||||||
* @see XMPPConnection#addConnectionListener
|
* @see XMPPConnection#addConnectionListener
|
||||||
* @see XMPPConnection#removeConnectionListener
|
* @see XMPPConnection#removeConnectionListener
|
||||||
*
|
*
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
public interface ConnectionListener {
|
public interface ConnectionListener {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.jivesoftware.smack.util.Async;
|
||||||
* <li>If that fails it will indefinitely try to connect once every five minutes.
|
* <li>If that fails it will indefinitely try to connect once every five minutes.
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* {@link ReconnectionPolicy#FIXED_DELAY} - The reconnection mechanism will try to reconnect after a fixed delay
|
* {@link ReconnectionPolicy#FIXED_DELAY} - The reconnection mechanism will try to reconnect after a fixed delay
|
||||||
* independently from the number of reconnection attempts already performed.
|
* independently from the number of reconnection attempts already performed.
|
||||||
* <p>
|
* <p>
|
||||||
* Interrupting the reconnection thread will abort the reconnection mechanism.
|
* Interrupting the reconnection thread will abort the reconnection mechanism.
|
||||||
|
@ -60,7 +60,7 @@ public final class ReconnectionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a instance of ReconnectionManager for the given connection.
|
* Get a instance of ReconnectionManager for the given connection.
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection
|
||||||
* @return a ReconnectionManager for the connection.
|
* @return a ReconnectionManager for the connection.
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +89,7 @@ public final class ReconnectionManager {
|
||||||
/**
|
/**
|
||||||
* Set if the automatic reconnection mechanism will be enabled per default for new XMPP connections. The default is
|
* Set if the automatic reconnection mechanism will be enabled per default for new XMPP connections. The default is
|
||||||
* 'false'.
|
* 'false'.
|
||||||
*
|
*
|
||||||
* @param enabled
|
* @param enabled
|
||||||
*/
|
*/
|
||||||
public static void setEnabledPerDefault(boolean enabled) {
|
public static void setEnabledPerDefault(boolean enabled) {
|
||||||
|
@ -121,7 +121,7 @@ public final class ReconnectionManager {
|
||||||
/**
|
/**
|
||||||
* Set the default fixed delay in seconds between the reconnection attempts. Also set the
|
* Set the default fixed delay in seconds between the reconnection attempts. Also set the
|
||||||
* default connection policy to {@link ReconnectionPolicy#FIXED_DELAY}
|
* default connection policy to {@link ReconnectionPolicy#FIXED_DELAY}
|
||||||
*
|
*
|
||||||
* @param fixedDelay Delay expressed in seconds
|
* @param fixedDelay Delay expressed in seconds
|
||||||
*/
|
*/
|
||||||
public static void setDefaultFixedDelay(int fixedDelay) {
|
public static void setDefaultFixedDelay(int fixedDelay) {
|
||||||
|
@ -131,7 +131,7 @@ public final class ReconnectionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default Reconnection Policy to use.
|
* Set the default Reconnection Policy to use.
|
||||||
*
|
*
|
||||||
* @param reconnectionPolicy
|
* @param reconnectionPolicy
|
||||||
*/
|
*/
|
||||||
public static void setDefaultReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) {
|
public static void setDefaultReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) {
|
||||||
|
@ -162,7 +162,7 @@ public final class ReconnectionManager {
|
||||||
/**
|
/**
|
||||||
* Set the fixed delay in seconds between the reconnection attempts Also set the connection
|
* Set the fixed delay in seconds between the reconnection attempts Also set the connection
|
||||||
* policy to {@link ReconnectionPolicy#FIXED_DELAY}.
|
* policy to {@link ReconnectionPolicy#FIXED_DELAY}.
|
||||||
*
|
*
|
||||||
* @param fixedDelay Delay expressed in seconds
|
* @param fixedDelay Delay expressed in seconds
|
||||||
*/
|
*/
|
||||||
public void setFixedDelay(int fixedDelay) {
|
public void setFixedDelay(int fixedDelay) {
|
||||||
|
@ -172,7 +172,7 @@ public final class ReconnectionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Reconnection Policy to use.
|
* Set the Reconnection Policy to use.
|
||||||
*
|
*
|
||||||
* @param reconnectionPolicy
|
* @param reconnectionPolicy
|
||||||
*/
|
*/
|
||||||
public void setReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) {
|
public void setReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ public final class SASLAuthentication {
|
||||||
/**
|
/**
|
||||||
* Unregister a SASLMechanism by it's full class name. For example
|
* Unregister a SASLMechanism by it's full class name. For example
|
||||||
* "org.jivesoftware.smack.sasl.javax.SASLCramMD5Mechanism".
|
* "org.jivesoftware.smack.sasl.javax.SASLCramMD5Mechanism".
|
||||||
*
|
*
|
||||||
* @param clazz the SASLMechanism class's name
|
* @param clazz the SASLMechanism class's name
|
||||||
* @return true if the given SASLMechanism was removed, false otherwise
|
* @return true if the given SASLMechanism was removed, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -228,10 +228,10 @@ public final class SASLAuthentication {
|
||||||
/**
|
/**
|
||||||
* Wrapper for {@link #challengeReceived(String, boolean)}, with <code>finalChallenge</code> set
|
* Wrapper for {@link #challengeReceived(String, boolean)}, with <code>finalChallenge</code> set
|
||||||
* to <code>false</code>.
|
* to <code>false</code>.
|
||||||
*
|
*
|
||||||
* @param challenge a base64 encoded string representing the challenge.
|
* @param challenge a base64 encoded string representing the challenge.
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public void challengeReceived(String challenge) throws SmackException, InterruptedException {
|
public void challengeReceived(String challenge) throws SmackException, InterruptedException {
|
||||||
challengeReceived(challenge, false);
|
challengeReceived(challenge, false);
|
||||||
|
@ -261,8 +261,8 @@ public final class SASLAuthentication {
|
||||||
* Notification message saying that SASL authentication was successful. The next step
|
* Notification message saying that SASL authentication was successful. The next step
|
||||||
* would be to bind the resource.
|
* would be to bind the resource.
|
||||||
* @param success result of the authentication.
|
* @param success result of the authentication.
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public void authenticated(Success success) throws SmackException, InterruptedException {
|
public void authenticated(Success success) throws SmackException, InterruptedException {
|
||||||
// RFC6120 6.3.10 "At the end of the authentication exchange, the SASL server (the XMPP
|
// RFC6120 6.3.10 "At the end of the authentication exchange, the SASL server (the XMPP
|
||||||
|
@ -284,7 +284,7 @@ public final class SASLAuthentication {
|
||||||
/**
|
/**
|
||||||
* Notification message saying that SASL authentication has failed. The server may have
|
* Notification message saying that SASL authentication has failed. The server may have
|
||||||
* closed the connection depending on the number of possible retries.
|
* closed the connection depending on the number of possible retries.
|
||||||
*
|
*
|
||||||
* @param saslFailure the SASL failure as reported by the server
|
* @param saslFailure the SASL failure as reported by the server
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc6120#section-6.5">RFC6120 6.5</a>
|
* @see <a href="https://tools.ietf.org/html/rfc6120#section-6.5">RFC6120 6.5</a>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.jivesoftware.smack.util.Objects;
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* Configuration settings are stored in org.jivesoftware.smack/smack-config.xml.
|
* Configuration settings are stored in org.jivesoftware.smack/smack-config.xml.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
public final class SmackConfiguration {
|
public final class SmackConfiguration {
|
||||||
|
@ -86,7 +86,7 @@ public final class SmackConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Smack version information, eg "1.3.0".
|
* Returns the Smack version information, eg "1.3.0".
|
||||||
*
|
*
|
||||||
* @return the Smack version information.
|
* @return the Smack version information.
|
||||||
*/
|
*/
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
|
@ -96,7 +96,7 @@ public final class SmackConfiguration {
|
||||||
/**
|
/**
|
||||||
* Returns the number of milliseconds to wait for a response from
|
* Returns the number of milliseconds to wait for a response from
|
||||||
* the server. The default value is 5000 ms.
|
* the server. The default value is 5000 ms.
|
||||||
*
|
*
|
||||||
* @return the milliseconds to wait for a response from the server
|
* @return the milliseconds to wait for a response from the server
|
||||||
* @deprecated use {@link #getDefaultReplyTimeout()} instead.
|
* @deprecated use {@link #getDefaultReplyTimeout()} instead.
|
||||||
*/
|
*/
|
||||||
|
@ -108,7 +108,7 @@ public final class SmackConfiguration {
|
||||||
/**
|
/**
|
||||||
* Sets the number of milliseconds to wait for a response from
|
* Sets the number of milliseconds to wait for a response from
|
||||||
* the server.
|
* the server.
|
||||||
*
|
*
|
||||||
* @param timeout the milliseconds to wait for a response from the server
|
* @param timeout the milliseconds to wait for a response from the server
|
||||||
* @deprecated use {@link #setDefaultReplyTimeout(int)} instead.
|
* @deprecated use {@link #setDefaultReplyTimeout(int)} instead.
|
||||||
*/
|
*/
|
||||||
|
@ -120,7 +120,7 @@ public final class SmackConfiguration {
|
||||||
/**
|
/**
|
||||||
* Returns the number of milliseconds to wait for a response from
|
* Returns the number of milliseconds to wait for a response from
|
||||||
* the server. The default value is 5000 ms.
|
* the server. The default value is 5000 ms.
|
||||||
*
|
*
|
||||||
* @return the milliseconds to wait for a response from the server
|
* @return the milliseconds to wait for a response from the server
|
||||||
*/
|
*/
|
||||||
public static int getDefaultReplyTimeout() {
|
public static int getDefaultReplyTimeout() {
|
||||||
|
@ -134,7 +134,7 @@ public final class SmackConfiguration {
|
||||||
/**
|
/**
|
||||||
* Sets the number of milliseconds to wait for a response from
|
* Sets the number of milliseconds to wait for a response from
|
||||||
* the server.
|
* the server.
|
||||||
*
|
*
|
||||||
* @param timeout the milliseconds to wait for a response from the server
|
* @param timeout the milliseconds to wait for a response from the server
|
||||||
*/
|
*/
|
||||||
public static void setDefaultReplyTimeout(int timeout) {
|
public static void setDefaultReplyTimeout(int timeout) {
|
||||||
|
@ -153,9 +153,9 @@ public final class SmackConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the default max size of a stanza collector before it will delete
|
* Gets the default max size of a stanza collector before it will delete
|
||||||
* the older packets.
|
* the older packets.
|
||||||
*
|
*
|
||||||
* @return The number of packets to queue before deleting older packets.
|
* @return The number of packets to queue before deleting older packets.
|
||||||
*/
|
*/
|
||||||
public static int getStanzaCollectorSize() {
|
public static int getStanzaCollectorSize() {
|
||||||
|
@ -163,9 +163,9 @@ public final class SmackConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default max size of a stanza collector before it will delete
|
* Sets the default max size of a stanza collector before it will delete
|
||||||
* the older packets.
|
* the older packets.
|
||||||
*
|
*
|
||||||
* @param collectorSize the number of packets to queue before deleting older packets.
|
* @param collectorSize the number of packets to queue before deleting older packets.
|
||||||
*/
|
*/
|
||||||
public static void setStanzaCollectorSize(int collectorSize) {
|
public static void setStanzaCollectorSize(int collectorSize) {
|
||||||
|
@ -235,7 +235,7 @@ public final class SmackConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default parsing exception callback.
|
* Returns the default parsing exception callback.
|
||||||
*
|
*
|
||||||
* @return the default parsing exception callback
|
* @return the default parsing exception callback
|
||||||
* @see ParsingExceptionCallback
|
* @see ParsingExceptionCallback
|
||||||
*/
|
*/
|
||||||
|
@ -334,7 +334,7 @@ public final class SmackConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if Smack was successfully initialized.
|
* Check if Smack was successfully initialized.
|
||||||
*
|
*
|
||||||
* @return true if smack was initialized, false otherwise
|
* @return true if smack was initialized, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isSmackInitialized() {
|
public static boolean isSmackInitialized() {
|
||||||
|
|
|
@ -26,19 +26,19 @@ import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smack uses SmackExceptions for errors that are not defined by any XMPP specification.
|
* Smack uses SmackExceptions for errors that are not defined by any XMPP specification.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public class SmackException extends Exception {
|
public class SmackException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1844674365368214457L;
|
private static final long serialVersionUID = 1844674365368214457L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new SmackException with the Throwable that was the root cause of the exception.
|
* Creates a new SmackException with the Throwable that was the root cause of the exception.
|
||||||
*
|
*
|
||||||
* @param wrappedThrowable the root cause of the exception.
|
* @param wrappedThrowable the root cause of the exception.
|
||||||
*/
|
*/
|
||||||
public SmackException(Throwable wrappedThrowable) {
|
public SmackException(Throwable wrappedThrowable) {
|
||||||
|
@ -63,7 +63,7 @@ public class SmackException extends Exception {
|
||||||
*/
|
*/
|
||||||
public static final class NoResponseException extends SmackException {
|
public static final class NoResponseException extends SmackException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6523363748984543636L;
|
private static final long serialVersionUID = -6523363748984543636L;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public class SmackException extends Exception {
|
||||||
public static class NotLoggedInException extends SmackException {
|
public static class NotLoggedInException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 3216216839100019278L;
|
private static final long serialVersionUID = 3216216839100019278L;
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ public class SmackException extends Exception {
|
||||||
public static class AlreadyLoggedInException extends SmackException {
|
public static class AlreadyLoggedInException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 5011416918049935231L;
|
private static final long serialVersionUID = 5011416918049935231L;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public class SmackException extends Exception {
|
||||||
public static class AlreadyConnectedException extends SmackException {
|
public static class AlreadyConnectedException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 5011416918049135231L;
|
private static final long serialVersionUID = 5011416918049135231L;
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class SmackException extends Exception {
|
||||||
public static class NotConnectedException extends SmackException {
|
public static class NotConnectedException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 9197980400776001173L;
|
private static final long serialVersionUID = 9197980400776001173L;
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ public class SmackException extends Exception {
|
||||||
public static class IllegalStateChangeException extends SmackException {
|
public static class IllegalStateChangeException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -1766023961577168927L;
|
private static final long serialVersionUID = -1766023961577168927L;
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ public class SmackException extends Exception {
|
||||||
public abstract static class SecurityRequiredException extends SmackException {
|
public abstract static class SecurityRequiredException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 384291845029773545L;
|
private static final long serialVersionUID = 384291845029773545L;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ public class SmackException extends Exception {
|
||||||
|
|
||||||
public static class SecurityRequiredByClientException extends SecurityRequiredException {
|
public static class SecurityRequiredByClientException extends SecurityRequiredException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2395325821201543159L;
|
private static final long serialVersionUID = 2395325821201543159L;
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ public class SmackException extends Exception {
|
||||||
|
|
||||||
public static class SecurityRequiredByServerException extends SecurityRequiredException {
|
public static class SecurityRequiredByServerException extends SecurityRequiredException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8268148813117631819L;
|
private static final long serialVersionUID = 8268148813117631819L;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ public class SmackException extends Exception {
|
||||||
public static class SecurityNotPossibleException extends SmackException {
|
public static class SecurityNotPossibleException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6836090872690331336L;
|
private static final long serialVersionUID = -6836090872690331336L;
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ public class SmackException extends Exception {
|
||||||
public static class ConnectionException extends SmackException {
|
public static class ConnectionException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1686944201672697996L;
|
private static final long serialVersionUID = 1686944201672697996L;
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ public class SmackException extends Exception {
|
||||||
public static class FeatureNotSupportedException extends SmackException {
|
public static class FeatureNotSupportedException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 4713404802621452016L;
|
private static final long serialVersionUID = 4713404802621452016L;
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public class SmackException extends Exception {
|
||||||
public static class ResourceBindingNotOfferedException extends SmackException {
|
public static class ResourceBindingNotOfferedException extends SmackException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2346934138253437571L;
|
private static final long serialVersionUID = 2346934138253437571L;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smack.packet.Stanza;
|
||||||
* result.<p>
|
* result.<p>
|
||||||
*
|
*
|
||||||
* Each stanza collector will queue up a configured number of packets for processing before
|
* Each stanza collector will queue up a configured number of packets for processing before
|
||||||
* older packets are automatically dropped. The default number is retrieved by
|
* older packets are automatically dropped. The default number is retrieved by
|
||||||
* {@link SmackConfiguration#getStanzaCollectorSize()}.
|
* {@link SmackConfiguration#getStanzaCollectorSize()}.
|
||||||
*
|
*
|
||||||
* @see XMPPConnection#createStanzaCollector(StanzaFilter)
|
* @see XMPPConnection#createStanzaCollector(StanzaFilter)
|
||||||
|
@ -147,7 +147,7 @@ public class StanzaCollector {
|
||||||
*
|
*
|
||||||
* @param <P> type of the result stanza.
|
* @param <P> type of the result stanza.
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <P extends Stanza> P nextResultBlockForever() throws InterruptedException {
|
public <P extends Stanza> P nextResultBlockForever() throws InterruptedException {
|
||||||
|
@ -165,7 +165,7 @@ public class StanzaCollector {
|
||||||
*
|
*
|
||||||
* @param <P> type of the result stanza.
|
* @param <P> type of the result stanza.
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public <P extends Stanza> P nextResult() throws InterruptedException {
|
public <P extends Stanza> P nextResult() throws InterruptedException {
|
||||||
return nextResult(connection.getReplyTimeout());
|
return nextResult(connection.getReplyTimeout());
|
||||||
|
@ -181,7 +181,7 @@ public class StanzaCollector {
|
||||||
* @param <P> type of the result stanza.
|
* @param <P> type of the result stanza.
|
||||||
* @param timeout the timeout in milliseconds.
|
* @param timeout the timeout in milliseconds.
|
||||||
* @return the next available packet.
|
* @return the next available packet.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <P extends Stanza> P nextResult(long timeout) throws InterruptedException {
|
public <P extends Stanza> P nextResult(long timeout) throws InterruptedException {
|
||||||
|
@ -270,7 +270,7 @@ public class StanzaCollector {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of collected stanzas this stanza collector has collected so far.
|
* Get the number of collected stanzas this stanza collector has collected so far.
|
||||||
*
|
*
|
||||||
* @return the count of collected stanzas.
|
* @return the count of collected stanzas.
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
|
@ -306,7 +306,7 @@ public class StanzaCollector {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a new stanza collector configuration instance.
|
* Get a new stanza collector configuration instance.
|
||||||
*
|
*
|
||||||
* @return a new stanza collector configuration.
|
* @return a new stanza collector configuration.
|
||||||
*/
|
*/
|
||||||
public static Configuration newConfiguration() {
|
public static Configuration newConfiguration() {
|
||||||
|
@ -325,7 +325,7 @@ public class StanzaCollector {
|
||||||
/**
|
/**
|
||||||
* Set the stanza filter used by this collector. If <code>null</code>, then all packets will
|
* Set the stanza filter used by this collector. If <code>null</code>, then all packets will
|
||||||
* get collected by this collector.
|
* get collected by this collector.
|
||||||
*
|
*
|
||||||
* @param packetFilter
|
* @param packetFilter
|
||||||
* @return a reference to this configuration.
|
* @return a reference to this configuration.
|
||||||
* @deprecated use {@link #setStanzaFilter(StanzaFilter)} instead.
|
* @deprecated use {@link #setStanzaFilter(StanzaFilter)} instead.
|
||||||
|
@ -338,7 +338,7 @@ public class StanzaCollector {
|
||||||
/**
|
/**
|
||||||
* Set the stanza filter used by this collector. If <code>null</code>, then all stanzas will
|
* Set the stanza filter used by this collector. If <code>null</code>, then all stanzas will
|
||||||
* get collected by this collector.
|
* get collected by this collector.
|
||||||
*
|
*
|
||||||
* @param stanzaFilter
|
* @param stanzaFilter
|
||||||
* @return a reference to this configuration.
|
* @return a reference to this configuration.
|
||||||
*/
|
*/
|
||||||
|
@ -350,7 +350,7 @@ public class StanzaCollector {
|
||||||
/**
|
/**
|
||||||
* Set the maximum size of this collector, i.e. how many stanzas this collector will collect
|
* Set the maximum size of this collector, i.e. how many stanzas this collector will collect
|
||||||
* before dropping old ones.
|
* before dropping old ones.
|
||||||
*
|
*
|
||||||
* @param size
|
* @param size
|
||||||
* @return a reference to this configuration.
|
* @return a reference to this configuration.
|
||||||
*/
|
*/
|
||||||
|
@ -362,7 +362,7 @@ public class StanzaCollector {
|
||||||
/**
|
/**
|
||||||
* Set the collector which timeout for the next result is reset once this collector collects
|
* Set the collector which timeout for the next result is reset once this collector collects
|
||||||
* a packet.
|
* a packet.
|
||||||
*
|
*
|
||||||
* @param collector
|
* @param collector
|
||||||
* @return a reference to this configuration.
|
* @return a reference to this configuration.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -49,8 +49,8 @@ public interface StanzaListener {
|
||||||
*
|
*
|
||||||
* @param packet the stanza to process.
|
* @param packet the stanza to process.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @throws NotLoggedInException
|
* @throws NotLoggedInException
|
||||||
*/
|
*/
|
||||||
void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
|
void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ public class SynchronizationPoint<E extends Exception> {
|
||||||
* {@link #reportSuccess()}, {@link #reportFailure()} and {@link #reportFailure(Exception)} will either set this
|
* {@link #reportSuccess()}, {@link #reportFailure()} and {@link #reportFailure(Exception)} will either set this
|
||||||
* synchronization point to {@link State#Success} or {@link State#Failure}. If none of them is set after the
|
* synchronization point to {@link State#Success} or {@link State#Failure}. If none of them is set after the
|
||||||
* connections reply timeout, this method will set the state of {@link State#NoResponse}.
|
* connections reply timeout, this method will set the state of {@link State#NoResponse}.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
private void waitForConditionOrTimeout() throws InterruptedException {
|
private void waitForConditionOrTimeout() throws InterruptedException {
|
||||||
long remainingWait = TimeUnit.MILLISECONDS.toNanos(connection.getReplyTimeout());
|
long remainingWait = TimeUnit.MILLISECONDS.toNanos(connection.getReplyTimeout());
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of an unparsable stanza.
|
* Representation of an unparsable stanza.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ public class UnparseableStanza {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the raw stanza data.
|
* Retrieve the raw stanza data.
|
||||||
*
|
*
|
||||||
* @return the raw stanza data
|
* @return the raw stanza data
|
||||||
*/
|
*/
|
||||||
public CharSequence getContent() {
|
public CharSequence getContent() {
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.jxmpp.jid.EntityFullJid;
|
||||||
* implements shared methods which are used by the different types of connections (e.g.
|
* implements shared methods which are used by the different types of connections (e.g.
|
||||||
* <code>XMPPTCPConnection</code> or <code>XMPPBOSHConnection</code>). To create a connection to an XMPP server
|
* <code>XMPPTCPConnection</code> or <code>XMPPBOSHConnection</code>). To create a connection to an XMPP server
|
||||||
* a simple usage of this API might look like the following:
|
* a simple usage of this API might look like the following:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* // Create a connection to the igniterealtime.org XMPP server.
|
* // Create a connection to the igniterealtime.org XMPP server.
|
||||||
* XMPPTCPConnection con = new XMPPTCPConnection("igniterealtime.org");
|
* XMPPTCPConnection con = new XMPPTCPConnection("igniterealtime.org");
|
||||||
|
@ -76,7 +76,7 @@ public interface XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the XMPP Domain of the service provided by the XMPP server and used for this connection. After
|
* Returns the XMPP Domain of the service provided by the XMPP server and used for this connection. After
|
||||||
* authenticating with the server the returned value may be different.
|
* authenticating with the server the returned value may be different.
|
||||||
*
|
*
|
||||||
* @return the XMPP domain of this XMPP session.
|
* @return the XMPP domain of this XMPP session.
|
||||||
*/
|
*/
|
||||||
DomainBareJid getXMPPServiceDomain();
|
DomainBareJid getXMPPServiceDomain();
|
||||||
|
@ -84,7 +84,7 @@ public interface XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the host name of the server where the XMPP server is running. This would be the
|
* Returns the host name of the server where the XMPP server is running. This would be the
|
||||||
* IP address of the server or a name that may be resolved by a DNS server.
|
* IP address of the server or a name that may be resolved by a DNS server.
|
||||||
*
|
*
|
||||||
* @return the host name of the server where the XMPP server is running or null if not yet connected.
|
* @return the host name of the server where the XMPP server is running or null if not yet connected.
|
||||||
*/
|
*/
|
||||||
String getHost();
|
String getHost();
|
||||||
|
@ -92,7 +92,7 @@ public interface XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the port number of the XMPP server for this connection. The default port
|
* Returns the port number of the XMPP server for this connection. The default port
|
||||||
* for normal connections is 5222.
|
* for normal connections is 5222.
|
||||||
*
|
*
|
||||||
* @return the port number of the XMPP server or 0 if not yet connected.
|
* @return the port number of the XMPP server or 0 if not yet connected.
|
||||||
*/
|
*/
|
||||||
int getPort();
|
int getPort();
|
||||||
|
@ -101,7 +101,7 @@ public interface XMPPConnection {
|
||||||
* Returns the full XMPP address of the user that is logged in to the connection or
|
* Returns the full XMPP address of the user that is logged in to the connection or
|
||||||
* <tt>null</tt> if not logged in yet. An XMPP address is in the form
|
* <tt>null</tt> if not logged in yet. An XMPP address is in the form
|
||||||
* username@server/resource.
|
* username@server/resource.
|
||||||
*
|
*
|
||||||
* @return the full XMPP address of the user logged in.
|
* @return the full XMPP address of the user logged in.
|
||||||
*/
|
*/
|
||||||
EntityFullJid getUser();
|
EntityFullJid getUser();
|
||||||
|
@ -109,7 +109,7 @@ public interface XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the stream ID for this connection, which is the value set by the server
|
* Returns the stream ID for this connection, which is the value set by the server
|
||||||
* when opening an XMPP stream. This value will be <tt>null</tt> if not connected to the server.
|
* when opening an XMPP stream. This value will be <tt>null</tt> if not connected to the server.
|
||||||
*
|
*
|
||||||
* @return the ID of this connection returned from the XMPP server or <tt>null</tt> if
|
* @return the ID of this connection returned from the XMPP server or <tt>null</tt> if
|
||||||
* not connected to the server.
|
* not connected to the server.
|
||||||
* @see <a href="http://xmpp.org/rfcs/rfc6120.html#streams-attr-id">RFC 6120 § 4.7.3. id</a>
|
* @see <a href="http://xmpp.org/rfcs/rfc6120.html#streams-attr-id">RFC 6120 § 4.7.3. id</a>
|
||||||
|
@ -118,28 +118,28 @@ public interface XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if currently connected to the XMPP server.
|
* Returns true if currently connected to the XMPP server.
|
||||||
*
|
*
|
||||||
* @return true if connected.
|
* @return true if connected.
|
||||||
*/
|
*/
|
||||||
boolean isConnected();
|
boolean isConnected();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if currently authenticated by successfully calling the login method.
|
* Returns true if currently authenticated by successfully calling the login method.
|
||||||
*
|
*
|
||||||
* @return true if authenticated.
|
* @return true if authenticated.
|
||||||
*/
|
*/
|
||||||
boolean isAuthenticated();
|
boolean isAuthenticated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if currently authenticated anonymously.
|
* Returns true if currently authenticated anonymously.
|
||||||
*
|
*
|
||||||
* @return true if authenticated anonymously.
|
* @return true if authenticated anonymously.
|
||||||
*/
|
*/
|
||||||
boolean isAnonymous();
|
boolean isAnonymous();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the connection to the server has successfully negotiated encryption.
|
* Returns true if the connection to the server has successfully negotiated encryption.
|
||||||
*
|
*
|
||||||
* @return true if a secure connection to the server.
|
* @return true if a secure connection to the server.
|
||||||
*/
|
*/
|
||||||
boolean isSecureConnection();
|
boolean isSecureConnection();
|
||||||
|
@ -149,7 +149,7 @@ public interface XMPPConnection {
|
||||||
* traffic can be reduced up to 90%. Therefore, stream compression is ideal when using a slow
|
* traffic can be reduced up to 90%. Therefore, stream compression is ideal when using a slow
|
||||||
* speed network connection. However, the server will need to use more CPU time in order to
|
* speed network connection. However, the server will need to use more CPU time in order to
|
||||||
* un/compress network data so under high load the server performance might be affected.
|
* un/compress network data so under high load the server performance might be affected.
|
||||||
*
|
*
|
||||||
* @return true if network traffic is being compressed.
|
* @return true if network traffic is being compressed.
|
||||||
*/
|
*/
|
||||||
boolean isUsingCompression();
|
boolean isUsingCompression();
|
||||||
|
@ -173,21 +173,21 @@ public interface XMPPConnection {
|
||||||
*
|
*
|
||||||
* @param nonza the Nonza to send.
|
* @param nonza the Nonza to send.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
void sendNonza(Nonza nonza) throws NotConnectedException, InterruptedException;
|
void sendNonza(Nonza nonza) throws NotConnectedException, InterruptedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a connection listener to this connection that will be notified when
|
* Adds a connection listener to this connection that will be notified when
|
||||||
* the connection closes or fails.
|
* the connection closes or fails.
|
||||||
*
|
*
|
||||||
* @param connectionListener a connection listener.
|
* @param connectionListener a connection listener.
|
||||||
*/
|
*/
|
||||||
void addConnectionListener(ConnectionListener connectionListener);
|
void addConnectionListener(ConnectionListener connectionListener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a connection listener from this connection.
|
* Removes a connection listener from this connection.
|
||||||
*
|
*
|
||||||
* @param connectionListener a connection listener.
|
* @param connectionListener a connection listener.
|
||||||
*/
|
*/
|
||||||
void removeConnectionListener(ConnectionListener connectionListener);
|
void removeConnectionListener(ConnectionListener connectionListener);
|
||||||
|
@ -214,8 +214,8 @@ public interface XMPPConnection {
|
||||||
*
|
*
|
||||||
* @param request the IQ request to filter responses from
|
* @param request the IQ request to filter responses from
|
||||||
* @return a new stanza collector.
|
* @return a new stanza collector.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
StanzaCollector createStanzaCollectorAndSend(IQ request) throws NotConnectedException, InterruptedException;
|
StanzaCollector createStanzaCollectorAndSend(IQ request) throws NotConnectedException, InterruptedException;
|
||||||
|
|
||||||
|
@ -224,12 +224,12 @@ public interface XMPPConnection {
|
||||||
* which stanzas will be accumulated by the collector. A StanzaCollector is
|
* which stanzas will be accumulated by the collector. A StanzaCollector is
|
||||||
* more suitable to use than a {@link StanzaListener} when you need to wait for
|
* more suitable to use than a {@link StanzaListener} when you need to wait for
|
||||||
* a specific result.
|
* a specific result.
|
||||||
*
|
*
|
||||||
* @param stanzaFilter the stanza filter to use.
|
* @param stanzaFilter the stanza filter to use.
|
||||||
* @param stanza the stanza to send right after the collector got created
|
* @param stanza the stanza to send right after the collector got created
|
||||||
* @return a new stanza collector.
|
* @return a new stanza collector.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
StanzaCollector createStanzaCollectorAndSend(StanzaFilter stanzaFilter, Stanza stanza)
|
StanzaCollector createStanzaCollectorAndSend(StanzaFilter stanzaFilter, Stanza stanza)
|
||||||
throws NotConnectedException, InterruptedException;
|
throws NotConnectedException, InterruptedException;
|
||||||
|
@ -246,7 +246,7 @@ public interface XMPPConnection {
|
||||||
* Otherwise make sure cancel the StanzaCollector in every case, e.g. even
|
* Otherwise make sure cancel the StanzaCollector in every case, e.g. even
|
||||||
* if an exception is thrown, or otherwise you may leak the StanzaCollector.
|
* if an exception is thrown, or otherwise you may leak the StanzaCollector.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param stanzaFilter the stanza filter to use.
|
* @param stanzaFilter the stanza filter to use.
|
||||||
* @return a new stanza collector.
|
* @return a new stanza collector.
|
||||||
*/
|
*/
|
||||||
|
@ -258,7 +258,7 @@ public interface XMPPConnection {
|
||||||
* Please make sure to cancel the collector when it is no longer required. See also
|
* Please make sure to cancel the collector when it is no longer required. See also
|
||||||
* {@link #createStanzaCollector(StanzaFilter)}.
|
* {@link #createStanzaCollector(StanzaFilter)}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param configuration the stanza collector configuration.
|
* @param configuration the stanza collector configuration.
|
||||||
* @return a new stanza collector.
|
* @return a new stanza collector.
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
|
@ -267,7 +267,7 @@ public interface XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a stanza collector of this connection.
|
* Remove a stanza collector of this connection.
|
||||||
*
|
*
|
||||||
* @param collector a stanza collectors which was created for this connection.
|
* @param collector a stanza collectors which was created for this connection.
|
||||||
*/
|
*/
|
||||||
void removeStanzaCollector(StanzaCollector collector);
|
void removeStanzaCollector(StanzaCollector collector);
|
||||||
|
@ -309,7 +309,7 @@ public interface XMPPConnection {
|
||||||
* invoked asynchronously in their own thread. Use this method if the order of the stanza listeners must not depend
|
* invoked asynchronously in their own thread. Use this method if the order of the stanza listeners must not depend
|
||||||
* on the order how the stanzas where received.
|
* on the order how the stanzas where received.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param stanzaListener the stanza listener to notify of new received stanzas.
|
* @param stanzaListener the stanza listener to notify of new received stanzas.
|
||||||
* @param stanzaFilter the stanza filter to use.
|
* @param stanzaFilter the stanza filter to use.
|
||||||
* @see #addStanzaInterceptor(StanzaListener, StanzaFilter)
|
* @see #addStanzaInterceptor(StanzaListener, StanzaFilter)
|
||||||
|
@ -319,7 +319,7 @@ public interface XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an <b>asynchronous</b> stanza listener for received stanzas from this connection.
|
* Removes an <b>asynchronous</b> stanza listener for received stanzas from this connection.
|
||||||
*
|
*
|
||||||
* @param stanzaListener the stanza listener to remove.
|
* @param stanzaListener the stanza listener to remove.
|
||||||
* @return true if the stanza listener was removed
|
* @return true if the stanza listener was removed
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
|
@ -333,7 +333,7 @@ public interface XMPPConnection {
|
||||||
* that writes stanzas will be used to invoke the listeners. Therefore, each
|
* that writes stanzas will be used to invoke the listeners. Therefore, each
|
||||||
* stanza listener should complete all operations quickly or use a different
|
* stanza listener should complete all operations quickly or use a different
|
||||||
* thread for processing.
|
* thread for processing.
|
||||||
*
|
*
|
||||||
* @param stanzaListener the stanza listener to notify of sent stanzas.
|
* @param stanzaListener the stanza listener to notify of sent stanzas.
|
||||||
* @param stanzaFilter the stanza filter to use.
|
* @param stanzaFilter the stanza filter to use.
|
||||||
* @deprecated use {@link #addStanzaSendingListener} instead
|
* @deprecated use {@link #addStanzaSendingListener} instead
|
||||||
|
@ -357,7 +357,7 @@ public interface XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a stanza listener for sending stanzas from this connection.
|
* Removes a stanza listener for sending stanzas from this connection.
|
||||||
*
|
*
|
||||||
* @param stanzaListener the stanza listener to remove.
|
* @param stanzaListener the stanza listener to remove.
|
||||||
* @deprecated use {@link #removeStanzaSendingListener} instead
|
* @deprecated use {@link #removeStanzaSendingListener} instead
|
||||||
*/
|
*/
|
||||||
|
@ -377,7 +377,7 @@ public interface XMPPConnection {
|
||||||
* invoked every time a stanza is about to be sent by this connection. Interceptors
|
* invoked every time a stanza is about to be sent by this connection. Interceptors
|
||||||
* may modify the stanza to be sent. A stanza filter determines which stanzas
|
* may modify the stanza to be sent. A stanza filter determines which stanzas
|
||||||
* will be delivered to the interceptor.
|
* will be delivered to the interceptor.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* NOTE: For a similar functionality on incoming stanzas, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.
|
* NOTE: For a similar functionality on incoming stanzas, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.
|
||||||
* </p>
|
* </p>
|
||||||
|
@ -467,7 +467,7 @@ public interface XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Set the FromMode for this connection instance. Defines how the 'from' attribute of outgoing
|
* Set the FromMode for this connection instance. Defines how the 'from' attribute of outgoing
|
||||||
* stanzas should be populated by Smack.
|
* stanzas should be populated by Smack.
|
||||||
*
|
*
|
||||||
* @param fromMode
|
* @param fromMode
|
||||||
*/
|
*/
|
||||||
void setFromMode(FromMode fromMode);
|
void setFromMode(FromMode fromMode);
|
||||||
|
@ -492,7 +492,7 @@ public interface XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the server supports the given stream feature.
|
* Return true if the server supports the given stream feature.
|
||||||
*
|
*
|
||||||
* @param element
|
* @param element
|
||||||
* @param namespace
|
* @param namespace
|
||||||
* @return true if the server supports the stream feature.
|
* @return true if the server supports the stream feature.
|
||||||
|
@ -543,7 +543,7 @@ public interface XMPPConnection {
|
||||||
* invoked at most once and it will be not invoked after the connections default reply timeout
|
* invoked at most once and it will be not invoked after the connections default reply timeout
|
||||||
* has been elapsed.
|
* has been elapsed.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param stanza the stanza to send (required)
|
* @param stanza the stanza to send (required)
|
||||||
* @param replyFilter the filter used to determine response stanza (required)
|
* @param replyFilter the filter used to determine response stanza (required)
|
||||||
* @param callback the callback invoked if there is a response (required)
|
* @param callback the callback invoked if there is a response (required)
|
||||||
|
@ -563,13 +563,13 @@ public interface XMPPConnection {
|
||||||
* after the connections default reply timeout, then <code>exceptionCallback</code> will be invoked
|
* after the connections default reply timeout, then <code>exceptionCallback</code> will be invoked
|
||||||
* with a {@link SmackException.NoResponseException}. The callback will be invoked at most once.
|
* with a {@link SmackException.NoResponseException}. The callback will be invoked at most once.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param stanza the stanza to send (required)
|
* @param stanza the stanza to send (required)
|
||||||
* @param replyFilter the filter used to determine response stanza (required)
|
* @param replyFilter the filter used to determine response stanza (required)
|
||||||
* @param callback the callback invoked if there is a response (required)
|
* @param callback the callback invoked if there is a response (required)
|
||||||
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @deprecated use {@link #sendAsync(Stanza, StanzaFilter)} instead.
|
* @deprecated use {@link #sendAsync(Stanza, StanzaFilter)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -584,14 +584,14 @@ public interface XMPPConnection {
|
||||||
* after <code>timeout</code> milliseconds, then <code>exceptionCallback</code> will be invoked
|
* after <code>timeout</code> milliseconds, then <code>exceptionCallback</code> will be invoked
|
||||||
* with a {@link SmackException.NoResponseException}. The callback will be invoked at most once.
|
* with a {@link SmackException.NoResponseException}. The callback will be invoked at most once.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param stanza the stanza to send (required)
|
* @param stanza the stanza to send (required)
|
||||||
* @param replyFilter the filter used to determine response stanza (required)
|
* @param replyFilter the filter used to determine response stanza (required)
|
||||||
* @param callback the callback invoked if there is a response (required)
|
* @param callback the callback invoked if there is a response (required)
|
||||||
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
||||||
* @param timeout the timeout in milliseconds to wait for a response
|
* @param timeout the timeout in milliseconds to wait for a response
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @deprecated use {@link #sendAsync(Stanza, StanzaFilter, long)} instead.
|
* @deprecated use {@link #sendAsync(Stanza, StanzaFilter, long)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -604,11 +604,11 @@ public interface XMPPConnection {
|
||||||
* Send a IQ stanza and invoke <code>callback</code> if there is a result of
|
* Send a IQ stanza and invoke <code>callback</code> if there is a result of
|
||||||
* {@link org.jivesoftware.smack.packet.IQ.Type#result} with that result IQ. The callback will
|
* {@link org.jivesoftware.smack.packet.IQ.Type#result} with that result IQ. The callback will
|
||||||
* not be invoked after the connections default reply timeout has been elapsed.
|
* not be invoked after the connections default reply timeout has been elapsed.
|
||||||
*
|
*
|
||||||
* @param iqRequest the IQ stanza to send (required)
|
* @param iqRequest the IQ stanza to send (required)
|
||||||
* @param callback the callback invoked if there is result response (required)
|
* @param callback the callback invoked if there is result response (required)
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @deprecated use {@link #sendIqRequestAsync(IQ)} instead.
|
* @deprecated use {@link #sendIqRequestAsync(IQ)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -622,12 +622,12 @@ public interface XMPPConnection {
|
||||||
* error as {@link XMPPException.XMPPErrorException}. If there is no response after the
|
* error as {@link XMPPException.XMPPErrorException}. If there is no response after the
|
||||||
* connections default reply timeout, then <code>exceptionCallback</code> will be invoked with a
|
* connections default reply timeout, then <code>exceptionCallback</code> will be invoked with a
|
||||||
* {@link SmackException.NoResponseException}.
|
* {@link SmackException.NoResponseException}.
|
||||||
*
|
*
|
||||||
* @param iqRequest the IQ stanza to send (required)
|
* @param iqRequest the IQ stanza to send (required)
|
||||||
* @param callback the callback invoked if there is result response (required)
|
* @param callback the callback invoked if there is result response (required)
|
||||||
* @param exceptionCallback the callback invoked if there is an Exception optional
|
* @param exceptionCallback the callback invoked if there is an Exception optional
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @deprecated use {@link #sendIqRequestAsync(IQ)} instead.
|
* @deprecated use {@link #sendIqRequestAsync(IQ)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -642,13 +642,13 @@ public interface XMPPConnection {
|
||||||
* error as {@link XMPPException.XMPPErrorException}. If there is no response after
|
* error as {@link XMPPException.XMPPErrorException}. If there is no response after
|
||||||
* <code>timeout</code>, then <code>exceptionCallback</code> will be invoked with a
|
* <code>timeout</code>, then <code>exceptionCallback</code> will be invoked with a
|
||||||
* {@link SmackException.NoResponseException}.
|
* {@link SmackException.NoResponseException}.
|
||||||
*
|
*
|
||||||
* @param iqRequest the IQ stanza to send (required)
|
* @param iqRequest the IQ stanza to send (required)
|
||||||
* @param callback the callback invoked if there is result response (required)
|
* @param callback the callback invoked if there is result response (required)
|
||||||
* @param exceptionCallback the callback invoked if there is an Exception optional
|
* @param exceptionCallback the callback invoked if there is an Exception optional
|
||||||
* @param timeout the timeout in milliseconds to wait for a response
|
* @param timeout the timeout in milliseconds to wait for a response
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @deprecated use {@link #sendIqRequestAsync(IQ, long)} instead.
|
* @deprecated use {@link #sendIqRequestAsync(IQ, long)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -660,7 +660,7 @@ public interface XMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Add a callback that is called exactly once and synchronously with the incoming stanza that matches the given
|
* Add a callback that is called exactly once and synchronously with the incoming stanza that matches the given
|
||||||
* stanza filter.
|
* stanza filter.
|
||||||
*
|
*
|
||||||
* @param callback the callback invoked once the stanza filter matches a stanza.
|
* @param callback the callback invoked once the stanza filter matches a stanza.
|
||||||
* @param stanzaFilter the filter to match stanzas or null to match all.
|
* @param stanzaFilter the filter to match stanzas or null to match all.
|
||||||
*/
|
*/
|
||||||
|
@ -686,7 +686,7 @@ public interface XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregister an IQ request handler with this connection.
|
* Unregister an IQ request handler with this connection.
|
||||||
*
|
*
|
||||||
* @param element the IQ element the IQ request handler is responsible for.
|
* @param element the IQ element the IQ request handler is responsible for.
|
||||||
* @param namespace the IQ namespace the IQ request handler is responsible for.
|
* @param namespace the IQ namespace the IQ request handler is responsible for.
|
||||||
* @param type the IQ type the IQ request handler is responsible for.
|
* @param type the IQ type the IQ request handler is responsible for.
|
||||||
|
@ -696,7 +696,7 @@ public interface XMPPConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the timestamp in milliseconds when the last stanza was received.
|
* Returns the timestamp in milliseconds when the last stanza was received.
|
||||||
*
|
*
|
||||||
* @return the timestamp in milliseconds
|
* @return the timestamp in milliseconds
|
||||||
*/
|
*/
|
||||||
long getLastStanzaReceived();
|
long getLastStanzaReceived();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class XMPPConnectionRegistry {
|
||||||
/**
|
/**
|
||||||
* Adds a new listener that will be notified when new Connections are created. Note
|
* Adds a new listener that will be notified when new Connections are created. Note
|
||||||
* that newly created connections will not be actually connected to the server.
|
* that newly created connections will not be actually connected to the server.
|
||||||
*
|
*
|
||||||
* @param connectionCreationListener a listener interested on new connections.
|
* @param connectionCreationListener a listener interested on new connections.
|
||||||
*/
|
*/
|
||||||
public static void addConnectionCreationListener(
|
public static void addConnectionCreationListener(
|
||||||
|
@ -42,7 +42,7 @@ public class XMPPConnectionRegistry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a listener that was interested in connection creation events.
|
* Removes a listener that was interested in connection creation events.
|
||||||
*
|
*
|
||||||
* @param connectionCreationListener a listener interested on new connections.
|
* @param connectionCreationListener a listener interested on new connections.
|
||||||
*/
|
*/
|
||||||
public static void removeConnectionCreationListener(
|
public static void removeConnectionCreationListener(
|
||||||
|
@ -54,7 +54,7 @@ public class XMPPConnectionRegistry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the collection of listeners that are interested in connection creation events.
|
* Get the collection of listeners that are interested in connection creation events.
|
||||||
*
|
*
|
||||||
* @return a collection of listeners interested on new connections.
|
* @return a collection of listeners interested on new connections.
|
||||||
*/
|
*/
|
||||||
protected static Collection<ConnectionCreationListener> getConnectionCreationListeners() {
|
protected static Collection<ConnectionCreationListener> getConnectionCreationListeners() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ public abstract class XMPPException extends Exception {
|
||||||
|
|
||||||
public static class XMPPErrorException extends XMPPException {
|
public static class XMPPErrorException extends XMPPException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 212790389529249604L;
|
private static final long serialVersionUID = 212790389529249604L;
|
||||||
private final StanzaError error;
|
private final StanzaError error;
|
||||||
|
@ -121,7 +121,7 @@ public abstract class XMPPException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Returns the XMPPError associated with this exception, or <tt>null</tt> if there isn't
|
* Returns the XMPPError associated with this exception, or <tt>null</tt> if there isn't
|
||||||
* one.
|
* one.
|
||||||
*
|
*
|
||||||
* @return the XMPPError associated with this exception.
|
* @return the XMPPError associated with this exception.
|
||||||
*/
|
*/
|
||||||
public StanzaError getXMPPError() {
|
public StanzaError getXMPPError() {
|
||||||
|
@ -174,7 +174,7 @@ public abstract class XMPPException extends Exception {
|
||||||
public static class FailedNonzaException extends XMPPException {
|
public static class FailedNonzaException extends XMPPException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ public abstract class XMPPException extends Exception {
|
||||||
|
|
||||||
public static class StreamErrorException extends XMPPException {
|
public static class StreamErrorException extends XMPPException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 3400556867134848886L;
|
private static final long serialVersionUID = 3400556867134848886L;
|
||||||
private final StreamError streamError;
|
private final StreamError streamError;
|
||||||
|
@ -207,7 +207,7 @@ public abstract class XMPPException extends Exception {
|
||||||
* Creates a new XMPPException with the stream error that was the root case of the
|
* Creates a new XMPPException with the stream error that was the root case of the
|
||||||
* exception. When a stream error is received from the server then the underlying connection
|
* exception. When a stream error is received from the server then the underlying connection
|
||||||
* will be closed by the server.
|
* will be closed by the server.
|
||||||
*
|
*
|
||||||
* @param streamError the root cause of the exception.
|
* @param streamError the root cause of the exception.
|
||||||
*/
|
*/
|
||||||
public StreamErrorException(StreamError streamError) {
|
public StreamErrorException(StreamError streamError) {
|
||||||
|
@ -220,7 +220,7 @@ public abstract class XMPPException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Returns the StreamError associated with this exception. The underlying TCP connection is
|
* Returns the StreamError associated with this exception. The underlying TCP connection is
|
||||||
* closed by the server after sending the stream error to the client.
|
* closed by the server after sending the stream error to the client.
|
||||||
*
|
*
|
||||||
* @return the StreamError associated with this exception.
|
* @return the StreamError associated with this exception.
|
||||||
*/
|
*/
|
||||||
public StreamError getStreamError() {
|
public StreamError getStreamError() {
|
||||||
|
|
|
@ -37,7 +37,7 @@ import java.util.zip.InflaterInputStream;
|
||||||
* <li><a href="http://docs.oracle.com/javase/7/docs/api/java/util/zip/Deflater.html#deflate(byte[],%20int,%20int,%20int)">The required deflate() method (Java7)</a>
|
* <li><a href="http://docs.oracle.com/javase/7/docs/api/java/util/zip/Deflater.html#deflate(byte[],%20int,%20int,%20int)">The required deflate() method (Java7)</a>
|
||||||
* <li><a href="http://developer.android.com/reference/java/util/zip/Deflater.html#deflate(byte[],%20int,%20int,%20int)">The required deflate() method (Android)</a>
|
* <li><a href="http://developer.android.com/reference/java/util/zip/Deflater.html#deflate(byte[],%20int,%20int,%20int)">The required deflate() method (Android)</a>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public class Java7ZlibInputOutputStream extends XMPPInputOutputStream {
|
public class Java7ZlibInputOutputStream extends XMPPInputOutputStream {
|
||||||
|
@ -74,7 +74,7 @@ public class Java7ZlibInputOutputStream extends XMPPInputOutputStream {
|
||||||
/**
|
/**
|
||||||
* Provide a more InputStream compatible version. A return value of 1 means that it is likely to read one
|
* Provide a more InputStream compatible version. A return value of 1 means that it is likely to read one
|
||||||
* byte without blocking, 0 means that the system is known to block for more input.
|
* byte without blocking, 0 means that the system is known to block for more input.
|
||||||
*
|
*
|
||||||
* @return 0 if no data is available, 1 otherwise
|
* @return 0 if no data is available, 1 otherwise
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@ -84,10 +84,10 @@ public class Java7ZlibInputOutputStream extends XMPPInputOutputStream {
|
||||||
* aSmack related remark (where KXmlParser is used):
|
* aSmack related remark (where KXmlParser is used):
|
||||||
* This is one of the funny code blocks. InflaterInputStream.available violates the contract of
|
* This is one of the funny code blocks. InflaterInputStream.available violates the contract of
|
||||||
* InputStream.available, which breaks kXML2.
|
* InputStream.available, which breaks kXML2.
|
||||||
*
|
*
|
||||||
* I'm not sure who's to blame, oracle/sun for a broken api or the google guys for mixing a sun bug with
|
* I'm not sure who's to blame, oracle/sun for a broken api or the google guys for mixing a sun bug with
|
||||||
* a xml reader that can't handle it....
|
* a xml reader that can't handle it....
|
||||||
*
|
*
|
||||||
* Anyway, this simple if breaks suns distorted reality, but helps to use the api as intended.
|
* Anyway, this simple if breaks suns distorted reality, but helps to use the api as intended.
|
||||||
*/
|
*/
|
||||||
if (inf.needsInput()) {
|
if (inf.needsInput()) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public abstract class XMPPInputOutputStream {
|
||||||
* Set the used flushed method when compressing data. The default is full flush which may not
|
* Set the used flushed method when compressing data. The default is full flush which may not
|
||||||
* achieve the best compression ratio, but provides better security against certain attacks.
|
* achieve the best compression ratio, but provides better security against certain attacks.
|
||||||
* Only use sync flush if you fully understand the implications.
|
* Only use sync flush if you fully understand the implications.
|
||||||
*
|
*
|
||||||
* @see <a href="https://blog.thijsalkema.de/blog/2014/08/07/https-attacks-and-xmpp-2-crime-and-breach/">Attacks against XMPP when using compression</a>
|
* @see <a href="https://blog.thijsalkema.de/blog/2014/08/07/https-attacks-and-xmpp-2-crime-and-breach/">Attacks against XMPP when using compression</a>
|
||||||
* @param flushMethod
|
* @param flushMethod
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,12 +26,12 @@ import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
||||||
import org.jxmpp.jid.EntityFullJid;
|
import org.jxmpp.jid.EntityFullJid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface that allows for implementing classes to debug XML traffic. That is a GUI window that
|
* Interface that allows for implementing classes to debug XML traffic. That is a GUI window that
|
||||||
* displays XML traffic.<p>
|
* displays XML traffic.<p>
|
||||||
*
|
*
|
||||||
* Every implementation of this interface <b>must</b> have a public constructor with the following
|
* Every implementation of this interface <b>must</b> have a public constructor with the following
|
||||||
* arguments: XMPPConnection, Writer, Reader.
|
* arguments: XMPPConnection, Writer, Reader.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
public abstract class SmackDebugger {
|
public abstract class SmackDebugger {
|
||||||
|
@ -43,10 +43,10 @@ public abstract class SmackDebugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a user has logged in to the server. The user could be an anonymous user, this
|
* Called when a user has logged in to the server. The user could be an anonymous user, this
|
||||||
* means that the user would be of the form host/resource instead of the form
|
* means that the user would be of the form host/resource instead of the form
|
||||||
* user@host/resource.
|
* user@host/resource.
|
||||||
*
|
*
|
||||||
* @param user the user@host/resource that has just logged in
|
* @param user the user@host/resource that has just logged in
|
||||||
*/
|
*/
|
||||||
// TODO: Should be replaced with a connection listener authenticed().
|
// TODO: Should be replaced with a connection listener authenticed().
|
||||||
|
|
|
@ -23,9 +23,9 @@ import org.jivesoftware.smack.util.Objects;
|
||||||
/**
|
/**
|
||||||
* A filter for IQ stanza types. Returns true only if the stanza is an IQ packet
|
* A filter for IQ stanza types. Returns true only if the stanza is an IQ packet
|
||||||
* and it matches the type provided in the constructor.
|
* and it matches the type provided in the constructor.
|
||||||
*
|
*
|
||||||
* @author Alexander Wenckus
|
* @author Alexander Wenckus
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class IQTypeFilter extends FlexibleStanzaTypeFilter<IQ> {
|
public final class IQTypeFilter extends FlexibleStanzaTypeFilter<IQ> {
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.jivesoftware.smack.packet.Message.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters for packets of a specific type of Message (e.g. CHAT).
|
* Filters for packets of a specific type of Message (e.g. CHAT).
|
||||||
*
|
*
|
||||||
* @see org.jivesoftware.smack.packet.Message.Type
|
* @see org.jivesoftware.smack.packet.Message.Type
|
||||||
* @author Ward Harold
|
* @author Ward Harold
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ public final class MessageTypeFilter extends FlexibleStanzaTypeFilter<Message> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new message type filter using the specified message type.
|
* Creates a new message type filter using the specified message type.
|
||||||
*
|
*
|
||||||
* @param type the message type.
|
* @param type the message type.
|
||||||
*/
|
*/
|
||||||
private MessageTypeFilter(Message.Type type) {
|
private MessageTypeFilter(Message.Type type) {
|
||||||
|
|
|
@ -22,10 +22,10 @@ import org.jivesoftware.smack.SmackConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an initialization class that will be instantiated and invoked by the {@link SmackConfiguration} class during initialization.
|
* Defines an initialization class that will be instantiated and invoked by the {@link SmackConfiguration} class during initialization.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Any implementation of this class MUST have a default constructor.
|
* Any implementation of this class MUST have a default constructor.
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jivesoftware.smack.util.FileUtils;
|
||||||
/**
|
/**
|
||||||
* Loads the provider file defined by the URL returned by {@link #getProvidersUri()} and the generic
|
* Loads the provider file defined by the URL returned by {@link #getProvidersUri()} and the generic
|
||||||
* smack configuration file returned {@link #getConfigUri()}.
|
* smack configuration file returned {@link #getConfigUri()}.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public abstract class UrlInitializer implements SmackInitializer {
|
public abstract class UrlInitializer implements SmackInitializer {
|
||||||
|
|
|
@ -23,9 +23,9 @@ import org.jivesoftware.smack.provider.ProviderManager;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks for a provider file location based on the VM argument <i>smack.provider.file</i>. If it is supplied, its value will
|
* Looks for a provider file location based on the VM argument <i>smack.provider.file</i>. If it is supplied, its value will
|
||||||
* be used as a file location for a providers file and loaded into the {@link ProviderManager} on Smack initialization.
|
* be used as a file location for a providers file and loaded into the {@link ProviderManager} on Smack initialization.
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class AbstractError {
|
||||||
* <p>
|
* <p>
|
||||||
* Returns the descriptive text of this SASLFailure in the system default language if possible. May return null.
|
* Returns the descriptive text of this SASLFailure in the system default language if possible. May return null.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return the descriptive text or null.
|
* @return the descriptive text or null.
|
||||||
*/
|
*/
|
||||||
public String getDescriptiveText() {
|
public String getDescriptiveText() {
|
||||||
|
@ -81,7 +81,7 @@ public class AbstractError {
|
||||||
* <p>
|
* <p>
|
||||||
* Returns the descriptive text of this SASLFailure in the given language. May return null if not available.
|
* Returns the descriptive text of this SASLFailure in the given language. May return null if not available.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param xmllang the language.
|
* @param xmllang the language.
|
||||||
* @return the descriptive text or null.
|
* @return the descriptive text or null.
|
||||||
*/
|
*/
|
||||||
|
@ -92,7 +92,7 @@ public class AbstractError {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first stanza extension that matches the specified element name and
|
* Returns the first stanza extension that matches the specified element name and
|
||||||
* namespace, or <tt>null</tt> if it doesn't exist.
|
* namespace, or <tt>null</tt> if it doesn't exist.
|
||||||
*
|
*
|
||||||
* @param elementName the XML element name of the stanza extension.
|
* @param elementName the XML element name of the stanza extension.
|
||||||
* @param namespace the XML element namespace of the stanza extension.
|
* @param namespace the XML element namespace of the stanza extension.
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.jxmpp.jid.parts.Resourcepart;
|
||||||
* resource but the server may return a modified version of the sent resource.<p>
|
* resource but the server may return a modified version of the sent resource.<p>
|
||||||
*
|
*
|
||||||
* For more information refer to the following
|
* For more information refer to the following
|
||||||
* <a href=http://www.xmpp.org/specs/rfc3920.html#bind>link</a>.
|
* <a href=http://www.xmpp.org/specs/rfc3920.html#bind>link</a>.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -211,7 +211,7 @@ public abstract class IQ extends Stanza {
|
||||||
* </pre>
|
* </pre>
|
||||||
* If your IQ does not contain any attributes or child elements (besides {@link ExtensionElement}s), consider sub-classing
|
* If your IQ does not contain any attributes or child elements (besides {@link ExtensionElement}s), consider sub-classing
|
||||||
* {@link SimpleIQ} instead.
|
* {@link SimpleIQ} instead.
|
||||||
*
|
*
|
||||||
* @param xml a pre-created builder which already has the child element and the 'xmlns' attribute set.
|
* @param xml a pre-created builder which already has the child element and the 'xmlns' attribute set.
|
||||||
* @return the build to create the IQ child content.
|
* @return the build to create the IQ child content.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -220,7 +220,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
*/
|
*/
|
||||||
public void setSubject(String subject) {
|
public void setSubject(String subject) {
|
||||||
if (subject == null) {
|
if (subject == null) {
|
||||||
removeSubject(""); // use empty string because #removeSubject(null) is ambiguous
|
removeSubject(""); // use empty string because #removeSubject(null) is ambiguous
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addSubject(null, subject);
|
addSubject(null, subject);
|
||||||
|
@ -751,7 +751,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
/**
|
/**
|
||||||
* Converts a String into the corresponding types. Valid String values that can be converted
|
* Converts a String into the corresponding types. Valid String values that can be converted
|
||||||
* to types are: "normal", "chat", "groupchat", "headline" and "error".
|
* to types are: "normal", "chat", "groupchat", "headline" and "error".
|
||||||
*
|
*
|
||||||
* @param string the String value to covert.
|
* @param string the String value to covert.
|
||||||
* @return the corresponding Type.
|
* @return the corresponding Type.
|
||||||
* @throws IllegalArgumentException when not able to parse the string parameter
|
* @throws IllegalArgumentException when not able to parse the string parameter
|
||||||
|
|
|
@ -162,9 +162,9 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* Returns the first stanza extension that matches the specified element name and
|
* Returns the first stanza extension that matches the specified element name and
|
||||||
* namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null,
|
* namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null,
|
||||||
* only the namespace is matched. Stanza extensions are
|
* only the namespace is matched. Stanza extensions are
|
||||||
* are arbitrary XML sub-documents in standard XMPP packets. By default, a
|
* are arbitrary XML sub-documents in standard XMPP packets. By default, a
|
||||||
* DefaultPacketExtension instance will be returned for each extension. However,
|
* DefaultPacketExtension instance will be returned for each extension. However,
|
||||||
* PacketExtensionProvider instances can be registered with the
|
* PacketExtensionProvider instances can be registered with the
|
||||||
* {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager}
|
* {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager}
|
||||||
* class to handle custom parsing. In that case, the type of the Object
|
* class to handle custom parsing. In that case, the type of the Object
|
||||||
* will be determined by the provider.
|
* will be determined by the provider.
|
||||||
|
@ -184,7 +184,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a collection of stanza extensions to the packet. Does nothing if extensions is null.
|
* Adds a collection of stanza extensions to the packet. Does nothing if extensions is null.
|
||||||
*
|
*
|
||||||
* @param extensions a collection of stanza extensions
|
* @param extensions a collection of stanza extensions
|
||||||
*/
|
*/
|
||||||
void addExtensions(Collection<ExtensionElement> extensions);
|
void addExtensions(Collection<ExtensionElement> extensions);
|
||||||
|
@ -203,7 +203,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a stanza extension with the given namespace exists.
|
* Check if a stanza extension with the given namespace exists.
|
||||||
*
|
*
|
||||||
* @param namespace
|
* @param namespace
|
||||||
* @return true if a stanza extension exists, false otherwise.
|
* @return true if a stanza extension exists, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -146,7 +146,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||||
* @return true if the presence type is available.
|
* @return true if the presence type is available.
|
||||||
*/
|
*/
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
return type == Type.available;
|
return type == Type.available;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +160,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||||
* @return true if the presence type is available and the presence mode is away, xa, or dnd.
|
* @return true if the presence type is available and the presence mode is away, xa, or dnd.
|
||||||
*/
|
*/
|
||||||
public boolean isAway() {
|
public boolean isAway() {
|
||||||
return type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd);
|
return type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -378,7 +378,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||||
* Converts a String into the corresponding types. Valid String values that can be converted
|
* Converts a String into the corresponding types. Valid String values that can be converted
|
||||||
* to types are: "available", "unavailable", "subscribe", "subscribed", "unsubscribe",
|
* to types are: "available", "unavailable", "subscribe", "subscribed", "unsubscribe",
|
||||||
* "unsubscribed" and "error".
|
* "unsubscribed" and "error".
|
||||||
*
|
*
|
||||||
* @param string the String value to covert.
|
* @param string the String value to covert.
|
||||||
* @return the corresponding Type.
|
* @return the corresponding Type.
|
||||||
* @throws IllegalArgumentException when not able to parse the string parameter
|
* @throws IllegalArgumentException when not able to parse the string parameter
|
||||||
|
@ -422,7 +422,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||||
/**
|
/**
|
||||||
* Converts a String into the corresponding types. Valid String values that can be converted
|
* Converts a String into the corresponding types. Valid String values that can be converted
|
||||||
* to types are: "chat", "available", "away", "xa", and "dnd".
|
* to types are: "chat", "available", "away", "xa", and "dnd".
|
||||||
*
|
*
|
||||||
* @param string the String value to covert.
|
* @param string the String value to covert.
|
||||||
* @return the corresponding Type.
|
* @return the corresponding Type.
|
||||||
* @throws IllegalArgumentException when not able to parse the string parameter
|
* @throws IllegalArgumentException when not able to parse the string parameter
|
||||||
|
|
|
@ -151,7 +151,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the stanza id if none is set.
|
* Set the stanza id if none is set.
|
||||||
*
|
*
|
||||||
* @return the stanza id.
|
* @return the stanza id.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
|
@ -402,7 +402,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a collection of stanza extensions to the packet. Does nothing if extensions is null.
|
* Adds a collection of stanza extensions to the packet. Does nothing if extensions is null.
|
||||||
*
|
*
|
||||||
* @param extensions a collection of stanza extensions
|
* @param extensions a collection of stanza extensions
|
||||||
*/
|
*/
|
||||||
public void addExtensions(Collection<ExtensionElement> extensions) {
|
public void addExtensions(Collection<ExtensionElement> extensions) {
|
||||||
|
@ -434,7 +434,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a stanza extension with the given namespace exists.
|
* Check if a stanza extension with the given namespace exists.
|
||||||
*
|
*
|
||||||
* @param namespace
|
* @param namespace
|
||||||
* @return true if a stanza extension exists, false otherwise.
|
* @return true if a stanza extension exists, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
@ -489,7 +489,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default language used for all messages containing localized content.
|
* Returns the default language used for all messages containing localized content.
|
||||||
*
|
*
|
||||||
* @return the default language
|
* @return the default language
|
||||||
*/
|
*/
|
||||||
public static String getDefaultLanguage() {
|
public static String getDefaultLanguage() {
|
||||||
|
|
|
@ -104,14 +104,14 @@ public class StanzaError extends AbstractError {
|
||||||
/**
|
/**
|
||||||
* Creates a new error with the specified type, condition and message.
|
* Creates a new error with the specified type, condition and message.
|
||||||
* This constructor is used when the condition is not recognized automatically by XMPPError
|
* This constructor is used when the condition is not recognized automatically by XMPPError
|
||||||
* i.e. there is not a defined instance of ErrorCondition or it does not apply the default
|
* i.e. there is not a defined instance of ErrorCondition or it does not apply the default
|
||||||
* specification.
|
* specification.
|
||||||
*
|
*
|
||||||
* @param type the error type.
|
* @param type the error type.
|
||||||
* @param condition the error condition.
|
* @param condition the error condition.
|
||||||
* @param conditionText
|
* @param conditionText
|
||||||
* @param errorGenerator
|
* @param errorGenerator
|
||||||
* @param descriptiveTexts
|
* @param descriptiveTexts
|
||||||
* @param extensions list of stanza extensions
|
* @param extensions list of stanza extensions
|
||||||
* @param stanza the stanza carrying this XMPP error.
|
* @param stanza the stanza carrying this XMPP error.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,9 +24,9 @@ import org.jivesoftware.smack.UnparseableStanza;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple parsing exception callback that only logs the encountered parsing exception to java util logging.
|
* Simple parsing exception callback that only logs the encountered parsing exception to java util logging.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ExceptionLoggingCallback implements ParsingExceptionCallback {
|
public class ExceptionLoggingCallback implements ParsingExceptionCallback {
|
||||||
private static final Logger LOGGER = Logger.getLogger(ExceptionLoggingCallback.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ExceptionLoggingCallback.class.getName());
|
||||||
|
|
|
@ -23,9 +23,9 @@ import org.jivesoftware.smack.UnparseableStanza;
|
||||||
/**
|
/**
|
||||||
* Parsing exception callback class that simply throws the encountered parsing exception. This usually leads to an
|
* Parsing exception callback class that simply throws the encountered parsing exception. This usually leads to an
|
||||||
* {@link ConnectionListener#connectionClosedOnError(Exception)} and disconnect of the connection.
|
* {@link ConnectionListener#connectionClosedOnError(Exception)} and disconnect of the connection.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ExceptionThrowingCallback implements ParsingExceptionCallback {
|
public class ExceptionThrowingCallback implements ParsingExceptionCallback {
|
||||||
|
|
||||||
|
|
|
@ -27,15 +27,15 @@ import org.jivesoftware.smack.UnparseableStanza;
|
||||||
* <p>
|
* <p>
|
||||||
* Smack provides 2 predefined ParsingExceptionCallback's: {@link ExceptionLoggingCallback} and {@link ExceptionThrowingCallback}.
|
* Smack provides 2 predefined ParsingExceptionCallback's: {@link ExceptionLoggingCallback} and {@link ExceptionThrowingCallback}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ParsingExceptionCallback {
|
public interface ParsingExceptionCallback {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when parsing a stanza caused an exception.
|
* Called when parsing a stanza caused an exception.
|
||||||
*
|
*
|
||||||
* @param stanzaData the raw stanza data that caused the exception
|
* @param stanzaData the raw stanza data that caused the exception
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,20 +27,20 @@ import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This class simplifies parsing of embedded elements by using the
|
* This class simplifies parsing of embedded elements by using the
|
||||||
* <a href="http://en.wikipedia.org/wiki/Template_method_pattern">Template Method Pattern</a>.
|
* <a href="http://en.wikipedia.org/wiki/Template_method_pattern">Template Method Pattern</a>.
|
||||||
* After extracting the current element attributes and content of any child elements, the template method
|
* After extracting the current element attributes and content of any child elements, the template method
|
||||||
* ({@link #createReturnExtension(String, String, Map, List)} is called. Subclasses
|
* ({@link #createReturnExtension(String, String, Map, List)} is called. Subclasses
|
||||||
* then override this method to create the specific return type.
|
* then override this method to create the specific return type.
|
||||||
*
|
*
|
||||||
* <p>To use this class, you simply register your subclasses as extension providers in the
|
* <p>To use this class, you simply register your subclasses as extension providers in the
|
||||||
* <b>smack.properties</b> file. Then they will be automatically picked up and used to parse
|
* <b>smack.properties</b> file. Then they will be automatically picked up and used to parse
|
||||||
* any child elements.
|
* any child elements.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* For example, given the following message
|
* For example, given the following message
|
||||||
*
|
*
|
||||||
* <message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo>
|
* <message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo>
|
||||||
* <event xmlns='http://jabber.org/protocol/pubsub#event>
|
* <event xmlns='http://jabber.org/protocol/pubsub#event>
|
||||||
* <items node='princely_musings'>
|
* <items node='princely_musings'>
|
||||||
|
@ -54,16 +54,16 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
* </items>
|
* </items>
|
||||||
* </event>
|
* </event>
|
||||||
* </message>
|
* </message>
|
||||||
*
|
*
|
||||||
* I would have a classes
|
* I would have a classes
|
||||||
* <tt>ItemsProvider</tt> extends {@link EmbeddedExtensionProvider}
|
* <tt>ItemsProvider</tt> extends {@link EmbeddedExtensionProvider}
|
||||||
* <tt>ItemProvider</tt> extends {@link EmbeddedExtensionProvider}
|
* <tt>ItemProvider</tt> extends {@link EmbeddedExtensionProvider}
|
||||||
* and
|
* and
|
||||||
* AtomProvider extends {@link ExtensionElementProvider}
|
* AtomProvider extends {@link ExtensionElementProvider}
|
||||||
*
|
*
|
||||||
* These classes are then registered in the meta-inf/smack.providers file
|
* These classes are then registered in the meta-inf/smack.providers file
|
||||||
* as follows.
|
* as follows.
|
||||||
*
|
*
|
||||||
* <extensionProvider>
|
* <extensionProvider>
|
||||||
* <elementName>items</elementName>
|
* <elementName>items</elementName>
|
||||||
* <namespace>http://jabber.org/protocol/pubsub#event</namespace>
|
* <namespace>http://jabber.org/protocol/pubsub#event</namespace>
|
||||||
|
@ -74,9 +74,9 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
* <namespace>http://jabber.org/protocol/pubsub#event</namespace>
|
* <namespace>http://jabber.org/protocol/pubsub#event</namespace>
|
||||||
* <className>org.jivesoftware.smackx.provider.ItemProvider</className>
|
* <className>org.jivesoftware.smackx.provider.ItemProvider</className>
|
||||||
* </extensionProvider>
|
* </extensionProvider>
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> extends ExtensionElementProvider<PE> {
|
public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> extends ExtensionElementProvider<PE> {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
/**
|
/**
|
||||||
* Defines the information required to register a stanza extension Provider with the {@link ProviderManager} when using the
|
* Defines the information required to register a stanza extension Provider with the {@link ProviderManager} when using the
|
||||||
* {@link ProviderLoader}.
|
* {@link ProviderLoader}.
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@ public final class ExtensionProviderInfo extends AbstractProviderInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an extension provider which implements the <code>ExtensionElementProvider</code> interface.
|
* Defines an extension provider which implements the <code>ExtensionElementProvider</code> interface.
|
||||||
*
|
*
|
||||||
* @param elementName Element that provider parses.
|
* @param elementName Element that provider parses.
|
||||||
* @param namespace Namespace that provider parses.
|
* @param namespace Namespace that provider parses.
|
||||||
* @param extProvider The provider implementation.
|
* @param extProvider The provider implementation.
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.packet.IQ;
|
||||||
/**
|
/**
|
||||||
* Defines the information required to register an IQ Provider with the {@link ProviderManager} when using the
|
* Defines the information required to register an IQ Provider with the {@link ProviderManager} when using the
|
||||||
* {@link ProviderLoader}.
|
* {@link ProviderLoader}.
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@ public final class IQProviderInfo extends AbstractProviderInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an IQ provider which implements the <code>IQProvider</code> interface.
|
* Defines an IQ provider which implements the <code>IQProvider</code> interface.
|
||||||
*
|
*
|
||||||
* @param elementName Element that provider parses.
|
* @param elementName Element that provider parses.
|
||||||
* @param namespace Namespace that provider parses.
|
* @param namespace Namespace that provider parses.
|
||||||
* @param iqProvider The provider implementation.
|
* @param iqProvider The provider implementation.
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
* element does not follow the specification, for example by putting a string where only integers are allowed, then a
|
* element does not follow the specification, for example by putting a string where only integers are allowed, then a
|
||||||
* {@link org.jivesoftware.smack.SmackException} should be thrown.
|
* {@link org.jivesoftware.smack.SmackException} should be thrown.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
* @param <E> the type of the resulting element.
|
* @param <E> the type of the resulting element.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,9 +31,9 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserFactory;
|
import org.xmlpull.v1.XmlPullParserFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the {@link IQProvider} and {@link ExtensionElementProvider} information from a standard provider file in preparation
|
* Loads the {@link IQProvider} and {@link ExtensionElementProvider} information from a standard provider file in preparation
|
||||||
* for loading into the {@link ProviderManager}.
|
* for loading into the {@link ProviderManager}.
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to load providers into the {@link ProviderManager}.
|
* Used to load providers into the {@link ProviderManager}.
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
public interface ProviderLoader {
|
public interface ProviderLoader {
|
||||||
|
@ -40,7 +40,7 @@ public interface ProviderLoader {
|
||||||
/**
|
/**
|
||||||
* Provides the stream feature providers information for the creation of stream feature
|
* Provides the stream feature providers information for the creation of stream feature
|
||||||
* providers to be added to the <code>ProviderManager</code>.
|
* providers to be added to the <code>ProviderManager</code>.
|
||||||
*
|
*
|
||||||
* @return The extension provider info to load.
|
* @return The extension provider info to load.
|
||||||
*/
|
*/
|
||||||
Collection<StreamFeatureProviderInfo> getStreamFeatureProviderInfo();
|
Collection<StreamFeatureProviderInfo> getStreamFeatureProviderInfo();
|
||||||
|
|
|
@ -22,7 +22,7 @@ public final class StreamFeatureProviderInfo extends AbstractProviderInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an extension provider which implements the <code>StreamFeatureProvider</code> interface.
|
* Defines an extension provider which implements the <code>StreamFeatureProvider</code> interface.
|
||||||
*
|
*
|
||||||
* @param elementName Element that provider parses.
|
* @param elementName Element that provider parses.
|
||||||
* @param namespace Namespace that provider parses.
|
* @param namespace Namespace that provider parses.
|
||||||
* @param extProvider The provider implementation.
|
* @param extProvider The provider implementation.
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP Proxy Socket Connection which connects the socket using a HTTP Proxy.
|
* HTTP Proxy Socket Connection which connects the socket using a HTTP Proxy.
|
||||||
*
|
*
|
||||||
* @author Atul Aggarwal
|
* @author Atul Aggarwal
|
||||||
*/
|
*/
|
||||||
class HTTPProxySocketConnection implements ProxySocketConnection {
|
class HTTPProxySocketConnection implements ProxySocketConnection {
|
||||||
|
@ -92,7 +92,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {
|
||||||
|
|
||||||
if (nlchars != 4) {
|
if (nlchars != 4) {
|
||||||
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Never " +
|
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Never " +
|
||||||
"received blank line from "
|
"received blank line from "
|
||||||
+ proxyhost + ", cancelling connection");
|
+ proxyhost + ", cancelling connection");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@ import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An exception class to handle exceptions caused by proxy.
|
* An exception class to handle exceptions caused by proxy.
|
||||||
*
|
*
|
||||||
* @author Atul Aggarwal
|
* @author Atul Aggarwal
|
||||||
*/
|
*/
|
||||||
public class ProxyException extends IOException {
|
public class ProxyException extends IOException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
package org.jivesoftware.smack.proxy;
|
package org.jivesoftware.smack.proxy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class which stores proxy information such as proxy type, host, port,
|
* Class which stores proxy information such as proxy type, host, port,
|
||||||
* authentication etc.
|
* authentication etc.
|
||||||
*
|
*
|
||||||
* @author Atul Aggarwal
|
* @author Atul Aggarwal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class ProxyInfo {
|
||||||
private ProxyType proxyType;
|
private ProxyType proxyType;
|
||||||
private final ProxySocketConnection proxySocketConnection;
|
private final ProxySocketConnection proxySocketConnection;
|
||||||
|
|
||||||
public ProxyInfo(ProxyType pType, String pHost, int pPort, String pUser,
|
public ProxyInfo(ProxyType pType, String pHost, int pPort, String pUser,
|
||||||
String pPass) {
|
String pPass) {
|
||||||
this.proxyType = pType;
|
this.proxyType = pType;
|
||||||
this.proxyAddress = pHost;
|
this.proxyAddress = pHost;
|
||||||
|
@ -59,17 +59,17 @@ public class ProxyInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProxyInfo forHttpProxy(String pHost, int pPort, String pUser,
|
public static ProxyInfo forHttpProxy(String pHost, int pPort, String pUser,
|
||||||
String pPass) {
|
String pPass) {
|
||||||
return new ProxyInfo(ProxyType.HTTP, pHost, pPort, pUser, pPass);
|
return new ProxyInfo(ProxyType.HTTP, pHost, pPort, pUser, pPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProxyInfo forSocks4Proxy(String pHost, int pPort, String pUser,
|
public static ProxyInfo forSocks4Proxy(String pHost, int pPort, String pUser,
|
||||||
String pPass) {
|
String pPass) {
|
||||||
return new ProxyInfo(ProxyType.SOCKS4, pHost, pPort, pUser, pPass);
|
return new ProxyInfo(ProxyType.SOCKS4, pHost, pPort, pUser, pPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProxyInfo forSocks5Proxy(String pHost, int pPort, String pUser,
|
public static ProxyInfo forSocks5Proxy(String pHost, int pPort, String pUser,
|
||||||
String pPass) {
|
String pPass) {
|
||||||
return new ProxyInfo(ProxyType.SOCKS5, pHost, pPort, pUser, pPass);
|
return new ProxyInfo(ProxyType.SOCKS5, pHost, pPort, pUser, pPass);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Socket factory for socks4 proxy.
|
* Socket factory for socks4 proxy.
|
||||||
*
|
*
|
||||||
* @author Atul Aggarwal
|
* @author Atul Aggarwal
|
||||||
*/
|
*/
|
||||||
public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
||||||
|
@ -101,7 +101,7 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
||||||
consulting IDENT, cf. RFC 1413. If the request is granted, the SOCKS
|
consulting IDENT, cf. RFC 1413. If the request is granted, the SOCKS
|
||||||
server makes a connection to the specified port of the destination host.
|
server makes a connection to the specified port of the destination host.
|
||||||
A reply packet is sent to the client when this connection is established,
|
A reply packet is sent to the client when this connection is established,
|
||||||
or when the request is rejected or the operation fails.
|
or when the request is rejected or the operation fails.
|
||||||
|
|
||||||
+----+----+----+----+----+----+----+----+
|
+----+----+----+----+----+----+----+----+
|
||||||
| VN | CD | DSTPORT | DSTIP |
|
| VN | CD | DSTPORT | DSTIP |
|
||||||
|
@ -126,13 +126,13 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
||||||
while (s < len) {
|
while (s < len) {
|
||||||
int i = in.read(buf, s, len - s);
|
int i = in.read(buf, s, len - s);
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4,
|
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4,
|
||||||
"stream is closed");
|
"stream is closed");
|
||||||
}
|
}
|
||||||
s += i;
|
s += i;
|
||||||
}
|
}
|
||||||
if (buf[0] != 0) {
|
if (buf[0] != 0) {
|
||||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4,
|
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4,
|
||||||
"server returns VN " + buf[0]);
|
"server returns VN " + buf[0]);
|
||||||
}
|
}
|
||||||
if (buf[1] != 90) {
|
if (buf[1] != 90) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Socket factory for Socks5 proxy.
|
* Socket factory for Socks5 proxy.
|
||||||
*
|
*
|
||||||
* @author Atul Aggarwal
|
* @author Atul Aggarwal
|
||||||
*/
|
*/
|
||||||
public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
||||||
|
@ -130,12 +130,12 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
||||||
buf[index++] = 1;
|
buf[index++] = 1;
|
||||||
buf[index++] = (byte) (user.length());
|
buf[index++] = (byte) (user.length());
|
||||||
byte[] userBytes = user.getBytes(StringUtils.UTF8);
|
byte[] userBytes = user.getBytes(StringUtils.UTF8);
|
||||||
System.arraycopy(userBytes, 0, buf, index,
|
System.arraycopy(userBytes, 0, buf, index,
|
||||||
user.length());
|
user.length());
|
||||||
index += user.length();
|
index += user.length();
|
||||||
byte[] passwordBytes = passwd.getBytes(StringUtils.UTF8);
|
byte[] passwordBytes = passwd.getBytes(StringUtils.UTF8);
|
||||||
buf[index++] = (byte) (passwordBytes.length);
|
buf[index++] = (byte) (passwordBytes.length);
|
||||||
System.arraycopy(passwordBytes, 0, buf, index,
|
System.arraycopy(passwordBytes, 0, buf, index,
|
||||||
passwd.length());
|
passwd.length());
|
||||||
index += passwd.length();
|
index += passwd.length();
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
||||||
}
|
}
|
||||||
catch (Exception eee) {
|
catch (Exception eee) {
|
||||||
}
|
}
|
||||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS5,
|
throw new ProxyException(ProxyInfo.ProxyType.SOCKS5,
|
||||||
"server returns " + buf[1]);
|
"server returns " + buf[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fill(InputStream in, byte[] buf, int len)
|
private static void fill(InputStream in, byte[] buf, int len)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
int s = 0;
|
int s = 0;
|
||||||
while (s < len) {
|
while (s < len) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||||
public class SASLErrorException extends XMPPException {
|
public class SASLErrorException extends XMPPException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 6247573875760717257L;
|
private static final long serialVersionUID = 6247573875760717257L;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
||||||
* <p>
|
* <p>
|
||||||
* A simple SASLPrep StringTransformer would be for example: <code>java.text.Normalizer.normalize(string, Form.NFKC);</code>
|
* A simple SASLPrep StringTransformer would be for example: <code>java.text.Normalizer.normalize(string, Form.NFKC);</code>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param stringTransformer set StringTransformer to use for SASLPrep.
|
* @param stringTransformer set StringTransformer to use for SASLPrep.
|
||||||
* @see <a href="http://tools.ietf.org/html/rfc4013">RFC 4013 - SASLprep: Stringprep Profile for User Names and Passwords</a>
|
* @see <a href="http://tools.ietf.org/html/rfc4013">RFC 4013 - SASLprep: Stringprep Profile for User Names and Passwords</a>
|
||||||
*/
|
*/
|
||||||
|
@ -111,28 +111,28 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
||||||
* Builds and sends the <tt>auth</tt> stanza to the server. Note that this method of
|
* Builds and sends the <tt>auth</tt> stanza to the server. Note that this method of
|
||||||
* authentication is not recommended, since it is very inflexible. Use
|
* authentication is not recommended, since it is very inflexible. Use
|
||||||
* {@link #authenticate(String, DomainBareJid, CallbackHandler, EntityBareJid, SSLSession)} whenever possible.
|
* {@link #authenticate(String, DomainBareJid, CallbackHandler, EntityBareJid, SSLSession)} whenever possible.
|
||||||
*
|
*
|
||||||
* Explanation of auth stanza:
|
* Explanation of auth stanza:
|
||||||
*
|
*
|
||||||
* The client authentication stanza needs to include the digest-uri of the form: xmpp/serviceName
|
* The client authentication stanza needs to include the digest-uri of the form: xmpp/serviceName
|
||||||
* From RFC-2831:
|
* From RFC-2831:
|
||||||
* digest-uri = "digest-uri" "=" digest-uri-value
|
* digest-uri = "digest-uri" "=" digest-uri-value
|
||||||
* digest-uri-value = serv-type "/" host [ "/" serv-name ]
|
* digest-uri-value = serv-type "/" host [ "/" serv-name ]
|
||||||
*
|
*
|
||||||
* digest-uri:
|
* digest-uri:
|
||||||
* Indicates the principal name of the service with which the client
|
* Indicates the principal name of the service with which the client
|
||||||
* wishes to connect, formed from the serv-type, host, and serv-name.
|
* wishes to connect, formed from the serv-type, host, and serv-name.
|
||||||
* For example, the FTP service
|
* For example, the FTP service
|
||||||
* on "ftp.example.com" would have a "digest-uri" value of "ftp/ftp.example.com"; the SMTP
|
* on "ftp.example.com" would have a "digest-uri" value of "ftp/ftp.example.com"; the SMTP
|
||||||
* server from the example above would have a "digest-uri" value of
|
* server from the example above would have a "digest-uri" value of
|
||||||
* "smtp/mail3.example.com/example.com".
|
* "smtp/mail3.example.com/example.com".
|
||||||
*
|
*
|
||||||
* host:
|
* host:
|
||||||
* The DNS host name or IP address for the service requested. The DNS host name
|
* The DNS host name or IP address for the service requested. The DNS host name
|
||||||
* must be the fully-qualified canonical name of the host. The DNS host name is the
|
* must be the fully-qualified canonical name of the host. The DNS host name is the
|
||||||
* preferred form; see notes on server processing of the digest-uri.
|
* preferred form; see notes on server processing of the digest-uri.
|
||||||
*
|
*
|
||||||
* serv-name:
|
* serv-name:
|
||||||
* Indicates the name of the service if it is replicated. The service is
|
* Indicates the name of the service if it is replicated. The service is
|
||||||
* considered to be replicated if the client's service-location process involves resolution
|
* considered to be replicated if the client's service-location process involves resolution
|
||||||
* using standard DNS lookup operations, and if these operations involve DNS records (such
|
* using standard DNS lookup operations, and if these operations involve DNS records (such
|
||||||
|
@ -154,8 +154,8 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
||||||
* @param authzid the optional authorization identity.
|
* @param authzid the optional authorization identity.
|
||||||
* @param sslSession the optional SSL/TLS session (if one was established)
|
* @param sslSession the optional SSL/TLS session (if one was established)
|
||||||
* @throws SmackException If a network error occurs while authenticating.
|
* @throws SmackException If a network error occurs while authenticating.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public final void authenticate(String username, String host, DomainBareJid serviceName, String password,
|
public final void authenticate(String username, String host, DomainBareJid serviceName, String password,
|
||||||
EntityBareJid authzid, SSLSession sslSession)
|
EntityBareJid authzid, SSLSession sslSession)
|
||||||
|
@ -187,8 +187,8 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
||||||
* @param authzid the optional authorization identity.
|
* @param authzid the optional authorization identity.
|
||||||
* @param sslSession the optional SSL/TLS session (if one was established)
|
* @param sslSession the optional SSL/TLS session (if one was established)
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public void authenticate(String host, DomainBareJid serviceName, CallbackHandler cbh, EntityBareJid authzid, SSLSession sslSession)
|
public void authenticate(String host, DomainBareJid serviceName, CallbackHandler cbh, EntityBareJid authzid, SSLSession sslSession)
|
||||||
throws SmackException, NotConnectedException, InterruptedException {
|
throws SmackException, NotConnectedException, InterruptedException {
|
||||||
|
@ -225,7 +225,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
||||||
* Should return the initial response of the SASL mechanism. The returned byte array will be
|
* Should return the initial response of the SASL mechanism. The returned byte array will be
|
||||||
* send base64 encoded to the server. SASL mechanism are free to return <code>null</code> or an
|
* send base64 encoded to the server. SASL mechanism are free to return <code>null</code> or an
|
||||||
* empty array here.
|
* empty array here.
|
||||||
*
|
*
|
||||||
* @return the initial response or null
|
* @return the initial response or null
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
*/
|
*/
|
||||||
|
@ -313,7 +313,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SASLprep the given String. The resulting String is in UTF-8.
|
* SASLprep the given String. The resulting String is in UTF-8.
|
||||||
*
|
*
|
||||||
* @param string the String to sasl prep.
|
* @param string the String to sasl prep.
|
||||||
* @return the given String SASL preped
|
* @return the given String SASL preped
|
||||||
* @see <a href="http://tools.ietf.org/html/rfc4013">RFC 4013 - SASLprep: Stringprep Profile for User Names and Passwords</a>
|
* @see <a href="http://tools.ietf.org/html/rfc4013">RFC 4013 - SASLprep: Stringprep Profile for User Names and Passwords</a>
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.jivesoftware.smack.sasl.SASLMechanism;
|
||||||
* Note that X-OAUTH2 is experimental in Smack. This is because Google defined, besides being a bad practice (XEP-134),
|
* Note that X-OAUTH2 is experimental in Smack. This is because Google defined, besides being a bad practice (XEP-134),
|
||||||
* custom attributes to the 'auth' stanza, as can be seen here
|
* custom attributes to the 'auth' stanza, as can be seen here
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* {@code
|
* {@code
|
||||||
* <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="X-OAUTH2"
|
* <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="X-OAUTH2"
|
||||||
|
@ -40,9 +40,9 @@ import org.jivesoftware.smack.sasl.SASLMechanism;
|
||||||
* auth:client-uses-full-bind-result="true" xmlns:auth="http://www.google.com/talk/protocol/auth">
|
* auth:client-uses-full-bind-result="true" xmlns:auth="http://www.google.com/talk/protocol/auth">
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* from https://developers.google.com/cloud-print/docs/rawxmpp and here
|
* from https://developers.google.com/cloud-print/docs/rawxmpp and here
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* {@code
|
* {@code
|
||||||
* <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
|
* <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
|
||||||
|
@ -53,7 +53,7 @@ import org.jivesoftware.smack.sasl.SASLMechanism;
|
||||||
* </auth>
|
* </auth>
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* from https://developers.google.com/talk/jep_extensions/oauth
|
* from https://developers.google.com/talk/jep_extensions/oauth
|
||||||
* <p>
|
* <p>
|
||||||
* Those attribute extensions are currently not supported by Smack, and it's unclear how it affects authorization and
|
* Those attribute extensions are currently not supported by Smack, and it's unclear how it affects authorization and
|
||||||
|
|
|
@ -24,7 +24,7 @@ public interface ScramHmac {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC 5802 § 2.2 HMAC(key, str).
|
* RFC 5802 § 2.2 HMAC(key, str).
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param str
|
* @param str
|
||||||
* @return the HMAC-SHA1 value of the input.
|
* @return the HMAC-SHA1 value of the input.
|
||||||
|
|
|
@ -262,7 +262,7 @@ public abstract class ScramMechanism extends SASLMechanism {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the Channel Binding data.
|
* @return the Channel Binding data.
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
*/
|
*/
|
||||||
|
@ -356,11 +356,11 @@ public abstract class ScramMechanism extends SASLMechanism {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC 5802 § 2.2 HMAC(key, str)
|
* RFC 5802 § 2.2 HMAC(key, str)
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param str
|
* @param str
|
||||||
* @return the HMAC-SHA1 value of the input.
|
* @return the HMAC-SHA1 value of the input.
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
*/
|
*/
|
||||||
private byte[] hmac(byte[] key, byte[] str) throws SmackException {
|
private byte[] hmac(byte[] key, byte[] str) throws SmackException {
|
||||||
try {
|
try {
|
||||||
|
@ -377,12 +377,12 @@ public abstract class ScramMechanism extends SASLMechanism {
|
||||||
* Hi() is, essentially, PBKDF2 [RFC2898] with HMAC() as the pseudorandom function
|
* Hi() is, essentially, PBKDF2 [RFC2898] with HMAC() as the pseudorandom function
|
||||||
* (PRF) and with dkLen == output length of HMAC() == output length of H().
|
* (PRF) and with dkLen == output length of HMAC() == output length of H().
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param normalizedPassword the normalized password.
|
* @param normalizedPassword the normalized password.
|
||||||
* @param salt
|
* @param salt
|
||||||
* @param iterations
|
* @param iterations
|
||||||
* @return the result of the Hi function.
|
* @return the result of the Hi function.
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
*/
|
*/
|
||||||
private byte[] hi(String normalizedPassword, byte[] salt, int iterations) throws SmackException {
|
private byte[] hi(String normalizedPassword, byte[] salt, int iterations) throws SmackException {
|
||||||
byte[] key;
|
byte[] key;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smack.util.TLSUtils;
|
||||||
* SCRAM-X-PLUS implementation. Due limitations of the Java API, this mechanism only supports the 'tls-server-end-point'
|
* SCRAM-X-PLUS implementation. Due limitations of the Java API, this mechanism only supports the 'tls-server-end-point'
|
||||||
* channel binding type. But on the other hand, the other relevant channel binding type 'tls-unique' has some flaws (see
|
* channel binding type. But on the other hand, the other relevant channel binding type 'tls-unique' has some flaws (see
|
||||||
* 3SHAKE, RFC 7627).
|
* 3SHAKE, RFC 7627).
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public abstract class ScramPlusMechanism extends ScramMechanism {
|
public abstract class ScramPlusMechanism extends ScramMechanism {
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class SaslStreamElements {
|
||||||
/**
|
/**
|
||||||
* Construct a new SASL success stream element with optional additional data for the SASL layer.
|
* Construct a new SASL success stream element with optional additional data for the SASL layer.
|
||||||
* (RFC6120 6.3.10)
|
* (RFC6120 6.3.10)
|
||||||
*
|
*
|
||||||
* @param data additional data for the SASL layer or <code>null</code>
|
* @param data additional data for the SASL layer or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public Success(String data) {
|
public Success(String data) {
|
||||||
|
@ -163,7 +163,7 @@ public class SaslStreamElements {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns additional data for the SASL layer or <code>null</code>.
|
* Returns additional data for the SASL layer or <code>null</code>.
|
||||||
*
|
*
|
||||||
* @return additional data or <code>null</code>
|
* @return additional data or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public String getData() {
|
public String getData() {
|
||||||
|
@ -220,7 +220,7 @@ public class SaslStreamElements {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SASL related error condition.
|
* Get the SASL related error condition.
|
||||||
*
|
*
|
||||||
* @return the SASL related error condition.
|
* @return the SASL related error condition.
|
||||||
*/
|
*/
|
||||||
public SASLError getSASLError() {
|
public SASLError getSASLError() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||||
* <p>
|
* <p>
|
||||||
* Based on ArrayBlockingQueue of OpenJDK by Doug Lea (who released ArrayBlockingQueue as public
|
* Based on ArrayBlockingQueue of OpenJDK by Doug Lea (who released ArrayBlockingQueue as public
|
||||||
* domain).
|
* domain).
|
||||||
*
|
*
|
||||||
* @param <E> the type of elements held in this collection
|
* @param <E> the type of elements held in this collection
|
||||||
*/
|
*/
|
||||||
public class ArrayBlockingQueueWithShutdown<E> extends AbstractQueue<E> implements BlockingQueue<E> {
|
public class ArrayBlockingQueueWithShutdown<E> extends AbstractQueue<E> implements BlockingQueue<E> {
|
||||||
|
@ -170,7 +170,7 @@ public class ArrayBlockingQueueWithShutdown<E> extends AbstractQueue<E> implemen
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the queue is currently shut down.
|
* Returns true if the queue is currently shut down.
|
||||||
*
|
*
|
||||||
* @return true if the queue is shut down.
|
* @return true if the queue is shut down.
|
||||||
*/
|
*/
|
||||||
public boolean isShutdown() {
|
public boolean isShutdown() {
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class DNSUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param domain the domain.
|
* @param domain the domain.
|
||||||
* @param domainType the XMPP domain type, server or client.
|
* @param domainType the XMPP domain type, server or client.
|
||||||
* @param failedAddresses a list that will be populated with host addresses that failed to resolve.
|
* @param failedAddresses a list that will be populated with host addresses that failed to resolve.
|
||||||
|
@ -188,7 +188,7 @@ public class DNSUtil {
|
||||||
* Sort a given list of SRVRecords as described in RFC 2782
|
* Sort a given list of SRVRecords as described in RFC 2782
|
||||||
* Note that we follow the RFC with one exception. In a group of the same priority, only the first entry
|
* Note that we follow the RFC with one exception. In a group of the same priority, only the first entry
|
||||||
* is calculated by random. The others are ore simply ordered by their priority.
|
* is calculated by random. The others are ore simply ordered by their priority.
|
||||||
*
|
*
|
||||||
* @param records
|
* @param records
|
||||||
* @return the list of resolved HostAddresses
|
* @return the list of resolved HostAddresses
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -102,7 +102,7 @@ public final class FileUtils {
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return the content of file or null in case of an error
|
* @return the content of file or null in case of an error
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("DefaultCharset")
|
@SuppressWarnings("DefaultCharset")
|
||||||
public static String readFileOrThrow(File file) throws IOException {
|
public static String readFileOrThrow(File file) throws IOException {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* An ObservableReader is a wrapper on a Reader that notifies to its listeners when
|
* An ObservableReader is a wrapper on a Reader that notifies to its listeners when
|
||||||
* reading character streams.
|
* reading character streams.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
public class ObservableReader extends Reader {
|
public class ObservableReader extends Reader {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* An ObservableWriter is a wrapper on a Writer that notifies to its listeners when
|
* An ObservableWriter is a wrapper on a Writer that notifies to its listeners when
|
||||||
* writing to character streams.
|
* writing to character streams.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
public class ObservableWriter extends Writer {
|
public class ObservableWriter extends Writer {
|
||||||
|
|
|
@ -140,12 +140,12 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to parse and return either a Message, IQ or Presence stanza.
|
* Tries to parse and return either a Message, IQ or Presence stanza.
|
||||||
*
|
*
|
||||||
* connection is optional and is used to return feature-not-implemented errors for unknown IQ stanzas.
|
* connection is optional and is used to return feature-not-implemented errors for unknown IQ stanzas.
|
||||||
*
|
*
|
||||||
* @param parser
|
* @param parser
|
||||||
* @return a stanza which is either a Message, IQ or Presence.
|
* @return a stanza which is either a Message, IQ or Presence.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static Stanza parseStanza(XmlPullParser parser) throws Exception {
|
public static Stanza parseStanza(XmlPullParser parser) throws Exception {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
|
@ -170,7 +170,7 @@ public class PacketParserUtils {
|
||||||
* <code>getText()</code> if the parser is on START_TAG or END_TAG. So you must not rely on this
|
* <code>getText()</code> if the parser is on START_TAG or END_TAG. So you must not rely on this
|
||||||
* behavior when using the parser.
|
* behavior when using the parser.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return A suitable XmlPullParser for XMPP parsing
|
* @return A suitable XmlPullParser for XMPP parsing
|
||||||
* @throws XmlPullParserException
|
* @throws XmlPullParserException
|
||||||
*/
|
*/
|
||||||
|
@ -198,7 +198,7 @@ public class PacketParserUtils {
|
||||||
* <code>getText()</code> if the parser is on START_TAG or END_TAG. So you must not rely on this
|
* <code>getText()</code> if the parser is on START_TAG or END_TAG. So you must not rely on this
|
||||||
* behavior when using the parser.
|
* behavior when using the parser.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param reader
|
* @param reader
|
||||||
* @return A suitable XmlPullParser for XMPP parsing
|
* @return A suitable XmlPullParser for XMPP parsing
|
||||||
* @throws XmlPullParserException
|
* @throws XmlPullParserException
|
||||||
|
@ -214,7 +214,7 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @param parser the XML parser, positioned at the start of a message packet.
|
* @param parser the XML parser, positioned at the start of a message packet.
|
||||||
* @return a Message packet.
|
* @return a Message packet.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static Message parseMessage(XmlPullParser parser)
|
public static Message parseMessage(XmlPullParser parser)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -291,7 +291,7 @@ public class PacketParserUtils {
|
||||||
* </p>
|
* </p>
|
||||||
* This method is used for the parts where the XMPP specification requires elements that contain
|
* This method is used for the parts where the XMPP specification requires elements that contain
|
||||||
* only text or are the empty element.
|
* only text or are the empty element.
|
||||||
*
|
*
|
||||||
* @param parser
|
* @param parser
|
||||||
* @return the textual content of the element as String
|
* @return the textual content of the element as String
|
||||||
* @throws XmlPullParserException
|
* @throws XmlPullParserException
|
||||||
|
@ -362,7 +362,7 @@ public class PacketParserUtils {
|
||||||
* closing tag of the same depth is returned as String.
|
* closing tag of the same depth is returned as String.
|
||||||
* </p>
|
* </p>
|
||||||
* Note that only the outermost namespace attributes ("xmlns") will be returned, not nested ones.
|
* Note that only the outermost namespace attributes ("xmlns") will be returned, not nested ones.
|
||||||
*
|
*
|
||||||
* @param parser the XML pull parser
|
* @param parser the XML pull parser
|
||||||
* @return the content of a tag
|
* @return the content of a tag
|
||||||
* @throws XmlPullParserException if parser encounters invalid XML
|
* @throws XmlPullParserException if parser encounters invalid XML
|
||||||
|
@ -399,7 +399,7 @@ public class PacketParserUtils {
|
||||||
* <p>
|
* <p>
|
||||||
* In particular Android's XmlPullParser does not support XML_ROUNDTRIP.
|
* In particular Android's XmlPullParser does not support XML_ROUNDTRIP.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param parser
|
* @param parser
|
||||||
* @param depth
|
* @param depth
|
||||||
* @param fullNamespaces
|
* @param fullNamespaces
|
||||||
|
@ -499,7 +499,7 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @param parser the XML parser, positioned at the start of a presence packet.
|
* @param parser the XML parser, positioned at the start of a presence packet.
|
||||||
* @return a Presence packet.
|
* @return a Presence packet.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static Presence parsePresence(XmlPullParser parser)
|
public static Presence parsePresence(XmlPullParser parser)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -662,8 +662,8 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @param parser the XML parser, positioned at the start of the mechanisms stanza.
|
* @param parser the XML parser, positioned at the start of the mechanisms stanza.
|
||||||
* @return a collection of Stings with the mechanisms included in the mechanisms stanza.
|
* @return a collection of Stings with the mechanisms included in the mechanisms stanza.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws XmlPullParserException
|
* @throws XmlPullParserException
|
||||||
*/
|
*/
|
||||||
public static Collection<String> parseMechanisms(XmlPullParser parser)
|
public static Collection<String> parseMechanisms(XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
|
@ -747,11 +747,11 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses SASL authentication error packets.
|
* Parses SASL authentication error packets.
|
||||||
*
|
*
|
||||||
* @param parser the XML parser.
|
* @param parser the XML parser.
|
||||||
* @return a SASL Failure packet.
|
* @return a SASL Failure packet.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws XmlPullParserException
|
* @throws XmlPullParserException
|
||||||
*/
|
*/
|
||||||
public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException {
|
public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
|
@ -835,7 +835,7 @@ public class PacketParserUtils {
|
||||||
*
|
*
|
||||||
* @param parser the XML parser.
|
* @param parser the XML parser.
|
||||||
* @return an error sub-packet.
|
* @return an error sub-packet.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static StanzaError.Builder parseError(XmlPullParser parser)
|
public static StanzaError.Builder parseError(XmlPullParser parser)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class ParserUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the boolean value of an argument.
|
* Get the boolean value of an argument.
|
||||||
*
|
*
|
||||||
* @param parser
|
* @param parser
|
||||||
* @param name
|
* @param name
|
||||||
* @return the boolean value or null of no argument of the given name exists
|
* @return the boolean value or null of no argument of the given name exists
|
||||||
|
|
|
@ -23,14 +23,14 @@ package org.jivesoftware.smack.util;
|
||||||
*
|
*
|
||||||
* @see ObservableReader#addReaderListener
|
* @see ObservableReader#addReaderListener
|
||||||
* @see ObservableReader#removeReaderListener
|
* @see ObservableReader#removeReaderListener
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
public interface ReaderListener {
|
public interface ReaderListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that the Reader has read a new string.
|
* Notification that the Reader has read a new string.
|
||||||
*
|
*
|
||||||
* @param str the read String
|
* @param str the read String
|
||||||
*/
|
*/
|
||||||
void read(String str);
|
void read(String str);
|
||||||
|
|
|
@ -382,7 +382,7 @@ public class StringUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given CharSequence is empty.
|
* Returns true if the given CharSequence is empty.
|
||||||
*
|
*
|
||||||
* @param cs
|
* @param cs
|
||||||
* @return true if the given CharSequence is empty
|
* @return true if the given CharSequence is empty
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class TLSUtils {
|
||||||
* TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better.
|
* TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better.
|
||||||
* This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
|
* This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param builder the configuration builder to apply this setting to
|
* @param builder the configuration builder to apply this setting to
|
||||||
* @param <B> Type of the ConnectionConfiguration builder.
|
* @param <B> Type of the ConnectionConfiguration builder.
|
||||||
*
|
*
|
||||||
|
@ -78,7 +78,7 @@ public class TLSUtils {
|
||||||
* XMPP Manifesto</a>, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
|
* XMPP Manifesto</a>, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
|
||||||
* TLSv1.1.
|
* TLSv1.1.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param builder the configuration builder to apply this setting to
|
* @param builder the configuration builder to apply this setting to
|
||||||
* @param <B> Type of the ConnectionConfiguration builder.
|
* @param <B> Type of the ConnectionConfiguration builder.
|
||||||
*
|
*
|
||||||
|
@ -96,7 +96,7 @@ public class TLSUtils {
|
||||||
* <b>invalidates all security guarantees provided by TLS</b>. Only use this method if you understand the
|
* <b>invalidates all security guarantees provided by TLS</b>. Only use this method if you understand the
|
||||||
* implications.
|
* implications.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param builder a connection configuration builder.
|
* @param builder a connection configuration builder.
|
||||||
* @param <B> Type of the ConnectionConfiguration builder.
|
* @param <B> Type of the ConnectionConfiguration builder.
|
||||||
* @throws NoSuchAlgorithmException
|
* @throws NoSuchAlgorithmException
|
||||||
|
@ -125,7 +125,7 @@ public class TLSUtils {
|
||||||
* <b>invalidates all security guarantees provided by TLS</b>. Only use this method if you understand the
|
* <b>invalidates all security guarantees provided by TLS</b>. Only use this method if you understand the
|
||||||
* implications.
|
* implications.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param builder a connection configuration builder.
|
* @param builder a connection configuration builder.
|
||||||
* @param <B> Type of the ConnectionConfiguration builder.
|
* @param <B> Type of the ConnectionConfiguration builder.
|
||||||
* @return the given builder.
|
* @return the given builder.
|
||||||
|
|
|
@ -23,14 +23,14 @@ package org.jivesoftware.smack.util;
|
||||||
*
|
*
|
||||||
* @see ObservableWriter#addWriterListener
|
* @see ObservableWriter#addWriterListener
|
||||||
* @see ObservableWriter#removeWriterListener
|
* @see ObservableWriter#removeWriterListener
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
public interface WriterListener {
|
public interface WriterListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that the Writer has written a new string.
|
* Notification that the Writer has written a new string.
|
||||||
*
|
*
|
||||||
* @param str the written string
|
* @param str the written string
|
||||||
*/
|
*/
|
||||||
void write(String str);
|
void write(String str);
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a right angle bracket '>'.
|
* Add a right angle bracket '>'.
|
||||||
*
|
*
|
||||||
* @return a reference to this object.
|
* @return a reference to this object.
|
||||||
*/
|
*/
|
||||||
public XmlStringBuilder rightAngleBracket() {
|
public XmlStringBuilder rightAngleBracket() {
|
||||||
|
@ -557,7 +557,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
if (csq instanceof XmlStringBuilder) {
|
if (csq instanceof XmlStringBuilder) {
|
||||||
((XmlStringBuilder) csq).write(writer, enclosingNamespace);
|
((XmlStringBuilder) csq).write(writer, enclosingNamespace);
|
||||||
}
|
}
|
||||||
else if (csq instanceof XmlNsAttribute) {
|
else if (csq instanceof XmlNsAttribute) {
|
||||||
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
||||||
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
||||||
writer.write(xmlNsAttribute.toString());
|
writer.write(xmlNsAttribute.toString());
|
||||||
|
@ -582,7 +582,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
if (csq instanceof XmlStringBuilder) {
|
if (csq instanceof XmlStringBuilder) {
|
||||||
((XmlStringBuilder) csq).appendXmlTo(res, enclosingNamespace);
|
((XmlStringBuilder) csq).appendXmlTo(res, enclosingNamespace);
|
||||||
}
|
}
|
||||||
else if (csq instanceof XmlNsAttribute) {
|
else if (csq instanceof XmlNsAttribute) {
|
||||||
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
||||||
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
||||||
sb.append(xmlNsAttribute);
|
sb.append(xmlNsAttribute);
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class HostAddress {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new HostAddress with the given FQDN.
|
* Creates a new HostAddress with the given FQDN.
|
||||||
*
|
*
|
||||||
* @param fqdn the optional fully qualified domain name (FQDN).
|
* @param fqdn the optional fully qualified domain name (FQDN).
|
||||||
* @param port The port to connect on.
|
* @param port The port to connect on.
|
||||||
* @param inetAddresses list of addresses.
|
* @param inetAddresses list of addresses.
|
||||||
|
@ -109,7 +109,7 @@ public class HostAddress {
|
||||||
* Retrieve the Exception that caused a connection failure to this HostAddress. Every
|
* Retrieve the Exception that caused a connection failure to this HostAddress. Every
|
||||||
* HostAddress found in {@link ConnectionException} will have an Exception set,
|
* HostAddress found in {@link ConnectionException} will have an Exception set,
|
||||||
* which can be retrieved with this method.
|
* which can be retrieved with this method.
|
||||||
*
|
*
|
||||||
* @return the Exception causing this HostAddress to fail
|
* @return the Exception causing this HostAddress to fail
|
||||||
*/
|
*/
|
||||||
public Map<InetAddress, Exception> getExceptions() {
|
public Map<InetAddress, Exception> getExceptions() {
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.minidns.dnsname.DnsName;
|
||||||
* @see <a href="http://tools.ietf.org/html/rfc2782">RFC 2782: A DNS RR for specifying the location of services (DNS
|
* @see <a href="http://tools.ietf.org/html/rfc2782">RFC 2782: A DNS RR for specifying the location of services (DNS
|
||||||
* SRV)</a>
|
* SRV)</a>
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SRVRecord extends HostAddress implements Comparable<SRVRecord> {
|
public class SRVRecord extends HostAddress implements Comparable<SRVRecord> {
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class SRVRecord extends HostAddress implements Comparable<SRVRecord> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SRV Record constructor.
|
* SRV Record constructor.
|
||||||
*
|
*
|
||||||
* @param fqdn Fully qualified domain name
|
* @param fqdn Fully qualified domain name
|
||||||
* @param port The connection port
|
* @param port The connection port
|
||||||
* @param priority Priority of the target host
|
* @param priority Priority of the target host
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.util.StringUtils;
|
||||||
/**
|
/**
|
||||||
* Base32 string encoding is useful for when filenames case-insensitive filesystems are encoded.
|
* Base32 string encoding is useful for when filenames case-insensitive filesystems are encoded.
|
||||||
* Base32 representation takes roughly 20% more space then Base64.
|
* Base32 representation takes roughly 20% more space then Base64.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
* Based on code by Brian Wellington (bwelling@xbill.org)
|
* Based on code by Brian Wellington (bwelling@xbill.org)
|
||||||
* @see <a href="http://en.wikipedia.org/wiki/Base32">Base32 Wikipedia entry</a>
|
* @see <a href="http://en.wikipedia.org/wiki/Base32">Base32 Wikipedia entry</a>
|
||||||
|
|
|
@ -24,7 +24,7 @@ package org.jivesoftware.smack.util.stringencoder;
|
||||||
public interface StringEncoder {
|
public interface StringEncoder {
|
||||||
/**
|
/**
|
||||||
* Encodes an string to another representation.
|
* Encodes an string to another representation.
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string
|
||||||
* @return the encoded String
|
* @return the encoded String
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,7 @@ public interface StringEncoder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes an string back to it's initial representation.
|
* Decodes an string back to it's initial representation.
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string
|
||||||
* @return the decoded String
|
* @return the decoded String
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -38,16 +38,16 @@ import org.jxmpp.stringprep.XmppStringprepException;
|
||||||
/**
|
/**
|
||||||
* A dummy implementation of {@link XMPPConnection}, intended to be used during
|
* A dummy implementation of {@link XMPPConnection}, intended to be used during
|
||||||
* unit tests.
|
* unit tests.
|
||||||
*
|
*
|
||||||
* Instances store any packets that are delivered to be send using the
|
* Instances store any packets that are delivered to be send using the
|
||||||
* {@link #sendStanza(Stanza)} method in a blocking queue. The content of this queue
|
* {@link #sendStanza(Stanza)} method in a blocking queue. The content of this queue
|
||||||
* can be inspected using {@link #getSentPacket()}. Typically these queues are
|
* can be inspected using {@link #getSentPacket()}. Typically these queues are
|
||||||
* used to retrieve a message that was generated by the client.
|
* used to retrieve a message that was generated by the client.
|
||||||
*
|
*
|
||||||
* Packets that should be processed by the client to simulate a received stanza
|
* Packets that should be processed by the client to simulate a received stanza
|
||||||
* can be delivered using the {@linkplain #processStanza(Stanza)} method.
|
* can be delivered using the {@linkplain #processStanza(Stanza)} method.
|
||||||
* It invokes the registered stanza interceptors and listeners.
|
* It invokes the registered stanza interceptors and listeners.
|
||||||
*
|
*
|
||||||
* @see XMPPConnection
|
* @see XMPPConnection
|
||||||
* @author Guenther Niess
|
* @author Guenther Niess
|
||||||
*/
|
*/
|
||||||
|
@ -130,7 +130,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the number of packets that's sent through {@link #sendStanza(Stanza)} and
|
* Returns the number of packets that's sent through {@link #sendStanza(Stanza)} and
|
||||||
* that has not been returned by {@link #getSentPacket()}.
|
* that has not been returned by {@link #getSentPacket()}.
|
||||||
*
|
*
|
||||||
* @return the number of packets which are in the queue.
|
* @return the number of packets which are in the queue.
|
||||||
*/
|
*/
|
||||||
public int getNumberOfSentPackets() {
|
public int getNumberOfSentPackets() {
|
||||||
|
@ -140,7 +140,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the first stanza that's sent through {@link #sendStanza(Stanza)}
|
* Returns the first stanza that's sent through {@link #sendStanza(Stanza)}
|
||||||
* and that has not been returned by earlier calls to this method.
|
* and that has not been returned by earlier calls to this method.
|
||||||
*
|
*
|
||||||
* @return a sent packet.
|
* @return a sent packet.
|
||||||
*/
|
*/
|
||||||
public <P extends TopLevelStreamElement> P getSentPacket() {
|
public <P extends TopLevelStreamElement> P getSentPacket() {
|
||||||
|
@ -152,7 +152,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
* and that has not been returned by earlier calls to this method. This
|
* and that has not been returned by earlier calls to this method. This
|
||||||
* method will block for up to the specified number of seconds if no packets
|
* method will block for up to the specified number of seconds if no packets
|
||||||
* have been sent yet.
|
* have been sent yet.
|
||||||
*
|
*
|
||||||
* @return a sent packet.
|
* @return a sent packet.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class StanzaCollectorTest {
|
||||||
consumer1.interrupt();
|
consumer1.interrupt();
|
||||||
} catch (InterruptedException e) {
|
} 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.
|
// and main, but the probability is extremely remote.
|
||||||
assertNull(collector.pollResult());
|
assertNull(collector.pollResult());
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ThreadedDummyConnection extends DummyConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calling this method will cause the next sendStanza call with an IQ stanza to timeout.
|
* Calling this method will cause the next sendStanza call with an IQ stanza to timeout.
|
||||||
* This is accomplished by simply stopping the auto creating of the reply stanza
|
* This is accomplished by simply stopping the auto creating of the reply stanza
|
||||||
* or processing one that was entered via {@link #processStanza(Stanza)}.
|
* or processing one that was entered via {@link #processStanza(Stanza)}.
|
||||||
*/
|
*/
|
||||||
public void setTimeout() {
|
public void setTimeout() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.jxmpp.stringprep.XmppStringprepException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that verifies the correct behavior of creating result and error IQ packets.
|
* Tests that verifies the correct behavior of creating result and error IQ packets.
|
||||||
*
|
*
|
||||||
* @see <a href="http://xmpp.org/rfcs/rfc3920.html#stanzas-semantics-iq">IQ Semantics</a>
|
* @see <a href="http://xmpp.org/rfcs/rfc3920.html#stanzas-semantics-iq">IQ Semantics</a>
|
||||||
* @author Guenther Niess
|
* @author Guenther Niess
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ public class IQResponseTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test creating a simple and empty IQ response.
|
* Test creating a simple and empty IQ response.
|
||||||
* @throws XmppStringprepException
|
* @throws XmppStringprepException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGeneratingSimpleResponse() throws XmppStringprepException {
|
public void testGeneratingSimpleResponse() throws XmppStringprepException {
|
||||||
|
@ -58,7 +58,7 @@ public class IQResponseTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test creating a error response based on an IQ request.
|
* Test creating a error response based on an IQ request.
|
||||||
* @throws XmppStringprepException
|
* @throws XmppStringprepException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGeneratingValidErrorResponse() throws XmppStringprepException {
|
public void testGeneratingValidErrorResponse() throws XmppStringprepException {
|
||||||
|
@ -83,7 +83,7 @@ public class IQResponseTest {
|
||||||
/**
|
/**
|
||||||
* According to <a href="http://xmpp.org/rfcs/rfc3920.html#stanzas-semantics-iq"
|
* According to <a href="http://xmpp.org/rfcs/rfc3920.html#stanzas-semantics-iq"
|
||||||
* >RFC3920: IQ Semantics</a> we shouldn't respond to an IQ of type result.
|
* >RFC3920: IQ Semantics</a> we shouldn't respond to an IQ of type result.
|
||||||
* @throws XmppStringprepException
|
* @throws XmppStringprepException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGeneratingResponseBasedOnResult() throws XmppStringprepException {
|
public void testGeneratingResponseBasedOnResult() throws XmppStringprepException {
|
||||||
|
@ -106,7 +106,7 @@ public class IQResponseTest {
|
||||||
/**
|
/**
|
||||||
* According to <a href="http://xmpp.org/rfcs/rfc3920.html#stanzas-semantics-iq"
|
* According to <a href="http://xmpp.org/rfcs/rfc3920.html#stanzas-semantics-iq"
|
||||||
* >RFC3920: IQ Semantics</a> we shouldn't respond to an IQ of type error.
|
* >RFC3920: IQ Semantics</a> we shouldn't respond to an IQ of type error.
|
||||||
* @throws XmppStringprepException
|
* @throws XmppStringprepException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGeneratingErrorBasedOnError() throws XmppStringprepException {
|
public void testGeneratingErrorBasedOnError() throws XmppStringprepException {
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2017 Ingo Bauersachs
|
* Copyright © 2017 Ingo Bauersachs
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.packet;
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
import static org.jivesoftware.smack.packet.StanzaError.Condition;
|
import static org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||||
import static org.jivesoftware.smack.packet.StanzaError.Type;
|
import static org.jivesoftware.smack.packet.StanzaError.Type;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class XMPPErrorTest {
|
public class XMPPErrorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testConditionHasDefaultTypeMapping() throws NoSuchFieldException, IllegalAccessException {
|
public void testConditionHasDefaultTypeMapping() throws NoSuchFieldException, IllegalAccessException {
|
||||||
Map<Condition, Type> conditionToTypeMap = StanzaError.CONDITION_TO_TYPE;
|
Map<Condition, Type> conditionToTypeMap = StanzaError.CONDITION_TO_TYPE;
|
||||||
assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum",
|
assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum",
|
||||||
Condition.values().length,
|
Condition.values().length,
|
||||||
conditionToTypeMap.size());
|
conditionToTypeMap.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ParsingExceptionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void consumeUnparsedInput() throws Exception {
|
public void consumeUnparsedInput() throws Exception {
|
||||||
final String MESSAGE_EXCEPTION_ELEMENT =
|
final String MESSAGE_EXCEPTION_ELEMENT =
|
||||||
"<" + ThrowException.ELEMENT + " xmlns='" + ThrowException.NAMESPACE + "'>" +
|
"<" + ThrowException.ELEMENT + " xmlns='" + ThrowException.NAMESPACE + "'>" +
|
||||||
"<nothingInHere>" +
|
"<nothingInHere>" +
|
||||||
"</nothingInHere>" +
|
"</nothingInHere>" +
|
||||||
|
|
|
@ -671,7 +671,7 @@ public class PacketParserUtilsTest {
|
||||||
/**
|
/**
|
||||||
* RFC6121 5.2.3 explicitly disallows mixed content in <body/> elements. Make sure that we throw
|
* RFC6121 5.2.3 explicitly disallows mixed content in <body/> elements. Make sure that we throw
|
||||||
* an exception if we encounter such an element.
|
* an exception if we encounter such an element.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test(expected = XmlPullParserException.class)
|
@Test(expected = XmlPullParserException.class)
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
|
|
||||||
{
|
{
|
||||||
URL url;
|
URL url;
|
||||||
// Load the image icons
|
// Load the image icons
|
||||||
url =
|
url =
|
||||||
Thread.currentThread().getContextClassLoader().getResource("images/nav_left_blue.png");
|
Thread.currentThread().getContextClassLoader().getResource("images/nav_left_blue.png");
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
|
@ -205,7 +205,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll arrange the UI into six tabs. The first tab contains all data, the second
|
// We'll arrange the UI into six tabs. The first tab contains all data, the second
|
||||||
// client generated XML, the third server generated XML, the fourth allows to send
|
// client generated XML, the third server generated XML, the fourth allows to send
|
||||||
// ad-hoc messages and the fifth contains connection information.
|
// ad-hoc messages and the fifth contains connection information.
|
||||||
tabbedPane = new JTabbedPane();
|
tabbedPane = new JTabbedPane();
|
||||||
|
|
||||||
|
|
|
@ -219,10 +219,10 @@ public final class EnhancedDebuggerWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll arrange the UI into tabs. The last tab contains Smack's information.
|
// We'll arrange the UI into tabs. The last tab contains Smack's information.
|
||||||
// All the connection debugger tabs will be shown before the Smack info tab.
|
// All the connection debugger tabs will be shown before the Smack info tab.
|
||||||
tabbedPane = new JTabbedPane();
|
tabbedPane = new JTabbedPane();
|
||||||
|
|
||||||
// Create the Smack info panel
|
// Create the Smack info panel
|
||||||
JPanel informationPanel = new JPanel();
|
JPanel informationPanel = new JPanel();
|
||||||
informationPanel.setLayout(new BoxLayout(informationPanel, BoxLayout.Y_AXIS));
|
informationPanel.setLayout(new BoxLayout(informationPanel, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@ import org.jivesoftware.smack.util.WriterListener;
|
||||||
import org.jxmpp.jid.EntityFullJid;
|
import org.jxmpp.jid.EntityFullJid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The LiteDebugger is a very simple debugger that allows to debug sent, received and
|
* The LiteDebugger is a very simple debugger that allows to debug sent, received and
|
||||||
* interpreted messages.
|
* interpreted messages.
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @author Gaston Dombiak
|
||||||
*/
|
*/
|
||||||
public class LiteDebugger extends SmackDebugger {
|
public class LiteDebugger extends SmackDebugger {
|
||||||
|
@ -82,7 +82,7 @@ public class LiteDebugger extends SmackDebugger {
|
||||||
frame = new JFrame("Smack Debug Window -- " + connection.getXMPPServiceDomain() + ":" +
|
frame = new JFrame("Smack Debug Window -- " + connection.getXMPPServiceDomain() + ":" +
|
||||||
connection.getPort());
|
connection.getPort());
|
||||||
|
|
||||||
// Add listener for window closing event
|
// Add listener for window closing event
|
||||||
frame.addWindowListener(new WindowAdapter() {
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent evt) {
|
public void windowClosing(WindowEvent evt) {
|
||||||
|
@ -265,10 +265,10 @@ public class LiteDebugger extends SmackDebugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that the root window is closing. Stop listening for received and
|
* Notification that the root window is closing. Stop listening for received and
|
||||||
* transmitted packets.
|
* transmitted packets.
|
||||||
*
|
*
|
||||||
* @param evt the event that indicates that the root window is closing
|
* @param evt the event that indicates that the root window is closing
|
||||||
*/
|
*/
|
||||||
public void rootWindowClosing(WindowEvent evt) {
|
public void rootWindowClosing(WindowEvent evt) {
|
||||||
// TODO: Remove debugger from connection.
|
// TODO: Remove debugger from connection.
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the providers in the experimental code stream.
|
* Initializes the providers in the experimental code stream.
|
||||||
*
|
*
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public class ExperimentalInitializer extends UrlInitializer {
|
public class ExperimentalInitializer extends UrlInitializer {
|
||||||
|
|
|
@ -85,7 +85,7 @@ public final class CarbonManager extends Manager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final StanzaFilter CARBON_EXTENSION_FILTER =
|
private static final StanzaFilter CARBON_EXTENSION_FILTER =
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
new AndFilter(
|
new AndFilter(
|
||||||
new OrFilter(
|
new OrFilter(
|
||||||
|
@ -221,12 +221,12 @@ public final class CarbonManager extends Manager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if XMPP Carbons are supported by the server.
|
* Returns true if XMPP Carbons are supported by the server.
|
||||||
*
|
*
|
||||||
* @return true if supported
|
* @return true if supported
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws XMPPErrorException
|
* @throws XMPPErrorException
|
||||||
* @throws NoResponseException
|
* @throws NoResponseException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public boolean isSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
public boolean isSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
return ServiceDiscoveryManager.getInstanceFor(connection()).serverSupportsFeature(CarbonExtension.NAMESPACE);
|
return ServiceDiscoveryManager.getInstanceFor(connection()).serverSupportsFeature(CarbonExtension.NAMESPACE);
|
||||||
|
@ -239,7 +239,7 @@ public final class CarbonManager extends Manager {
|
||||||
* You should first check for support using isSupportedByServer().
|
* You should first check for support using isSupportedByServer().
|
||||||
*
|
*
|
||||||
* @param new_state whether carbons should be enabled or disabled
|
* @param new_state whether carbons should be enabled or disabled
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @deprecated use {@link #enableCarbonsAsync(ExceptionCallback)} or {@link #disableCarbonsAsync(ExceptionCallback)} instead.
|
* @deprecated use {@link #enableCarbonsAsync(ExceptionCallback)} or {@link #disableCarbonsAsync(ExceptionCallback)} instead.
|
||||||
*/
|
*/
|
||||||
|
@ -256,7 +256,7 @@ public final class CarbonManager extends Manager {
|
||||||
* because of a slow network connection). Thus, if the thread performing this operation is interrupted while the
|
* because of a slow network connection). Thus, if the thread performing this operation is interrupted while the
|
||||||
* queue is full, an {@link InterruptedException} is thrown.
|
* queue is full, an {@link InterruptedException} is thrown.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param exceptionCallback the optional exception callback.
|
* @param exceptionCallback the optional exception callback.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
|
@ -272,7 +272,7 @@ public final class CarbonManager extends Manager {
|
||||||
* because of a slow network connection). Thus, if the thread performing this operation is interrupted while the
|
* because of a slow network connection). Thus, if the thread performing this operation is interrupted while the
|
||||||
* queue is full, an {@link InterruptedException} is thrown.
|
* queue is full, an {@link InterruptedException} is thrown.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param exceptionCallback the optional exception callback.
|
* @param exceptionCallback the optional exception callback.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
|
@ -302,10 +302,10 @@ public final class CarbonManager extends Manager {
|
||||||
* You should first check for support using isSupportedByServer().
|
* You should first check for support using isSupportedByServer().
|
||||||
*
|
*
|
||||||
* @param new_state whether carbons should be enabled or disabled
|
* @param new_state whether carbons should be enabled or disabled
|
||||||
* @throws XMPPErrorException
|
* @throws XMPPErrorException
|
||||||
* @throws NoResponseException
|
* @throws NoResponseException
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public synchronized void setCarbonsEnabled(final boolean new_state) throws NoResponseException,
|
public synchronized void setCarbonsEnabled(final boolean new_state) throws NoResponseException,
|
||||||
|
@ -322,9 +322,9 @@ public final class CarbonManager extends Manager {
|
||||||
/**
|
/**
|
||||||
* Helper method to enable carbons.
|
* Helper method to enable carbons.
|
||||||
*
|
*
|
||||||
* @throws XMPPException
|
* @throws XMPPException
|
||||||
* @throws SmackException if there was no response from the server.
|
* @throws SmackException if there was no response from the server.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public void enableCarbons() throws XMPPException, SmackException, InterruptedException {
|
public void enableCarbons() throws XMPPException, SmackException, InterruptedException {
|
||||||
setCarbonsEnabled(true);
|
setCarbonsEnabled(true);
|
||||||
|
@ -333,9 +333,9 @@ public final class CarbonManager extends Manager {
|
||||||
/**
|
/**
|
||||||
* Helper method to disable carbons.
|
* Helper method to disable carbons.
|
||||||
*
|
*
|
||||||
* @throws XMPPException
|
* @throws XMPPException
|
||||||
* @throws SmackException if there was no response from the server.
|
* @throws SmackException if there was no response from the server.
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public void disableCarbons() throws XMPPException, SmackException, InterruptedException {
|
public void disableCarbons() throws XMPPException, SmackException, InterruptedException {
|
||||||
setCarbonsEnabled(false);
|
setCarbonsEnabled(false);
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.forward.packet.Forwarded;
|
||||||
* Stanza extension for XEP-0280: Message Carbons. The extension
|
* Stanza extension for XEP-0280: Message Carbons. The extension
|
||||||
* <a href="http://xmpp.org/extensions/xep-0280.html">XEP-0280</a> is
|
* <a href="http://xmpp.org/extensions/xep-0280.html">XEP-0280</a> is
|
||||||
* meant to synchronize a message flow to multiple presences of a user.
|
* meant to synchronize a message flow to multiple presences of a user.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* It accomplishes this by wrapping a {@link Forwarded} stanza in a <b>sent</b>
|
* It accomplishes this by wrapping a {@link Forwarded} stanza in a <b>sent</b>
|
||||||
* or <b>received</b> element
|
* or <b>received</b> element
|
||||||
|
@ -41,7 +41,7 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a Carbon message extension.
|
* Construct a Carbon message extension.
|
||||||
*
|
*
|
||||||
* @param dir Determines if the carbon is being sent/received
|
* @param dir Determines if the carbon is being sent/received
|
||||||
* @param fwd The forwarded message.
|
* @param fwd The forwarded message.
|
||||||
*/
|
*/
|
||||||
|
@ -130,7 +130,7 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stanza extension indicating that a message may not be carbon-copied. Adding this
|
* Stanza extension indicating that a message may not be carbon-copied. Adding this
|
||||||
* extension to any message will disallow that message from being copied.
|
* extension to any message will disallow that message from being copied.
|
||||||
*/
|
*/
|
||||||
public static final class Private implements ExtensionElement {
|
public static final class Private implements ExtensionElement {
|
||||||
public static final Private INSTANCE = new Private();
|
public static final Private INSTANCE = new Private();
|
||||||
|
@ -157,7 +157,7 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
/**
|
/**
|
||||||
* Marks a message "private", so that it will not be carbon-copied, by adding private packet
|
* Marks a message "private", so that it will not be carbon-copied, by adding private packet
|
||||||
* extension to the message.
|
* extension to the message.
|
||||||
*
|
*
|
||||||
* @param message the message to add the private extension to
|
* @param message the message to add the private extension to
|
||||||
*/
|
*/
|
||||||
public static void addTo(Message message) {
|
public static void addTo(Message message) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
/**
|
/**
|
||||||
* This class implements the {@link ExtensionElementProvider} to parse
|
* This class implements the {@link ExtensionElementProvider} to parse
|
||||||
* carbon copied messages from a packet. It will return a {@link CarbonExtension} stanza extension.
|
* carbon copied messages from a packet. It will return a {@link CarbonExtension} stanza extension.
|
||||||
*
|
*
|
||||||
* @author Georg Lukas
|
* @author Georg Lukas
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,11 +32,11 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chat Markers Manager class (XEP-0333).
|
* Chat Markers Manager class (XEP-0333).
|
||||||
*
|
*
|
||||||
* @see <a href="http://xmpp.org/extensions/xep-0333.html">XEP-0333: Chat
|
* @see <a href="http://xmpp.org/extensions/xep-0333.html">XEP-0333: Chat
|
||||||
* Markers</a>
|
* Markers</a>
|
||||||
* @author Fernando Ramirez
|
* @author Fernando Ramirez
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class ChatMarkersManager extends Manager {
|
public final class ChatMarkersManager extends Manager {
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public final class ChatMarkersManager extends Manager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the singleton instance of ChatMarkersManager.
|
* Get the singleton instance of ChatMarkersManager.
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection
|
||||||
* @return the instance of ChatMarkersManager
|
* @return the instance of ChatMarkersManager
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +74,7 @@ public final class ChatMarkersManager extends Manager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if Chat Markers is supported by the server.
|
* Returns true if Chat Markers is supported by the server.
|
||||||
*
|
*
|
||||||
* @return true if Chat Markers is supported by the server.
|
* @return true if Chat Markers is supported by the server.
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
* @throws XMPPErrorException
|
* @throws XMPPErrorException
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue