mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 01:29:38 +02:00
Expose InterruptedException
SMACK-632
This commit is contained in:
parent
43b99a2a85
commit
bc61527bd2
124 changed files with 977 additions and 597 deletions
|
@ -64,8 +64,9 @@ public class MultipleRecipientManager {
|
|||
* some XEP-33 specific features were requested.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static void send(XMPPConnection connection, Stanza packet, Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException
|
||||
public static void send(XMPPConnection connection, Stanza packet, Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException, InterruptedException
|
||||
{
|
||||
send(connection, packet, to, cc, bcc, null, null, false);
|
||||
}
|
||||
|
@ -93,9 +94,10 @@ public class MultipleRecipientManager {
|
|||
* @throws FeatureNotSupportedException if special XEP-33 features where requested, but the
|
||||
* server does not support them.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static void send(XMPPConnection connection, Stanza packet, Collection<String> to, Collection<String> cc, Collection<String> bcc,
|
||||
String replyTo, String replyRoom, boolean noReply) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException {
|
||||
String replyTo, String replyRoom, boolean noReply) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException, InterruptedException {
|
||||
// Check if *only* 'to' is set and contains just *one* entry, in this case extended stanzas addressing is not
|
||||
// required at all and we can send it just as normal stanza without needing to add the extension element
|
||||
if (to != null && to.size() == 1 && (cc == null || cc.isEmpty()) && (bcc == null || bcc.isEmpty()) && !noReply
|
||||
|
@ -134,8 +136,9 @@ public class MultipleRecipientManager {
|
|||
* @param reply the new message to send as a reply.
|
||||
* @throws SmackException
|
||||
* @throws XMPPErrorException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static void reply(XMPPConnection connection, Message original, Message reply) throws SmackException, XMPPErrorException
|
||||
public static void reply(XMPPConnection connection, Message original, Message reply) throws SmackException, XMPPErrorException, InterruptedException
|
||||
{
|
||||
MultipleRecipientInfo info = getMultipleRecipientInfo(original);
|
||||
if (info == null) {
|
||||
|
@ -199,7 +202,7 @@ public class MultipleRecipientManager {
|
|||
}
|
||||
|
||||
private static void sendToIndividualRecipients(XMPPConnection connection, Stanza packet,
|
||||
Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NotConnectedException {
|
||||
Collection<String> to, Collection<String> cc, Collection<String> bcc) throws NotConnectedException, InterruptedException {
|
||||
if (to != null) {
|
||||
for (String jid : to) {
|
||||
packet.setTo(jid);
|
||||
|
@ -222,7 +225,7 @@ public class MultipleRecipientManager {
|
|||
|
||||
private static void sendThroughService(XMPPConnection connection, Stanza packet, Collection<String> to,
|
||||
Collection<String> cc, Collection<String> bcc, String replyTo, String replyRoom, boolean noReply,
|
||||
String serviceAddress) throws NotConnectedException {
|
||||
String serviceAddress) throws NotConnectedException, InterruptedException {
|
||||
// Create multiple recipient extension
|
||||
MultipleAddresses multipleAddresses = new MultipleAddresses();
|
||||
if (to != null) {
|
||||
|
@ -273,8 +276,9 @@ public class MultipleRecipientManager {
|
|||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private static String getMultipleRecipienServiceAddress(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private static String getMultipleRecipienServiceAddress(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
List<String> services = sdm.findServices(MultipleAddresses.NAMESPACE, true, true);
|
||||
if (services.size() > 0) {
|
||||
|
|
|
@ -33,8 +33,9 @@ public class AMPDeliverCondition implements AMPExtension.Condition {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return AMPManager.isConditionSupported(connection, NAME);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ public class AMPExpireAtCondition implements AMPExtension.Condition {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return AMPManager.isConditionSupported(connection, NAME);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,9 @@ public class AMPManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
String featureName = AMPExtension.NAMESPACE + "?action=" + action.toString();
|
||||
return isFeatureSupportedByServer(connection, featureName, AMPExtension.NAMESPACE);
|
||||
}
|
||||
|
@ -100,16 +101,17 @@ public class AMPManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @see AMPDeliverCondition
|
||||
* @see AMPExpireAtCondition
|
||||
* @see AMPMatchResourceCondition
|
||||
*/
|
||||
public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
String featureName = AMPExtension.NAMESPACE + "?condition=" + conditionName;
|
||||
return isFeatureSupportedByServer(connection, featureName, AMPExtension.NAMESPACE);
|
||||
}
|
||||
|
||||
private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName, String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(node, featureName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,9 @@ public class AMPMatchResourceCondition implements AMPExtension.Condition {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return AMPManager.isConditionSupported(connection, NAME);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,10 @@ public class BookmarkManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @see BookmarkedConference
|
||||
*/
|
||||
public List<BookmarkedConference> getBookmarkedConferences() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<BookmarkedConference> getBookmarkedConferences() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
retrieveBookmarks();
|
||||
return Collections.unmodifiableList(bookmarks.getBookmarkedConferences());
|
||||
}
|
||||
|
@ -111,9 +112,10 @@ public class BookmarkManager {
|
|||
* the server.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void addBookmarkedConference(String name, String jid, boolean isAutoJoin,
|
||||
String nickname, String password) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
String nickname, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
retrieveBookmarks();
|
||||
BookmarkedConference bookmark
|
||||
|
@ -143,10 +145,11 @@ public class BookmarkManager {
|
|||
* retrieve the bookmarks or persist the bookmarks.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws IllegalArgumentException thrown when the conference being removed is a shared
|
||||
* conference
|
||||
*/
|
||||
public void removeBookmarkedConference(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void removeBookmarkedConference(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
retrieveBookmarks();
|
||||
Iterator<BookmarkedConference> it = bookmarks.getBookmarkedConferences().iterator();
|
||||
while(it.hasNext()) {
|
||||
|
@ -169,8 +172,9 @@ public class BookmarkManager {
|
|||
* @throws XMPPErrorException thrown when there is a problem retriving bookmarks from the server.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<BookmarkedURL> getBookmarkedURLs() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<BookmarkedURL> getBookmarkedURLs() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
retrieveBookmarks();
|
||||
return Collections.unmodifiableList(bookmarks.getBookmarkedURLS());
|
||||
}
|
||||
|
@ -185,8 +189,9 @@ public class BookmarkManager {
|
|||
* the server
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void addBookmarkedURL(String URL, String name, boolean isRSS) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void addBookmarkedURL(String URL, String name, boolean isRSS) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
retrieveBookmarks();
|
||||
BookmarkedURL bookmark = new BookmarkedURL(URL, name, isRSS);
|
||||
List<BookmarkedURL> urls = bookmarks.getBookmarkedURLS();
|
||||
|
@ -212,8 +217,9 @@ public class BookmarkManager {
|
|||
* the server.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
retrieveBookmarks();
|
||||
Iterator<BookmarkedURL> it = bookmarks.getBookmarkedURLS().iterator();
|
||||
while(it.hasNext()) {
|
||||
|
@ -229,7 +235,7 @@ public class BookmarkManager {
|
|||
}
|
||||
}
|
||||
|
||||
private Bookmarks retrieveBookmarks() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private Bookmarks retrieveBookmarks() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
synchronized(bookmarkLock) {
|
||||
if(bookmarks == null) {
|
||||
bookmarks = (Bookmarks) privateDataManager.getPrivateData("storage",
|
||||
|
|
|
@ -62,7 +62,8 @@ public interface BytestreamRequest {
|
|||
/**
|
||||
* Rejects the bytestream request by sending a reject error to the initiator.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void reject() throws NotConnectedException;
|
||||
public void reject() throws NotConnectedException, InterruptedException;
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class CloseListener extends AbstractIqRequestHandler {
|
|||
try {
|
||||
this.manager.replyItemNotFoundPacket(closeRequest);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class CloseListener extends AbstractIqRequestHandler {
|
|||
try {
|
||||
ibbSession.closeByPeer(closeRequest);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
return null;
|
||||
}
|
||||
this.manager.getSessions().remove(closeRequest.getSessionID());
|
||||
|
|
|
@ -56,7 +56,7 @@ class DataListener implements PacketListener {
|
|||
this.manager = manager;
|
||||
}
|
||||
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
Data data = (Data) packet;
|
||||
InBandBytestreamSession ibbSession = this.manager.getSessions().get(
|
||||
data.getDataPacketExtension().getSessionID());
|
||||
|
|
|
@ -399,8 +399,9 @@ public class InBandBytestreamManager implements BytestreamManager {
|
|||
* @throws XMPPException if the user doesn't support or accept in-band bytestreams, or if the
|
||||
* user prefers smaller block sizes
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public InBandBytestreamSession establishSession(String targetJID) throws XMPPException, SmackException {
|
||||
public InBandBytestreamSession establishSession(String targetJID) throws XMPPException, SmackException, InterruptedException {
|
||||
String sessionID = getNextSessionID();
|
||||
return establishSession(targetJID, sessionID);
|
||||
}
|
||||
|
@ -416,9 +417,10 @@ public class InBandBytestreamManager implements BytestreamManager {
|
|||
* user prefers smaller block sizes
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public InBandBytestreamSession establishSession(String targetJID, String sessionID)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Open byteStreamRequest = new Open(sessionID, this.defaultBlockSize, this.stanza);
|
||||
byteStreamRequest.setTo(targetJID);
|
||||
|
||||
|
@ -438,8 +440,9 @@ public class InBandBytestreamManager implements BytestreamManager {
|
|||
*
|
||||
* @param request IQ packet that should be answered with a not-acceptable error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyRejectPacket(IQ request) throws NotConnectedException {
|
||||
protected void replyRejectPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||
XMPPError xmppError = new XMPPError(XMPPError.Condition.not_acceptable);
|
||||
IQ error = IQ.createErrorResponse(request, xmppError);
|
||||
this.connection.sendPacket(error);
|
||||
|
@ -451,8 +454,9 @@ public class InBandBytestreamManager implements BytestreamManager {
|
|||
*
|
||||
* @param request IQ packet that should be answered with a resource-constraint error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException {
|
||||
protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||
XMPPError xmppError = new XMPPError(XMPPError.Condition.resource_constraint);
|
||||
IQ error = IQ.createErrorResponse(request, xmppError);
|
||||
this.connection.sendPacket(error);
|
||||
|
@ -464,8 +468,9 @@ public class InBandBytestreamManager implements BytestreamManager {
|
|||
*
|
||||
* @param request IQ packet that should be answered with a item-not-found error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException {
|
||||
protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||
XMPPError xmppError = new XMPPError(XMPPError.Condition.item_not_found);
|
||||
IQ error = IQ.createErrorResponse(request, xmppError);
|
||||
this.connection.sendPacket(error);
|
||||
|
|
|
@ -68,8 +68,9 @@ public class InBandBytestreamRequest implements BytestreamRequest {
|
|||
*
|
||||
* @return the session to send/receive data
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public InBandBytestreamSession accept() throws NotConnectedException {
|
||||
public InBandBytestreamSession accept() throws NotConnectedException, InterruptedException {
|
||||
XMPPConnection connection = this.manager.getConnection();
|
||||
|
||||
// create In-Band Bytestream session and store it
|
||||
|
@ -88,8 +89,9 @@ public class InBandBytestreamRequest implements BytestreamRequest {
|
|||
* Rejects the In-Band Bytestream request by sending a reject error to the
|
||||
* initiator.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void reject() throws NotConnectedException {
|
||||
public void reject() throws NotConnectedException, InterruptedException {
|
||||
this.manager.replyRejectPacket(this.byteStreamRequest);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,8 +160,9 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
*
|
||||
* @param closeRequest the close request from the remote peer
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void closeByPeer(Close closeRequest) throws NotConnectedException {
|
||||
protected void closeByPeer(Close closeRequest) throws NotConnectedException, InterruptedException {
|
||||
|
||||
/*
|
||||
* close streams without flushing them, because stream is already considered closed on the
|
||||
|
@ -447,7 +448,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
private long lastSequence = -1;
|
||||
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
// get data packet extension
|
||||
DataPacketExtension data = ((Data) packet).getDataPacketExtension();
|
||||
|
||||
|
@ -613,8 +614,9 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
* @param data the data packet
|
||||
* @throws IOException if an I/O error occurred while sending or if the stream is closed
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected abstract void writeToXML(DataPacketExtension data) throws IOException, NotConnectedException;
|
||||
protected abstract void writeToXML(DataPacketExtension data) throws IOException, NotConnectedException, InterruptedException;
|
||||
|
||||
public synchronized void write(int b) throws IOException {
|
||||
if (this.isClosed) {
|
||||
|
@ -718,7 +720,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
try {
|
||||
writeToXML(data);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
IOException ioException = new IOException();
|
||||
ioException.initCause(e);
|
||||
throw ioException;
|
||||
|
@ -803,7 +805,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
private class MessageIBBOutputStream extends IBBOutputStream {
|
||||
|
||||
@Override
|
||||
protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException {
|
||||
protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException, InterruptedException {
|
||||
// create message stanza containing data packet
|
||||
Message message = new Message(remoteJID);
|
||||
message.addExtension(data);
|
||||
|
|
|
@ -69,7 +69,7 @@ class InitiationListener extends AbstractIqRequestHandler {
|
|||
try {
|
||||
processRequest(packet);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
LOGGER.log(Level.WARNING, "proccessRequest", e);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class InitiationListener extends AbstractIqRequestHandler {
|
|||
return null;
|
||||
}
|
||||
|
||||
private void processRequest(Stanza packet) throws NotConnectedException {
|
||||
private void processRequest(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
Open ibbRequest = (Open) packet;
|
||||
|
||||
// validate that block size is within allowed range
|
||||
|
|
|
@ -65,7 +65,7 @@ final class InitiationListener extends AbstractIqRequestHandler {
|
|||
try {
|
||||
processRequest(packet);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
LOGGER.log(Level.WARNING, "process request", e);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ final class InitiationListener extends AbstractIqRequestHandler {
|
|||
return null;
|
||||
}
|
||||
|
||||
private void processRequest(Stanza packet) throws NotConnectedException {
|
||||
private void processRequest(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
Bytestream byteStreamRequest = (Bytestream) packet;
|
||||
|
||||
// ignore request if in ignore list
|
||||
|
|
|
@ -527,8 +527,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private boolean supportsSocks5(String targetJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private boolean supportsSocks5(String targetJID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(targetJID, Bytestream.NAMESPACE);
|
||||
}
|
||||
|
||||
|
@ -540,8 +541,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
|
|||
* @throws XMPPErrorException if there was an error querying the XMPP server for SOCKS5 proxies
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private List<String> determineProxies() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private List<String> determineProxies() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection);
|
||||
|
||||
List<String> proxies = new ArrayList<String>();
|
||||
|
@ -700,8 +702,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
|
|||
*
|
||||
* @param packet Packet that should be answered with a not-acceptable error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyRejectPacket(IQ packet) throws NotConnectedException {
|
||||
protected void replyRejectPacket(IQ packet) throws NotConnectedException, InterruptedException {
|
||||
XMPPError xmppError = new XMPPError(XMPPError.Condition.not_acceptable);
|
||||
IQ errorIQ = IQ.createErrorResponse(packet, xmppError);
|
||||
this.connection.sendPacket(errorIQ);
|
||||
|
|
|
@ -267,8 +267,9 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
/**
|
||||
* Rejects the SOCKS5 Bytestream request by sending a reject error to the initiator.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void reject() throws NotConnectedException {
|
||||
public void reject() throws NotConnectedException, InterruptedException {
|
||||
this.manager.replyRejectPacket(this.bytestreamRequest);
|
||||
}
|
||||
|
||||
|
@ -277,8 +278,9 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
* XMPP exception.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void cancelRequest() throws XMPPErrorException, NotConnectedException {
|
||||
private void cancelRequest() throws XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
String errorMessage = "Could not establish socket with any provided host";
|
||||
XMPPError error = XMPPError.from(XMPPError.Condition.item_not_found, errorMessage);
|
||||
IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
|
||||
|
|
|
@ -104,9 +104,10 @@ class Socks5ClientForInitiator extends Socks5Client {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws SmackException if there was no response from the server.
|
||||
*/
|
||||
private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Bytestream activate = createStreamHostActivation();
|
||||
// if activation fails #nextResultOrThrow() throws an exception
|
||||
connection.createPacketCollectorAndSend(activate).nextResultOrThrow();
|
||||
|
|
|
@ -434,8 +434,9 @@ public class EntityCapsManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean areEntityCapsSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean areEntityCapsSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return sdm.supportsFeature(jid, NAMESPACE);
|
||||
}
|
||||
|
||||
|
@ -446,8 +447,9 @@ public class EntityCapsManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean areEntityCapsSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean areEntityCapsSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return areEntityCapsSupported(connection().getServiceName());
|
||||
}
|
||||
|
||||
|
@ -507,7 +509,7 @@ public class EntityCapsManager extends Manager {
|
|||
try {
|
||||
connection.sendPacket(presence);
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
LOGGER.log(Level.WARNING, "Could could not update presence with caps info", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,8 +102,9 @@ public class ChatStateManager extends Manager {
|
|||
* @param newState the new state of the chat
|
||||
* @param chat the chat.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void setCurrentState(ChatState newState, Chat chat) throws NotConnectedException {
|
||||
public void setCurrentState(ChatState newState, Chat chat) throws NotConnectedException, InterruptedException {
|
||||
if(chat == null || newState == null) {
|
||||
throw new IllegalArgumentException("Arguments cannot be null.");
|
||||
}
|
||||
|
|
|
@ -211,8 +211,9 @@ public abstract class AdHocCommand {
|
|||
*
|
||||
* @throws XMPPErrorException if there is an error executing the command.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract void execute() throws NoResponseException, XMPPErrorException, NotConnectedException;
|
||||
public abstract void execute() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Executes the next action of the command with the information provided in
|
||||
|
@ -224,8 +225,9 @@ public abstract class AdHocCommand {
|
|||
* @param response the form answer of the previous stage.
|
||||
* @throws XMPPErrorException if there is a problem executing the command.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract void next(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException;
|
||||
public abstract void next(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Completes the command execution with the information provided in the
|
||||
|
@ -237,8 +239,9 @@ public abstract class AdHocCommand {
|
|||
* @param response the form answer of the previous stage.
|
||||
* @throws XMPPErrorException if there is a problem executing the command.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract void complete(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException;
|
||||
public abstract void complete(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Goes to the previous stage. The requester is asking to re-send the
|
||||
|
@ -248,8 +251,9 @@ public abstract class AdHocCommand {
|
|||
*
|
||||
* @throws XMPPErrorException if there is a problem executing the command.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract void prev() throws NoResponseException, XMPPErrorException, NotConnectedException;
|
||||
public abstract void prev() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Cancels the execution of the command. This can be invoked on any stage of
|
||||
|
@ -258,8 +262,9 @@ public abstract class AdHocCommand {
|
|||
*
|
||||
* @throws XMPPErrorException if there is a problem executing the command.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException;
|
||||
public abstract void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Returns a collection with the allowed actions based on the current stage.
|
||||
|
|
|
@ -175,7 +175,7 @@ public class AdHocCommandManager extends Manager {
|
|||
try {
|
||||
return processAdHocCommand(requestData);
|
||||
}
|
||||
catch (NoResponseException | NotConnectedException e) {
|
||||
catch (InterruptedException | NoResponseException | NotConnectedException e) {
|
||||
LOGGER.log(Level.INFO, "processAdHocCommand threw exceptino", e);
|
||||
return null;
|
||||
}
|
||||
|
@ -252,8 +252,9 @@ public class AdHocCommandManager extends Manager {
|
|||
* @return the discovered items.
|
||||
* @throws XMPPException if the operation failed for some reason.
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverItems discoverCommands(String jid) throws XMPPException, SmackException {
|
||||
public DiscoverItems discoverCommands(String jid) throws XMPPException, SmackException, InterruptedException {
|
||||
return serviceDiscoveryManager.discoverItems(jid, NAMESPACE);
|
||||
}
|
||||
|
||||
|
@ -263,8 +264,9 @@ public class AdHocCommandManager extends Manager {
|
|||
* @param jid the full JID to publish the commands to.
|
||||
* @throws XMPPException if the operation failed for some reason.
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void publishCommands(String jid) throws XMPPException, SmackException {
|
||||
public void publishCommands(String jid) throws XMPPException, SmackException, InterruptedException {
|
||||
// Collects the commands to publish as items
|
||||
DiscoverItems discoverItems = new DiscoverItems();
|
||||
Collection<AdHocCommandInfo> xCommandsList = getRegisteredCommands();
|
||||
|
@ -318,8 +320,9 @@ public class AdHocCommandManager extends Manager {
|
|||
* the packet to process.
|
||||
* @throws NotConnectedException
|
||||
* @throws NoResponseException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private IQ processAdHocCommand(AdHocCommandData requestData) throws NoResponseException, NotConnectedException {
|
||||
private IQ processAdHocCommand(AdHocCommandData requestData) throws NoResponseException, NotConnectedException, InterruptedException {
|
||||
// Creates the response with the corresponding data
|
||||
AdHocCommandData response = new AdHocCommandData();
|
||||
response.setTo(requestData.getFrom());
|
||||
|
|
|
@ -72,17 +72,17 @@ public class RemoteCommand extends AdHocCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
executeAction(Action.cancel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void complete(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
executeAction(Action.complete, form);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void execute() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
executeAction(Action.execute);
|
||||
}
|
||||
|
||||
|
@ -95,22 +95,23 @@ public class RemoteCommand extends AdHocCommand {
|
|||
* @throws XMPPErrorException if an error occurs.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void execute(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void execute(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
executeAction(Action.execute, form);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void next(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void next(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
executeAction(Action.next, form);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prev() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void prev() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
executeAction(Action.prev);
|
||||
}
|
||||
|
||||
private void executeAction(Action action) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private void executeAction(Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
executeAction(action, null);
|
||||
}
|
||||
|
||||
|
@ -124,8 +125,9 @@ public class RemoteCommand extends AdHocCommand {
|
|||
* @throws XMPPErrorException if there is a problem executing the command.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void executeAction(Action action, Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private void executeAction(Action action, Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// TODO: Check that all the required fields of the form were filled, if
|
||||
// TODO: not throw the corresponding exeption. This will make a faster response,
|
||||
// TODO: since the request is stoped before it's sent.
|
||||
|
|
|
@ -475,8 +475,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverInfo discoverInfo(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public DiscoverInfo discoverInfo(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
if (entityID == null)
|
||||
return discoverInfo(null, null);
|
||||
|
||||
|
@ -520,8 +521,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException if the operation failed for some reason.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverInfo discoverInfo(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public DiscoverInfo discoverInfo(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// Discover the entity's info
|
||||
DiscoverInfo disco = new DiscoverInfo();
|
||||
disco.setType(IQ.Type.get);
|
||||
|
@ -541,8 +543,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException if the operation failed for some reason.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverItems discoverItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public DiscoverItems discoverItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return discoverItems(entityID, null);
|
||||
}
|
||||
|
||||
|
@ -557,8 +560,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException if the operation failed for some reason.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverItems discoverItems(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public DiscoverItems discoverItems(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// Discover the entity's items
|
||||
DiscoverItems disco = new DiscoverItems();
|
||||
disco.setType(IQ.Type.get);
|
||||
|
@ -580,8 +584,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean canPublishItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean canPublishItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
DiscoverInfo info = discoverInfo(entityID);
|
||||
return canPublishItems(info);
|
||||
}
|
||||
|
@ -610,8 +615,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void publishItems(String entityID, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void publishItems(String entityID, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
publishItems(entityID, null, discoverItems);
|
||||
}
|
||||
|
||||
|
@ -627,8 +633,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException if the operation failed for some reason.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void publishItems(String entityID, String node, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void publishItems(String entityID, String node, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
discoverItems.setType(IQ.Type.set);
|
||||
discoverItems.setTo(entityID);
|
||||
|
@ -645,10 +652,11 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @since 4.1
|
||||
*/
|
||||
public boolean serverSupportsFeature(String feature) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
return supportsFeature(connection().getServiceName(), feature);
|
||||
}
|
||||
|
||||
|
@ -661,8 +669,9 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean supportsFeature(String jid, String feature) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean supportsFeature(String jid, String feature) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
DiscoverInfo result = discoverInfo(jid);
|
||||
return result.containsFeature(feature);
|
||||
}
|
||||
|
@ -684,9 +693,10 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<String> findServices(String feature, boolean stopOnFirst, boolean useCache)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
List<String> serviceAddresses = null;
|
||||
String serviceName = connection().getServiceName();
|
||||
if (useCache) {
|
||||
|
|
|
@ -79,7 +79,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
"method");
|
||||
}
|
||||
|
||||
public InputStream createIncomingStream(StreamInitiation initiation) throws SmackException {
|
||||
public InputStream createIncomingStream(StreamInitiation initiation) throws SmackException, InterruptedException {
|
||||
PacketCollector collector = connection.createPacketCollectorAndSend(
|
||||
getInitiationPacketFilter(initiation.getFrom(), initiation.getSessionID()),
|
||||
super.createInitiationAccept(initiation, getNamespaces()));
|
||||
|
@ -144,7 +144,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
}
|
||||
|
||||
public OutputStream createOutgoingStream(String streamID, String initiator, String target)
|
||||
throws SmackException, XMPPException {
|
||||
throws SmackException, XMPPException, InterruptedException {
|
||||
OutputStream stream;
|
||||
try {
|
||||
stream = primaryNegotiator.createOutgoingStream(streamID, initiator, target);
|
||||
|
|
|
@ -163,8 +163,9 @@ public class FileTransferManager extends Manager {
|
|||
* </p>
|
||||
* @param request
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException {
|
||||
protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException, InterruptedException {
|
||||
StreamInitiation initiation = request.getStreamInitiation();
|
||||
|
||||
// Reject as specified in XEP-95 4.2. Note that this is not to be confused with the Socks 5
|
||||
|
|
|
@ -181,9 +181,10 @@ public class FileTransferNegotiator extends Manager {
|
|||
* there is not an appropriate stream method.
|
||||
* @throws NotConnectedException
|
||||
* @throws NoAcceptableTransferMechanisms
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public StreamNegotiator selectStreamNegotiator(
|
||||
FileTransferRequest request) throws NotConnectedException, NoStreamMethodsOfferedException, NoAcceptableTransferMechanisms {
|
||||
FileTransferRequest request) throws NotConnectedException, NoStreamMethodsOfferedException, NoAcceptableTransferMechanisms, InterruptedException {
|
||||
StreamInitiation si = request.getStreamInitiation();
|
||||
FormField streamMethodField = getStreamMethodField(si
|
||||
.getFeatureNegotiationForm());
|
||||
|
@ -299,10 +300,11 @@ public class FileTransferNegotiator extends Manager {
|
|||
* @throws NotConnectedException
|
||||
* @throws NoResponseException
|
||||
* @throws NoAcceptableTransferMechanisms
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public StreamNegotiator negotiateOutgoingTransfer(final String userID,
|
||||
final String streamID, final String fileName, final long size,
|
||||
final String desc, int responseTimeout) throws XMPPErrorException, NotConnectedException, NoResponseException, NoAcceptableTransferMechanisms {
|
||||
final String desc, int responseTimeout) throws XMPPErrorException, NotConnectedException, NoResponseException, NoAcceptableTransferMechanisms, InterruptedException {
|
||||
StreamInitiation si = new StreamInitiation();
|
||||
si.setSessionID(streamID);
|
||||
si.setMimeType(URLConnection.guessContentTypeFromName(fileName));
|
||||
|
|
|
@ -129,8 +129,9 @@ public class FileTransferRequest {
|
|||
/**
|
||||
* Rejects the file transfer request.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void reject() throws NotConnectedException {
|
||||
public void reject() throws NotConnectedException, InterruptedException {
|
||||
manager.rejectIncomingFileTransfer(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,14 +63,14 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
}
|
||||
|
||||
public OutputStream createOutgoingStream(String streamID, String initiator,
|
||||
String target) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
String target) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
InBandBytestreamSession session = this.manager.establishSession(target, streamID);
|
||||
session.setCloseBothStreamsEnabled(true);
|
||||
return session.getOutputStream();
|
||||
}
|
||||
|
||||
public InputStream createIncomingStream(StreamInitiation initiation)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
/*
|
||||
* In-Band Bytestream initiation listener must ignore next in-band bytestream request with
|
||||
* given session ID
|
||||
|
@ -96,7 +96,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
return new String[] { DataPacketExtension.NAMESPACE };
|
||||
}
|
||||
|
||||
InputStream negotiateIncomingStream(Stanza streamInitiation) throws NotConnectedException {
|
||||
InputStream negotiateIncomingStream(Stanza streamInitiation) throws NotConnectedException, InterruptedException {
|
||||
// build In-Band Bytestream request
|
||||
InBandBytestreamRequest request = new ByteStreamRequest(this.manager,
|
||||
(Open) streamInitiation);
|
||||
|
|
|
@ -76,8 +76,9 @@ public class IncomingFileTransfer extends FileTransfer {
|
|||
* @throws SmackException
|
||||
* @throws XMPPErrorException If there is an error in the negotiation process an exception
|
||||
* is thrown.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public InputStream recieveFile() throws SmackException, XMPPErrorException {
|
||||
public InputStream recieveFile() throws SmackException, XMPPErrorException, InterruptedException {
|
||||
if (inputStream != null) {
|
||||
throw new IllegalStateException("Transfer already negotiated!");
|
||||
}
|
||||
|
@ -174,7 +175,7 @@ public class IncomingFileTransfer extends FileTransfer {
|
|||
transferThread.start();
|
||||
}
|
||||
|
||||
private InputStream negotiateStream() throws SmackException, XMPPErrorException {
|
||||
private InputStream negotiateStream() throws SmackException, XMPPErrorException, InterruptedException {
|
||||
setStatus(Status.negotiating_transfer);
|
||||
final StreamNegotiator streamNegotiator = negotiator
|
||||
.selectStreamNegotiator(recieveRequest);
|
||||
|
|
|
@ -120,9 +120,10 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
* Thrown if an error occurs during the file transfer
|
||||
* negotiation process.
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized OutputStream sendFile(String fileName, long fileSize,
|
||||
String description) throws XMPPException, SmackException {
|
||||
String description) throws XMPPException, SmackException, InterruptedException {
|
||||
if (isDone() || outputStream != null) {
|
||||
throw new IllegalStateException(
|
||||
"The negotation process has already"
|
||||
|
@ -373,7 +374,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
}
|
||||
|
||||
private OutputStream negotiateStream(String fileName, long fileSize,
|
||||
String description) throws SmackException, XMPPException {
|
||||
String description) throws SmackException, XMPPException, InterruptedException {
|
||||
// Negotiate the file transfer profile
|
||||
|
||||
if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
|
||||
|
|
|
@ -72,7 +72,7 @@ public abstract class StreamNegotiator {
|
|||
return response;
|
||||
}
|
||||
|
||||
Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
StreamInitiation response = createInitiationAccept(initiation,
|
||||
getNamespaces());
|
||||
|
||||
|
@ -134,9 +134,10 @@ public abstract class StreamNegotiator {
|
|||
* exception will be thrown.
|
||||
* @throws SmackException
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public abstract OutputStream createOutgoingStream(String streamID,
|
||||
String initiator, String target) throws XMPPErrorException, NoResponseException, SmackException, XMPPException;
|
||||
String initiator, String target) throws XMPPErrorException, NoResponseException, SmackException, XMPPException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Returns the XMPP namespace reserved for this particular type of file
|
||||
|
|
|
@ -231,9 +231,10 @@ public class LastActivityManager extends Manager {
|
|||
* thrown if a server error has occured.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public LastActivity getLastActivity(String jid) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
LastActivity activity = new LastActivity(jid);
|
||||
return (LastActivity) connection().createPacketCollectorAndSend(activity).nextResultOrThrow();
|
||||
}
|
||||
|
@ -246,8 +247,9 @@ public class LastActivityManager extends Manager {
|
|||
* @throws NotConnectedException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean isLastActivitySupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean isLastActivitySupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, LastActivity.NAMESPACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,8 +153,9 @@ public class PrivateDataManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
// Create an IQ packet to get the private data.
|
||||
IQ privateDataGet = new PrivateDataIQ(elementName, namespace);
|
||||
|
@ -173,8 +174,9 @@ public class PrivateDataManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void setPrivateData(final PrivateData privateData) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void setPrivateData(final PrivateData privateData) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// Create an IQ packet to set the private data.
|
||||
IQ privateDataSet = new PrivateDataIQ(privateData);
|
||||
|
||||
|
|
|
@ -98,8 +98,9 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean supportsAccountCreation() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean supportsAccountCreation() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// Check if we already know that the server supports creating new accounts
|
||||
if (accountCreationSupported) {
|
||||
return true;
|
||||
|
@ -140,8 +141,9 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Set<String> getAccountAttributes() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public Set<String> getAccountAttributes() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
if (info == null) {
|
||||
getRegistrationInfo();
|
||||
}
|
||||
|
@ -163,8 +165,9 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public String getAccountAttribute(String name) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public String getAccountAttribute(String name) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
if (info == null) {
|
||||
getRegistrationInfo();
|
||||
}
|
||||
|
@ -180,8 +183,9 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public String getAccountInstructions() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public String getAccountInstructions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
if (info == null) {
|
||||
getRegistrationInfo();
|
||||
}
|
||||
|
@ -201,8 +205,9 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void createAccount(String username, String password) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void createAccount(String username, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// Create a map for all the required attributes, but give them blank values.
|
||||
Map<String, String> attributes = new HashMap<String, String>();
|
||||
for (String attributeName : getAccountAttributes()) {
|
||||
|
@ -222,10 +227,11 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException if an error occurs creating the account.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @see #getAccountAttributes()
|
||||
*/
|
||||
public void createAccount(String username, String password, Map<String, String> attributes)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
attributes.put("username", username);
|
||||
attributes.put("password", password);
|
||||
Registration reg = new Registration(attributes);
|
||||
|
@ -243,8 +249,9 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException if an error occurs when changing the password.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("username",XmppStringUtils.parseLocalpart(connection().getUser()));
|
||||
map.put("password",newPassword);
|
||||
|
@ -263,8 +270,9 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException if an error occurs when deleting the account.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Map<String, String> attributes = new HashMap<String, String>();
|
||||
// To delete an account, we add a single attribute, "remove", that is blank.
|
||||
attributes.put("remove", "");
|
||||
|
@ -279,17 +287,18 @@ public class AccountManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
* @throws XMPPException if an error occurs.
|
||||
* @throws SmackException if there was no response from the server.
|
||||
*/
|
||||
private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setTo(connection().getServiceName());
|
||||
info = createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException {
|
||||
private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException, InterruptedException {
|
||||
PacketCollector collector = connection().createPacketCollectorAndSend(new PacketIDFilter(req.getStanzaId()), req);
|
||||
return collector;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class VersionManager extends Manager {
|
|||
}
|
||||
|
||||
public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
|
||||
Version.NAMESPACE);
|
||||
}
|
||||
|
@ -137,9 +137,10 @@ public class VersionManager extends Manager {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Version getVersion(String jid) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
if (!isSupported(jid)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -269,11 +269,12 @@ public class MultiUserChat {
|
|||
* @throws NotConnectedException
|
||||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws InterruptedException
|
||||
* @see <a href="http://xmpp.org/extensions/xep-0045.html#enter">XEP-45 7.2 Entering a Room</a>
|
||||
*/
|
||||
private Presence enter(String nickname, String password, DiscussionHistory history,
|
||||
long timeout) throws NotConnectedException, NoResponseException,
|
||||
XMPPErrorException {
|
||||
XMPPErrorException, InterruptedException {
|
||||
StringUtils.requireNotNullOrEmpty(nickname, "Nickname must not be null or blank.");
|
||||
// We enter a room by sending a presence packet where the "to"
|
||||
// field is in the form "roomName@service/nickname"
|
||||
|
@ -310,7 +311,7 @@ public class MultiUserChat {
|
|||
try {
|
||||
presence = connection.createPacketCollectorAndSend(responseFilter, joinPresence).nextResultOrThrow(timeout);
|
||||
}
|
||||
catch (NoResponseException | XMPPErrorException e) {
|
||||
catch (InterruptedException | NoResponseException | XMPPErrorException e) {
|
||||
// Ensure that all callbacks are removed if there is an exception
|
||||
removeConnectionCallbacks();
|
||||
throw e;
|
||||
|
@ -345,8 +346,9 @@ public class MultiUserChat {
|
|||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws SmackException If the creation failed because of a missing acknowledge from the
|
||||
* server, e.g. because the room already existed.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void create(String nickname) throws NoResponseException, XMPPErrorException, SmackException {
|
||||
public synchronized void create(String nickname) throws NoResponseException, XMPPErrorException, SmackException, InterruptedException {
|
||||
if (joined) {
|
||||
throw new IllegalStateException("Creation failed - User already joined the room.");
|
||||
}
|
||||
|
@ -369,10 +371,11 @@ public class MultiUserChat {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
* @see #createOrJoin(String, String, DiscussionHistory, long)
|
||||
*/
|
||||
public synchronized boolean createOrJoin(String nickname) throws NoResponseException, XMPPErrorException,
|
||||
SmackException {
|
||||
SmackException, InterruptedException {
|
||||
return createOrJoin(nickname, null, null, connection.getPacketReplyTimeout());
|
||||
}
|
||||
|
||||
|
@ -390,9 +393,10 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if the room couldn't be created for some reason (e.g. 405 error if
|
||||
* the user is not allowed to create the room)
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized boolean createOrJoin(String nickname, String password, DiscussionHistory history, long timeout)
|
||||
throws NoResponseException, XMPPErrorException, SmackException {
|
||||
throws NoResponseException, XMPPErrorException, SmackException, InterruptedException {
|
||||
if (joined) {
|
||||
throw new IllegalStateException("Creation failed - User already joined the room.");
|
||||
}
|
||||
|
@ -425,8 +429,9 @@ public class MultiUserChat {
|
|||
* 409 error can occur if someone is already in the group chat with the same nickname.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void join(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void join(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
join(nickname, null, null, connection.getPacketReplyTimeout());
|
||||
}
|
||||
|
||||
|
@ -449,8 +454,9 @@ public class MultiUserChat {
|
|||
* 407 error can occur if user is not on the member list; or a
|
||||
* 409 error can occur if someone is already in the group chat with the same nickname.
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void join(String nickname, String password) throws XMPPErrorException, SmackException {
|
||||
public void join(String nickname, String password) throws XMPPErrorException, SmackException, InterruptedException {
|
||||
join(nickname, password, null, connection.getPacketReplyTimeout());
|
||||
}
|
||||
|
||||
|
@ -480,13 +486,14 @@ public class MultiUserChat {
|
|||
* 409 error can occur if someone is already in the group chat with the same nickname.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void join(
|
||||
String nickname,
|
||||
String password,
|
||||
DiscussionHistory history,
|
||||
long timeout)
|
||||
throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
// If we've already joined the room, leave it before joining under a new
|
||||
// nickname.
|
||||
if (joined) {
|
||||
|
@ -508,8 +515,9 @@ public class MultiUserChat {
|
|||
/**
|
||||
* Leave the chat room.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public synchronized void leave() throws NotConnectedException {
|
||||
public synchronized void leave() throws NotConnectedException, InterruptedException {
|
||||
// If not joined already, do nothing.
|
||||
if (!joined) {
|
||||
return;
|
||||
|
@ -536,8 +544,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs asking the configuration form for the room.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCOwner iq = new MUCOwner();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.get);
|
||||
|
@ -555,8 +564,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs setting the new rooms' configuration.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void sendConfigurationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void sendConfigurationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCOwner iq = new MUCOwner();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.set);
|
||||
|
@ -580,8 +590,9 @@ public class MultiUserChat {
|
|||
* 405 error if the user is not allowed to register with the room.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setType(IQ.Type.get);
|
||||
reg.setTo(room);
|
||||
|
@ -605,8 +616,9 @@ public class MultiUserChat {
|
|||
* or a 503 error can occur if the room does not support registration.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void sendRegistrationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void sendRegistrationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(room);
|
||||
|
@ -628,8 +640,9 @@ public class MultiUserChat {
|
|||
* appropiate error messages to end-users.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void destroy(String reason, String alternateJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void destroy(String reason, String alternateJID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCOwner iq = new MUCOwner();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.set);
|
||||
|
@ -659,8 +672,9 @@ public class MultiUserChat {
|
|||
* @param user the user to invite to the room.(e.g. hecate@shakespeare.lit)
|
||||
* @param reason the reason why the user is being invited.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void invite(String user, String reason) throws NotConnectedException {
|
||||
public void invite(String user, String reason) throws NotConnectedException, InterruptedException {
|
||||
invite(new Message(), user, reason);
|
||||
}
|
||||
|
||||
|
@ -675,8 +689,9 @@ public class MultiUserChat {
|
|||
* @param user the user to invite to the room.(e.g. hecate@shakespeare.lit)
|
||||
* @param reason the reason why the user is being invited.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void invite(Message message, String user, String reason) throws NotConnectedException {
|
||||
public void invite(Message message, String user, String reason) throws NotConnectedException, InterruptedException {
|
||||
// TODO listen for 404 error code when inviter supplies a non-existent JID
|
||||
message.setTo(room);
|
||||
|
||||
|
@ -800,8 +815,9 @@ public class MultiUserChat {
|
|||
*
|
||||
* @return the reserved room nickname or <tt>null</tt> if none.
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public String getReservedNickname() throws SmackException {
|
||||
public String getReservedNickname() throws SmackException, InterruptedException {
|
||||
try {
|
||||
DiscoverInfo result =
|
||||
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(
|
||||
|
@ -840,8 +856,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if the new nickname is already in use by another occupant.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void changeNickname(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void changeNickname(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
StringUtils.requireNotNullOrEmpty(nickname, "Nickname must not be null or blank.");
|
||||
// Check that we already have joined the room before attempting to change the
|
||||
// nickname.
|
||||
|
@ -875,8 +892,9 @@ public class MultiUserChat {
|
|||
* @param status a text message describing the presence update.
|
||||
* @param mode the mode type for the presence update.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException {
|
||||
public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException, InterruptedException {
|
||||
StringUtils.requireNotNullOrEmpty(nickname, "Nickname must not be null or blank.");
|
||||
// Check that we already have joined the room before attempting to change the
|
||||
// availability status.
|
||||
|
@ -914,8 +932,9 @@ public class MultiUserChat {
|
|||
* 400 error can occur if the provided nickname is not present in the room.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void kickParticipant(String nickname, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void kickParticipant(String nickname, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nickname, MUCRole.none, reason);
|
||||
}
|
||||
|
||||
|
@ -923,11 +942,12 @@ public class MultiUserChat {
|
|||
* Sends a voice request to the MUC. The room moderators usually need to approve this request.
|
||||
*
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @see <a href="http://xmpp.org/extensions/xep-0045.html#requestvoice">XEP-45 § 7.13 Requesting
|
||||
* Voice</a>
|
||||
* @since 4.1
|
||||
*/
|
||||
public void requestVoice() throws NotConnectedException {
|
||||
public void requestVoice() throws NotConnectedException, InterruptedException {
|
||||
DataForm form = new DataForm(DataForm.Type.submit);
|
||||
FormField formTypeField = new FormField(FormField.FORM_TYPE);
|
||||
formTypeField.addValue(MUCInitialPresence.NAMESPACE + "#request");
|
||||
|
@ -954,8 +974,9 @@ public class MultiUserChat {
|
|||
* 400 error can occur if the provided nickname is not present in the room.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantVoice(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantVoice(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nicknames, MUCRole.participant);
|
||||
}
|
||||
|
||||
|
@ -971,8 +992,9 @@ public class MultiUserChat {
|
|||
* 400 error can occur if the provided nickname is not present in the room.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nickname, MUCRole.participant, null);
|
||||
}
|
||||
|
||||
|
@ -988,8 +1010,9 @@ public class MultiUserChat {
|
|||
* 400 error can occur if the provided nickname is not present in the room.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeVoice(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeVoice(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nicknames, MUCRole.visitor);
|
||||
}
|
||||
|
||||
|
@ -1005,8 +1028,9 @@ public class MultiUserChat {
|
|||
* 400 error can occur if the provided nickname is not present in the room.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nickname, MUCRole.visitor, null);
|
||||
}
|
||||
|
||||
|
@ -1023,8 +1047,9 @@ public class MultiUserChat {
|
|||
* was tried to be banned (i.e. Not Allowed error).
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void banUsers(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void banUsers(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jids, MUCAffiliation.outcast);
|
||||
}
|
||||
|
||||
|
@ -1042,8 +1067,9 @@ public class MultiUserChat {
|
|||
* was tried to be banned (i.e. Not Allowed error).
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void banUser(String jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void banUser(String jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, MUCAffiliation.outcast, reason);
|
||||
}
|
||||
|
||||
|
@ -1056,8 +1082,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting membership to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantMembership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantMembership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jids, MUCAffiliation.member);
|
||||
}
|
||||
|
||||
|
@ -1070,8 +1097,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting membership to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, MUCAffiliation.member, null);
|
||||
}
|
||||
|
||||
|
@ -1085,8 +1113,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking membership to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeMembership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeMembership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jids, MUCAffiliation.none);
|
||||
}
|
||||
|
||||
|
@ -1100,8 +1129,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking membership to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, MUCAffiliation.none, null);
|
||||
}
|
||||
|
||||
|
@ -1114,8 +1144,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting moderator privileges to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantModerator(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantModerator(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nicknames, MUCRole.moderator);
|
||||
}
|
||||
|
||||
|
@ -1128,8 +1159,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting moderator privileges to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nickname, MUCRole.moderator, null);
|
||||
}
|
||||
|
||||
|
@ -1143,8 +1175,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking moderator privileges from a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeModerator(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeModerator(Collection<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nicknames, MUCRole.participant);
|
||||
}
|
||||
|
||||
|
@ -1158,8 +1191,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking moderator privileges from a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeRole(nickname, MUCRole.participant, null);
|
||||
}
|
||||
|
||||
|
@ -1173,8 +1207,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting ownership privileges to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantOwnership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantOwnership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jids, MUCAffiliation.owner);
|
||||
}
|
||||
|
||||
|
@ -1188,8 +1223,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting ownership privileges to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, MUCAffiliation.owner, null);
|
||||
}
|
||||
|
||||
|
@ -1202,8 +1238,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking ownership privileges from a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeOwnership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeOwnership(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jids, MUCAffiliation.admin);
|
||||
}
|
||||
|
||||
|
@ -1216,8 +1253,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking ownership privileges from a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, MUCAffiliation.admin, null);
|
||||
}
|
||||
|
||||
|
@ -1230,8 +1268,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting administrator privileges to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantAdmin(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantAdmin(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jids, MUCAffiliation.admin);
|
||||
}
|
||||
|
||||
|
@ -1245,8 +1284,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs granting administrator privileges to a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void grantAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void grantAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, MUCAffiliation.admin);
|
||||
}
|
||||
|
||||
|
@ -1259,8 +1299,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking administrator privileges from a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeAdmin(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeAdmin(Collection<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jids, MUCAffiliation.admin);
|
||||
}
|
||||
|
||||
|
@ -1274,8 +1315,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if an error occurs revoking administrator privileges from a user.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void revokeAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
|
||||
public void revokeAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, MUCAffiliation.member);
|
||||
}
|
||||
|
||||
|
@ -1287,10 +1329,11 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void changeAffiliationByAdmin(String jid, MUCAffiliation affiliation)
|
||||
throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
changeAffiliationByAdmin(jid, affiliation, null);
|
||||
}
|
||||
|
||||
|
@ -1303,8 +1346,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void changeAffiliationByAdmin(String jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
private void changeAffiliationByAdmin(String jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
MUCAdmin iq = new MUCAdmin();
|
||||
iq.setTo(room);
|
||||
|
@ -1317,7 +1361,7 @@ public class MultiUserChat {
|
|||
}
|
||||
|
||||
private void changeAffiliationByAdmin(Collection<String> jids, MUCAffiliation affiliation)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCAdmin iq = new MUCAdmin();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.set);
|
||||
|
@ -1330,7 +1374,7 @@ public class MultiUserChat {
|
|||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private void changeRole(String nickname, MUCRole role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private void changeRole(String nickname, MUCRole role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCAdmin iq = new MUCAdmin();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.set);
|
||||
|
@ -1341,7 +1385,7 @@ public class MultiUserChat {
|
|||
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
|
||||
}
|
||||
|
||||
private void changeRole(Collection<String> nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private void changeRole(Collection<String> nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCAdmin iq = new MUCAdmin();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.set);
|
||||
|
@ -1445,8 +1489,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if you don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Affiliate> getOwners() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Affiliate> getOwners() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getAffiliatesByAdmin(MUCAffiliation.owner);
|
||||
}
|
||||
|
||||
|
@ -1457,8 +1502,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if you don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Affiliate> getAdmins() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Affiliate> getAdmins() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getAffiliatesByAdmin(MUCAffiliation.admin);
|
||||
}
|
||||
|
||||
|
@ -1469,8 +1515,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if you don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Affiliate> getMembers() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Affiliate> getMembers() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getAffiliatesByAdmin(MUCAffiliation.member);
|
||||
}
|
||||
|
||||
|
@ -1481,8 +1528,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if you don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Affiliate> getOutcasts() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Affiliate> getOutcasts() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getAffiliatesByAdmin(MUCAffiliation.outcast);
|
||||
}
|
||||
|
||||
|
@ -1495,8 +1543,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if you don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private List<Affiliate> getAffiliatesByAdmin(MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private List<Affiliate> getAffiliatesByAdmin(MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCAdmin iq = new MUCAdmin();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.get);
|
||||
|
@ -1521,8 +1570,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if you don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Occupant> getModerators() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Occupant> getModerators() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getOccupants(MUCRole.moderator);
|
||||
}
|
||||
|
||||
|
@ -1533,8 +1583,9 @@ public class MultiUserChat {
|
|||
* @throws XMPPErrorException if you don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Occupant> getParticipants() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Occupant> getParticipants() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getOccupants(MUCRole.participant);
|
||||
}
|
||||
|
||||
|
@ -1547,8 +1598,9 @@ public class MultiUserChat {
|
|||
* don't have enough privileges to get this information.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private List<Occupant> getOccupants(MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private List<Occupant> getOccupants(MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCAdmin iq = new MUCAdmin();
|
||||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.get);
|
||||
|
@ -1571,8 +1623,9 @@ public class MultiUserChat {
|
|||
* @param text the text of the message to send.
|
||||
* @throws XMPPException if sending the message fails.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void sendMessage(String text) throws XMPPException, NotConnectedException {
|
||||
public void sendMessage(String text) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
Message message = createMessage();
|
||||
message.setBody(text);
|
||||
connection.sendPacket(message);
|
||||
|
@ -1608,8 +1661,9 @@ public class MultiUserChat {
|
|||
* @param message the message.
|
||||
* @throws XMPPException if sending the message fails.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void sendMessage(Message message) throws XMPPException, NotConnectedException {
|
||||
public void sendMessage(Message message) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
message.setTo(room);
|
||||
message.setType(Message.Type.groupchat);
|
||||
connection.sendPacket(message);
|
||||
|
@ -1640,8 +1694,9 @@ public class MultiUserChat {
|
|||
*
|
||||
* @return the next message.
|
||||
* @throws MUCNotJoinedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Message nextMessage() throws MUCNotJoinedException {
|
||||
public Message nextMessage() throws MUCNotJoinedException, InterruptedException {
|
||||
if (messageCollector == null) {
|
||||
throw new MUCNotJoinedException(this);
|
||||
}
|
||||
|
@ -1657,8 +1712,9 @@ public class MultiUserChat {
|
|||
* @return the next message, or <tt>null</tt> if the timeout elapses without a
|
||||
* message becoming available.
|
||||
* @throws MUCNotJoinedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Message nextMessage(long timeout) throws MUCNotJoinedException {
|
||||
public Message nextMessage(long timeout) throws MUCNotJoinedException, InterruptedException {
|
||||
if (messageCollector == null) {
|
||||
throw new MUCNotJoinedException(this);
|
||||
}
|
||||
|
@ -1702,8 +1758,9 @@ public class MultiUserChat {
|
|||
* room subject will throw an error with code 403 (i.e. Forbidden)
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void changeSubject(final String subject) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void changeSubject(final String subject) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Message message = createMessage();
|
||||
message.setSubject(subject);
|
||||
// Wait for an error or confirmation message back from the server.
|
||||
|
|
|
@ -174,8 +174,9 @@ public class MultiUserChatManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean isServiceEnabled(String user) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean isServiceEnabled(String user) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(user, MUCInitialPresence.NAMESPACE);
|
||||
}
|
||||
|
||||
|
@ -198,9 +199,10 @@ public class MultiUserChatManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<String> getJoinedRooms(String user) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
// Send the disco packet to the user
|
||||
DiscoverItems result = ServiceDiscoveryManager.getInstanceFor(connection()).discoverItems(user, DISCO_NODE);
|
||||
List<DiscoverItems.Item> items = result.getItems();
|
||||
|
@ -221,8 +223,9 @@ public class MultiUserChatManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public RoomInfo getRoomInfo(String room) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public RoomInfo getRoomInfo(String room) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection()).discoverInfo(room);
|
||||
return new RoomInfo(info);
|
||||
}
|
||||
|
@ -234,8 +237,9 @@ public class MultiUserChatManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<String> getServiceNames() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<String> getServiceNames() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
|
||||
return sdm.findServices(MUCInitialPresence.NAMESPACE, false, false);
|
||||
}
|
||||
|
@ -250,9 +254,10 @@ public class MultiUserChatManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<HostedRoom> getHostedRooms(String serviceName) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection());
|
||||
DiscoverItems discoverItems = discoManager.discoverItems(serviceName);
|
||||
List<DiscoverItems.Item> items = discoverItems.getItems();
|
||||
|
@ -271,8 +276,9 @@ public class MultiUserChatManager extends Manager {
|
|||
* @param inviter the inviter of the declined invitation.
|
||||
* @param reason the reason why the invitee is declining the invitation.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void decline(String room, String inviter, String reason) throws NotConnectedException {
|
||||
public void decline(String room, String inviter, String reason) throws NotConnectedException, InterruptedException {
|
||||
Message message = new Message(room);
|
||||
|
||||
// Create the MUCUser packet that will include the rejection
|
||||
|
|
|
@ -76,8 +76,9 @@ public class OfflineMessageManager {
|
|||
* @throws XMPPErrorException If the user is not allowed to make this request.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean supportsFlexibleRetrieval() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean supportsFlexibleRetrieval() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection).serverSupportsFeature(namespace);
|
||||
}
|
||||
|
||||
|
@ -89,8 +90,9 @@ public class OfflineMessageManager {
|
|||
* not support offline message retrieval.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public int getMessageCount() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public int getMessageCount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(null,
|
||||
namespace);
|
||||
Form extendedInfo = Form.getFormFrom(info);
|
||||
|
@ -112,8 +114,9 @@ public class OfflineMessageManager {
|
|||
* not support offline message retrieval.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
List<OfflineMessageHeader> answer = new ArrayList<OfflineMessageHeader>();
|
||||
DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
|
||||
null, namespace);
|
||||
|
@ -136,8 +139,9 @@ public class OfflineMessageManager {
|
|||
* not support offline message retrieval.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
List<Message> messages = new ArrayList<Message>();
|
||||
OfflineMessageRequest request = new OfflineMessageRequest();
|
||||
for (String node : nodes) {
|
||||
|
@ -180,8 +184,9 @@ public class OfflineMessageManager {
|
|||
* not support offline message retrieval.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Message> getMessages() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<Message> getMessages() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
OfflineMessageRequest request = new OfflineMessageRequest();
|
||||
request.setFetch(true);
|
||||
|
||||
|
@ -219,8 +224,9 @@ public class OfflineMessageManager {
|
|||
* not support offline message retrieval.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deleteMessages(List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void deleteMessages(List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
OfflineMessageRequest request = new OfflineMessageRequest();
|
||||
for (String node : nodes) {
|
||||
OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node);
|
||||
|
@ -237,8 +243,9 @@ public class OfflineMessageManager {
|
|||
* not support offline message retrieval.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deleteMessages() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void deleteMessages() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
OfflineMessageRequest request = new OfflineMessageRequest();
|
||||
request.setPurge(true);
|
||||
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
|
|
|
@ -107,8 +107,9 @@ public class PEPManager {
|
|||
*
|
||||
* @param item the item to publish.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void publish(PEPItem item) throws NotConnectedException {
|
||||
public void publish(PEPItem item) throws NotConnectedException, InterruptedException {
|
||||
// Create a new message to publish the event.
|
||||
PEPPubSub pubSub = new PEPPubSub(item);
|
||||
pubSub.setType(Type.set);
|
||||
|
|
|
@ -155,8 +155,9 @@ public class PingManager extends Manager {
|
|||
* @return true if a reply was received from the entity, false otherwise.
|
||||
* @throws NoResponseException if there was no response from the jid.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean ping(String jid, long pingTimeout) throws NotConnectedException, NoResponseException {
|
||||
public boolean ping(String jid, long pingTimeout) throws NotConnectedException, NoResponseException, InterruptedException {
|
||||
final XMPPConnection connection = connection();
|
||||
// Packet collector for IQs needs an connection that was at least authenticated once,
|
||||
// otherwise the client JID will be null causing an NPE
|
||||
|
@ -181,8 +182,9 @@ public class PingManager extends Manager {
|
|||
* @return true if a reply was received from the entity, false otherwise.
|
||||
* @throws NotConnectedException
|
||||
* @throws NoResponseException if there was no response from the jid.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean ping(String jid) throws NotConnectedException, NoResponseException {
|
||||
public boolean ping(String jid) throws NotConnectedException, NoResponseException, InterruptedException {
|
||||
return ping(jid, connection().getPacketReplyTimeout());
|
||||
}
|
||||
|
||||
|
@ -194,8 +196,9 @@ public class PingManager extends Manager {
|
|||
* @throws XMPPErrorException An XMPP related error occurred during the request
|
||||
* @throws NoResponseException if there was no response from the jid.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean isPingSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean isPingSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, Ping.NAMESPACE);
|
||||
}
|
||||
|
||||
|
@ -208,8 +211,9 @@ public class PingManager extends Manager {
|
|||
*
|
||||
* @return true if a reply was received from the server, false otherwise.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean pingMyServer() throws NotConnectedException {
|
||||
public boolean pingMyServer() throws NotConnectedException, InterruptedException {
|
||||
return pingMyServer(true);
|
||||
}
|
||||
|
||||
|
@ -223,8 +227,9 @@ public class PingManager extends Manager {
|
|||
* @param notifyListeners Notify the PingFailedListener in case of error if true
|
||||
* @return true if the user's server could be pinged.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean pingMyServer(boolean notifyListeners) throws NotConnectedException {
|
||||
public boolean pingMyServer(boolean notifyListeners) throws NotConnectedException, InterruptedException {
|
||||
return pingMyServer(notifyListeners, connection().getPacketReplyTimeout());
|
||||
}
|
||||
|
||||
|
@ -239,8 +244,9 @@ public class PingManager extends Manager {
|
|||
* @param pingTimeout The time to wait for a reply in milliseconds
|
||||
* @return true if the user's server could be pinged.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean pingMyServer(boolean notifyListeners, long pingTimeout) throws NotConnectedException {
|
||||
public boolean pingMyServer(boolean notifyListeners, long pingTimeout) throws NotConnectedException, InterruptedException {
|
||||
boolean res;
|
||||
try {
|
||||
res = ping(connection().getServiceName(), pingTimeout);
|
||||
|
@ -369,8 +375,8 @@ public class PingManager extends Manager {
|
|||
try {
|
||||
res = pingMyServer(false);
|
||||
}
|
||||
catch (SmackException e) {
|
||||
LOGGER.log(Level.WARNING, "SmackError while pinging server", e);
|
||||
catch (InterruptedException | SmackException e) {
|
||||
LOGGER.log(Level.WARNING, "Exception while pinging server", e);
|
||||
res = false;
|
||||
}
|
||||
// stop when we receive a pong back
|
||||
|
|
|
@ -224,8 +224,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private Privacy getRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private Privacy getRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request is a get iq type
|
||||
requestPrivacy.setType(Privacy.Type.get);
|
||||
|
||||
|
@ -242,8 +243,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private Stanza setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private Stanza setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request is a get iq type
|
||||
requestPrivacy.setType(Privacy.Type.set);
|
||||
|
||||
|
@ -257,8 +259,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private Privacy getPrivacyWithListNames() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private Privacy getPrivacyWithListNames() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request of the list is an empty privacy message
|
||||
Privacy request = new Privacy();
|
||||
|
||||
|
@ -273,8 +276,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Privacy privacyAnswer = this.getPrivacyWithListNames();
|
||||
String listName = privacyAnswer.getActiveName();
|
||||
boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getDefaultName());
|
||||
|
@ -288,9 +292,10 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @since 4.1
|
||||
*/
|
||||
public String getActiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public String getActiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
if (cachedActiveListName != null) {
|
||||
return cachedActiveListName;
|
||||
}
|
||||
|
@ -304,8 +309,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public PrivacyList getDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public PrivacyList getDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Privacy privacyAnswer = this.getPrivacyWithListNames();
|
||||
String listName = privacyAnswer.getDefaultName();
|
||||
boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getActiveName());
|
||||
|
@ -319,9 +325,10 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @since 4.1
|
||||
*/
|
||||
public String getDefaultListName() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public String getDefaultListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
if (cachedDefaultListName != null) {
|
||||
return cachedDefaultListName;
|
||||
}
|
||||
|
@ -339,9 +346,10 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @since 4.1
|
||||
*/
|
||||
public String getEffectiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public String getEffectiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
String activeListName = getActiveListName();
|
||||
if (activeListName != null) {
|
||||
return activeListName;
|
||||
|
@ -357,8 +365,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private List<PrivacyItem> getPrivacyListItems(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
private List<PrivacyItem> getPrivacyListItems(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request of the list is an privacy message with an empty list
|
||||
Privacy request = new Privacy();
|
||||
request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
|
||||
|
@ -377,8 +386,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public PrivacyList getPrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public PrivacyList getPrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return new PrivacyList(false, false, listName, getPrivacyListItems(listName));
|
||||
}
|
||||
|
||||
|
@ -389,8 +399,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<PrivacyList> getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<PrivacyList> getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Privacy privacyAnswer = getPrivacyWithListNames();
|
||||
Set<String> names = privacyAnswer.getPrivacyListNames();
|
||||
List<PrivacyList> lists = new ArrayList<>(names.size());
|
||||
|
@ -410,8 +421,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void setActiveListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void setActiveListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request of the list is an privacy message with an empty list
|
||||
Privacy request = new Privacy();
|
||||
request.setActiveName(listName);
|
||||
|
@ -425,8 +437,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void declineActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void declineActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request of the list is an privacy message with an empty list
|
||||
Privacy request = new Privacy();
|
||||
request.setDeclineActiveList(true);
|
||||
|
@ -442,8 +455,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void setDefaultListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void setDefaultListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request of the list is an privacy message with an empty list
|
||||
Privacy request = new Privacy();
|
||||
request.setDefaultName(listName);
|
||||
|
@ -457,8 +471,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request of the list is an privacy message with an empty list
|
||||
Privacy request = new Privacy();
|
||||
request.setDeclineDefaultList(true);
|
||||
|
@ -475,8 +490,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
updatePrivacyList(listName, privacyItems);
|
||||
}
|
||||
|
||||
|
@ -490,8 +506,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// Build the privacy package to add or update the new list
|
||||
Privacy request = new Privacy();
|
||||
request.setPrivacyList(listName, privacyItems);
|
||||
|
@ -507,8 +524,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deletePrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void deletePrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// The request of the list is an privacy message with an empty list
|
||||
Privacy request = new Privacy();
|
||||
request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
|
||||
|
@ -545,8 +563,9 @@ public class PrivacyListManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException{
|
||||
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException{
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).serverSupportsFeature(NAMESPACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverItems discoverItems() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public DiscoverItems discoverItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
DiscoverItems items = new DiscoverItems();
|
||||
items.setTo(to);
|
||||
|
@ -68,8 +69,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
return getItems((List<PacketExtension>) null, (List<PacketExtension>) null);
|
||||
}
|
||||
|
@ -85,8 +87,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId));
|
||||
return getItems(request);
|
||||
|
@ -105,8 +108,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public <T extends Item> List<T> getItems(Collection<String> ids) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Item> List<T> getItems(Collection<String> ids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
List<Item> itemList = new ArrayList<Item>(ids.size());
|
||||
|
||||
|
@ -127,8 +131,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public <T extends Item> List<T> getItems(int maxItems) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Item> List<T> getItems(int maxItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), maxItems));
|
||||
return getItems(request);
|
||||
|
@ -146,8 +151,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public <T extends Item> List<T> getItems(int maxItems, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Item> List<T> getItems(int maxItems, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId, maxItems));
|
||||
return getItems(request);
|
||||
|
@ -168,24 +174,25 @@ public class LeafNode extends Node
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public <T extends Item> List<T> getItems(List<PacketExtension> additionalExtensions,
|
||||
List<PacketExtension> returnedExtensions) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException {
|
||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId()));
|
||||
request.addExtensions(additionalExtensions);
|
||||
return getItems(request, returnedExtensions);
|
||||
}
|
||||
|
||||
private <T extends Item> List<T> getItems(PubSub request) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException {
|
||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getItems(request, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends Item> List<T> getItems(PubSub request,
|
||||
List<PacketExtension> returnedExtensions) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException {
|
||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub result = con.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
|
||||
if (returnedExtensions != null) {
|
||||
|
@ -206,8 +213,9 @@ public class LeafNode extends Node
|
|||
*
|
||||
* For synchronous calls use {@link #send() send()}.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void publish() throws NotConnectedException
|
||||
public void publish() throws NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
|
||||
|
||||
|
@ -229,9 +237,10 @@ public class LeafNode extends Node
|
|||
*
|
||||
* @param item - The item being sent
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Item> void publish(T item) throws NotConnectedException
|
||||
public <T extends Item> void publish(T item) throws NotConnectedException, InterruptedException
|
||||
{
|
||||
Collection<T> items = new ArrayList<T>(1);
|
||||
items.add((T)(item == null ? new Item() : item));
|
||||
|
@ -251,8 +260,9 @@ public class LeafNode extends Node
|
|||
*
|
||||
* @param items - The collection of items being sent
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public <T extends Item> void publish(Collection<T> items) throws NotConnectedException
|
||||
public <T extends Item> void publish(Collection<T> items) throws NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(getId(), items));
|
||||
|
||||
|
@ -273,9 +283,10 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
*/
|
||||
public void send() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void send() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
|
||||
|
||||
|
@ -303,10 +314,11 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Item> void send(T item) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Item> void send(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
Collection<T> items = new ArrayList<T>(1);
|
||||
items.add((item == null ? (T)new Item() : item));
|
||||
|
@ -328,9 +340,10 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
*/
|
||||
public <T extends Item> void send(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Item> void send(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(getId(), items));
|
||||
|
||||
|
@ -345,8 +358,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()), PubSubElementType.PURGE_OWNER.getNamespace());
|
||||
|
||||
|
@ -360,8 +374,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
Collection<String> items = new ArrayList<String>(1);
|
||||
items.add(itemId);
|
||||
|
@ -375,8 +390,9 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
List<Item> items = new ArrayList<Item>(itemIds.size());
|
||||
|
||||
|
|
|
@ -95,8 +95,9 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public ConfigureForm getNodeConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public ConfigureForm getNodeConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(
|
||||
PubSubElementType.CONFIGURE_OWNER, getId()), PubSubNamespace.OWNER);
|
||||
|
@ -111,8 +112,9 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void sendConfigurationForm(Form submitForm) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void sendConfigurationForm(Form submitForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER,
|
||||
getId(), submitForm), PubSubNamespace.OWNER);
|
||||
|
@ -126,8 +128,9 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverInfo discoverInfo() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public DiscoverInfo discoverInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
DiscoverInfo info = new DiscoverInfo();
|
||||
info.setTo(to);
|
||||
|
@ -142,9 +145,10 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
*/
|
||||
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
return getSubscriptions(null, null);
|
||||
}
|
||||
|
@ -163,9 +167,10 @@ abstract public class Node
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Subscription> getSubscriptions(List<PacketExtension> additionalExtensions, Collection<PacketExtension> returnedExtensions)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getSubscriptions(additionalExtensions, returnedExtensions, null);
|
||||
}
|
||||
|
||||
|
@ -176,11 +181,12 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @see #getSubscriptionsAsOwner(List, Collection)
|
||||
* @since 4.1
|
||||
*/
|
||||
public List<Subscription> getSubscriptionsAsOwner() throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
return getSubscriptionsAsOwner(null, null);
|
||||
}
|
||||
|
||||
|
@ -202,19 +208,20 @@ abstract public class Node
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @see <a href="http://www.xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve">XEP-60 § 8.8.1 -
|
||||
* Retrieve Subscriptions List</a>
|
||||
* @since 4.1
|
||||
*/
|
||||
public List<Subscription> getSubscriptionsAsOwner(List<PacketExtension> additionalExtensions,
|
||||
Collection<PacketExtension> returnedExtensions) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
return getSubscriptions(additionalExtensions, returnedExtensions, PubSubNamespace.OWNER);
|
||||
}
|
||||
|
||||
private List<Subscription> getSubscriptions(List<PacketExtension> additionalExtensions,
|
||||
Collection<PacketExtension> returnedExtensions, PubSubNamespace pubSubNamespace)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS, getId()), pubSubNamespace);
|
||||
if (additionalExtensions != null) {
|
||||
for (PacketExtension pe : additionalExtensions) {
|
||||
|
@ -236,9 +243,10 @@ abstract public class Node
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
NotConnectedException, InterruptedException {
|
||||
return getAffiliations(null, null);
|
||||
}
|
||||
|
||||
|
@ -256,9 +264,10 @@ abstract public class Node
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Affiliation> getAffiliations(List<PacketExtension> additionalExtensions, Collection<PacketExtension> returnedExtensions)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS, getId()));
|
||||
if (additionalExtensions != null) {
|
||||
for (PacketExtension pe : additionalExtensions) {
|
||||
|
@ -289,8 +298,9 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub pubSub = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
|
||||
PubSub reply = sendPubsubPacket(pubSub);
|
||||
|
@ -314,8 +324,9 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
|
||||
request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm));
|
||||
|
@ -332,9 +343,10 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
*/
|
||||
public void unsubscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void unsubscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
unsubscribe(jid, null);
|
||||
}
|
||||
|
@ -347,8 +359,9 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
sendPubsubPacket(createPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId)));
|
||||
}
|
||||
|
@ -361,8 +374,9 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public SubscribeForm getSubscriptionOptions(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public SubscribeForm getSubscriptionOptions(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
return getSubscriptionOptions(jid, null);
|
||||
}
|
||||
|
@ -378,9 +392,10 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
*/
|
||||
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId)));
|
||||
FormNode ext = packet.getExtension(PubSubElementType.OPTIONS);
|
||||
|
@ -486,7 +501,7 @@ abstract public class Node
|
|||
return PubSub.createPubsubPacket(to, type, ext, ns);
|
||||
}
|
||||
|
||||
protected PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
protected PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
return PubSubManager.sendPubsubPacket(con, packet);
|
||||
}
|
||||
|
|
|
@ -86,8 +86,9 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null);
|
||||
NodeExtension elem = reply.getExtension("create", PubSubNamespace.BASIC.getXmlns());
|
||||
|
@ -108,8 +109,9 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public LeafNode createNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public LeafNode createNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
return (LeafNode)createNode(id, null);
|
||||
}
|
||||
|
@ -126,8 +128,9 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Node createNode(String name, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public Node createNode(String name, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub request = PubSub.createPubsubPacket(to, Type.set, new NodeExtension(PubSubElementType.CREATE, name), null);
|
||||
boolean isLeafNode = true;
|
||||
|
@ -160,9 +163,10 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException The node does not exist
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Node> T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public <T extends Node> T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
Node node = nodeMap.get(id);
|
||||
|
||||
|
@ -211,8 +215,9 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverItems discoverNodes(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public DiscoverItems discoverNodes(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
DiscoverItems items = new DiscoverItems();
|
||||
|
||||
|
@ -230,8 +235,9 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
Stanza reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS), null);
|
||||
SubscriptionsExtension subElem = reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns());
|
||||
|
@ -245,9 +251,10 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*
|
||||
*/
|
||||
public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS), null);
|
||||
AffiliationsExtension listElem = reply.getExtension(PubSubElementType.AFFILIATIONS);
|
||||
|
@ -261,8 +268,9 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public void deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace());
|
||||
nodeMap.remove(nodeId);
|
||||
|
@ -275,8 +283,9 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public ConfigureForm getDefaultConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public ConfigureForm getDefaultConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
// Errors will cause exceptions in getReply, so it only returns
|
||||
// on success.
|
||||
|
@ -292,19 +301,20 @@ final public class PubSubManager
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverInfo getSupportedFeatures() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
public DiscoverInfo getSupportedFeatures() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
ServiceDiscoveryManager mgr = ServiceDiscoveryManager.getInstanceFor(con);
|
||||
return mgr.discoverInfo(to);
|
||||
}
|
||||
|
||||
private PubSub sendPubsubPacket(Type type, PacketExtension ext, PubSubNamespace ns)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return sendPubsubPacket(con, to, type, Collections.singletonList(ext), ns);
|
||||
}
|
||||
|
||||
static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List<PacketExtension> extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List<PacketExtension> extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub pubSub = new PubSub(to, type, ns);
|
||||
for (PacketExtension pe : extList) {
|
||||
|
@ -313,7 +323,7 @@ final public class PubSubManager
|
|||
return sendPubsubPacket(con ,pubSub);
|
||||
}
|
||||
|
||||
static PubSub sendPubsubPacket(XMPPConnection con, PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
static PubSub sendPubsubPacket(XMPPConnection con, PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
IQ resultIQ = con.createPacketCollectorAndSend(packet).nextResultOrThrow();
|
||||
if (resultIQ instanceof EmptyResultIQ) {
|
||||
|
|
|
@ -141,7 +141,7 @@ public class DeliveryReceiptManager extends Manager {
|
|||
// Add the packet listener to handle incoming delivery receipt requests
|
||||
connection.addAsyncPacketListener(new PacketListener() {
|
||||
@Override
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
final String from = packet.getFrom();
|
||||
final XMPPConnection connection = connection();
|
||||
switch (autoReceiptMode) {
|
||||
|
@ -188,8 +188,9 @@ public class DeliveryReceiptManager extends Manager {
|
|||
* @return true if supported
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean isSupported(String jid) throws SmackException, XMPPException {
|
||||
public boolean isSupported(String jid) throws SmackException, XMPPException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
|
||||
DeliveryReceipt.NAMESPACE);
|
||||
}
|
||||
|
|
|
@ -64,8 +64,9 @@ public class UserSearch extends SimpleIQ {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Form getSearchForm(XMPPConnection con, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public Form getSearchForm(XMPPConnection con, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
UserSearch search = new UserSearch();
|
||||
search.setType(IQ.Type.get);
|
||||
search.setTo(searchService);
|
||||
|
@ -84,8 +85,9 @@ public class UserSearch extends SimpleIQ {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
UserSearch search = new UserSearch();
|
||||
search.setType(IQ.Type.set);
|
||||
search.setTo(searchService);
|
||||
|
@ -105,8 +107,9 @@ public class UserSearch extends SimpleIQ {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public ReportedData sendSimpleSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public ReportedData sendSimpleSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
SimpleUserSearch search = new SimpleUserSearch();
|
||||
search.setForm(searchForm);
|
||||
search.setType(IQ.Type.set);
|
||||
|
|
|
@ -66,8 +66,9 @@ public class UserSearchManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public Form getSearchForm(String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public Form getSearchForm(String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return userSearch.getSearchForm(con, searchService);
|
||||
}
|
||||
|
||||
|
@ -81,8 +82,9 @@ public class UserSearchManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public ReportedData getSearchResults(Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public ReportedData getSearchResults(Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return userSearch.sendSearchForm(con, searchForm, searchService);
|
||||
}
|
||||
|
||||
|
@ -94,8 +96,9 @@ public class UserSearchManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<String> getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public List<String> getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con);
|
||||
return discoManager.findServices(UserSearch.NAMESPACE, false, false);
|
||||
}
|
||||
|
|
|
@ -44,8 +44,9 @@ public class SharedGroupManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static List<String> getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public static List<String> getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
// Discover the shared groups of the logged user
|
||||
SharedGroupsInfo info = new SharedGroupsInfo();
|
||||
info.setType(IQ.Type.get);
|
||||
|
|
|
@ -99,11 +99,11 @@ public class EntityTimeManager extends Manager {
|
|||
enabled = false;
|
||||
}
|
||||
|
||||
public boolean isTimeSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean isTimeSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, Time.NAMESPACE);
|
||||
}
|
||||
|
||||
public Time getTime(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public Time getTime(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
if (!isTimeSupported(jid))
|
||||
return null;
|
||||
|
||||
|
|
|
@ -70,10 +70,11 @@ public class VCardManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @deprecated use {@link #isSupported(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isSupported(String jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public static boolean isSupported(String jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return VCardManager.getInstanceFor(connection).isSupported(jid);
|
||||
}
|
||||
|
||||
|
@ -89,8 +90,9 @@ public class VCardManager extends Manager {
|
|||
* @throws XMPPErrorException thrown if there was an issue setting the VCard in the server.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void saveVCard(VCard vcard) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void saveVCard(VCard vcard) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
vcard.setType(IQ.Type.set);
|
||||
connection().createPacketCollectorAndSend(vcard).nextResultOrThrow();
|
||||
}
|
||||
|
@ -101,8 +103,9 @@ public class VCardManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public VCard loadVCard() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public VCard loadVCard() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return loadVCard(null);
|
||||
}
|
||||
|
||||
|
@ -112,8 +115,9 @@ public class VCardManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public VCard loadVCard(String bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public VCard loadVCard(String bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
VCard vcardRequest = new VCard();
|
||||
vcardRequest.setTo(bareJid);
|
||||
VCard result = connection().createPacketCollectorAndSend(vcardRequest).nextResultOrThrow();
|
||||
|
@ -128,8 +132,9 @@ public class VCardManager extends Manager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, NAMESPACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -523,10 +523,11 @@ public class VCard extends IQ {
|
|||
* @throws XMPPErrorException thrown if there was an issue setting the VCard in the server.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @deprecated use {@link VCardManager#saveVCard(VCard)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void save(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void save(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
VCardManager.getInstanceFor(connection).saveVCard(this);
|
||||
}
|
||||
|
||||
|
@ -536,10 +537,11 @@ public class VCard extends IQ {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @deprecated use {@link VCardManager#loadVCard()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void load(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void load(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
load(connection, null);
|
||||
}
|
||||
|
||||
|
@ -548,10 +550,11 @@ public class VCard extends IQ {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @deprecated use {@link VCardManager#loadVCard(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void load(XMPPConnection connection, String user) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public void load(XMPPConnection connection, String user) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
VCard result = VCardManager.getInstanceFor(connection).loadVCard(user);
|
||||
copyFieldsFrom(result);
|
||||
}
|
||||
|
|
|
@ -76,10 +76,11 @@ public class XDataManager extends Manager {
|
|||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @see <a href="http://xmpp.org/extensions/xep-0004.html#disco">XEP-0004: Data Forms § 6. Service Discovery</a>
|
||||
* @since 4.1
|
||||
*/
|
||||
public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, NAMESPACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,9 +128,10 @@ public class XHTMLManager {
|
|||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static boolean isServiceEnabled(XMPPConnection connection, String userID)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, XHTMLExtension.NAMESPACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,9 +59,10 @@ public class InBandBytestreamManagerTest {
|
|||
* Initialize fields used in the tests.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Before
|
||||
public void setup() throws XMPPException, SmackException {
|
||||
public void setup() throws XMPPException, SmackException, InterruptedException {
|
||||
|
||||
// build protocol verifier
|
||||
protocol = new Protocol();
|
||||
|
@ -103,9 +104,10 @@ public class InBandBytestreamManagerTest {
|
|||
* bytestream.
|
||||
* @throws SmackException
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Test
|
||||
public void shouldFailIfTargetDoesNotSupportIBB() throws SmackException, XMPPException {
|
||||
public void shouldFailIfTargetDoesNotSupportIBB() throws SmackException, XMPPException, InterruptedException {
|
||||
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
|
||||
|
||||
try {
|
||||
|
@ -153,7 +155,7 @@ public class InBandBytestreamManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void shouldUseConfiguredStanzaType() throws SmackException {
|
||||
public void shouldUseConfiguredStanzaType() throws SmackException, InterruptedException {
|
||||
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
|
||||
byteStreamManager.setStanza(StanzaType.MESSAGE);
|
||||
|
||||
|
|
|
@ -67,9 +67,10 @@ public class InBandBytestreamRequestTest {
|
|||
/**
|
||||
* Test reject() method.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Test
|
||||
public void shouldReplyWithErrorIfRequestIsRejected() throws NotConnectedException {
|
||||
public void shouldReplyWithErrorIfRequestIsRejected() throws NotConnectedException, InterruptedException {
|
||||
InBandBytestreamRequest ibbRequest = new InBandBytestreamRequest(
|
||||
byteStreamManager, initBytestream);
|
||||
|
||||
|
|
|
@ -75,9 +75,10 @@ public class InBandBytestreamSessionMessageTest {
|
|||
* Initialize fields used in the tests.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Before
|
||||
public void setup() throws XMPPException, SmackException {
|
||||
public void setup() throws XMPPException, SmackException, InterruptedException {
|
||||
|
||||
// build protocol verifier
|
||||
protocol = new Protocol();
|
||||
|
|
|
@ -76,9 +76,10 @@ public class InBandBytestreamSessionTest {
|
|||
* Initialize fields used in the tests.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Before
|
||||
public void setup() throws XMPPException, SmackException {
|
||||
public void setup() throws XMPPException, SmackException, InterruptedException {
|
||||
|
||||
// build protocol verifier
|
||||
protocol = new Protocol();
|
||||
|
|
|
@ -76,9 +76,10 @@ public class Socks5ByteStreamManagerTest {
|
|||
* Initialize fields used in the tests.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Before
|
||||
public void setup() throws XMPPException, SmackException {
|
||||
public void setup() throws XMPPException, SmackException, InterruptedException {
|
||||
|
||||
// build protocol verifier
|
||||
protocol = new Protocol();
|
||||
|
|
|
@ -64,9 +64,10 @@ public class Socks5ByteStreamRequestTest {
|
|||
* Initialize fields used in the tests.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Before
|
||||
public void setup() throws XMPPException, SmackException {
|
||||
public void setup() throws XMPPException, SmackException, InterruptedException {
|
||||
|
||||
// build protocol verifier
|
||||
protocol = new Protocol();
|
||||
|
|
|
@ -69,9 +69,10 @@ public class Socks5ClientForInitiatorTest {
|
|||
* Initialize fields used in the tests.
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Before
|
||||
public void setup() throws XMPPException, SmackException {
|
||||
public void setup() throws XMPPException, SmackException, InterruptedException {
|
||||
|
||||
// build protocol verifier
|
||||
protocol = new Protocol();
|
||||
|
|
|
@ -103,9 +103,10 @@ public class PingTest extends InitExtensions {
|
|||
* @throws SmackException
|
||||
* @throws XMPPException
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Test
|
||||
public void checkFailedPingOnTimeout() throws SmackException, IOException, XMPPException {
|
||||
public void checkFailedPingOnTimeout() throws SmackException, IOException, XMPPException, InterruptedException {
|
||||
DummyConnection dummyCon = getAuthenticatedDummyConnectionWithoutIqReplies();
|
||||
PingManager pinger = PingManager.getInstanceFor(dummyCon);
|
||||
|
||||
|
@ -181,7 +182,7 @@ public class PingTest extends InitExtensions {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void checkPingToServerTimeout() throws SmackException, IOException, XMPPException {
|
||||
public void checkPingToServerTimeout() throws SmackException, IOException, XMPPException, InterruptedException {
|
||||
DummyConnection con = getAuthenticatedDummyConnectionWithoutIqReplies();
|
||||
PingManager pinger = PingManager.getInstanceFor(con);
|
||||
|
||||
|
@ -233,7 +234,7 @@ public class PingTest extends InitExtensions {
|
|||
assertFalse(pingSupported);
|
||||
}
|
||||
|
||||
private static ThreadedDummyConnection getAuthentiactedDummyConnection() throws SmackException, IOException, XMPPException {
|
||||
private static ThreadedDummyConnection getAuthentiactedDummyConnection() throws SmackException, IOException, XMPPException, InterruptedException {
|
||||
ThreadedDummyConnection connection = new ThreadedDummyConnection();
|
||||
connection.connect();
|
||||
connection.login();
|
||||
|
@ -247,8 +248,9 @@ public class PingTest extends InitExtensions {
|
|||
* @throws XMPPException
|
||||
* @throws IOException
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private static DummyConnection getAuthenticatedDummyConnectionWithoutIqReplies() throws SmackException, IOException, XMPPException {
|
||||
private static DummyConnection getAuthenticatedDummyConnectionWithoutIqReplies() throws SmackException, IOException, XMPPException, InterruptedException {
|
||||
DummyConnection con = new DummyConnection();
|
||||
con.setPacketReplyTimeout(500);
|
||||
con.connect();
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ConfigureFormTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException
|
||||
public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
|
||||
PubSubManager mgr = new PubSubManager(con);
|
||||
|
@ -77,7 +77,7 @@ public class ConfigureFormTest
|
|||
}
|
||||
|
||||
@Test (expected=SmackException.class)
|
||||
public void getConfigFormWithTimeout() throws XMPPException, SmackException
|
||||
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||
PubSubManager mgr = new PubSubManager(con);
|
||||
|
|
|
@ -64,9 +64,10 @@ public class ConnectionUtils {
|
|||
* @return a mocked XMPP connection
|
||||
* @throws SmackException
|
||||
* @throws XMPPErrorException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static XMPPConnection createMockedConnection(final Protocol protocol,
|
||||
String initiatorJID, String xmppServer) throws SmackException, XMPPErrorException {
|
||||
String initiatorJID, String xmppServer) throws SmackException, XMPPErrorException, InterruptedException {
|
||||
|
||||
// mock XMPP connection
|
||||
XMPPConnection connection = mock(XMPPConnection.class);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue