mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +01:00
Call XMPPConnection.sendIqRequestAndWaitForResponse(IQ) where possible
Refactored using find . -type f -name "*.java" |\ xargs sed -i -E |\ 's/\.createStanzaCollectorAndSend\((\w+)\)\.nextResultOrThrow\(\);/.sendIqRequestAndWaitForResponse(\1);/' and some manual refactoring.
This commit is contained in:
parent
c9ea1c11b6
commit
aab48570c9
53 changed files with 206 additions and 188 deletions
|
@ -339,7 +339,7 @@ public final class CarbonManager extends Manager {
|
|||
|
||||
IQ setIQ = carbonsEnabledIQ(new_state);
|
||||
|
||||
connection().createStanzaCollectorAndSend(setIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(setIQ);
|
||||
enabled_state = new_state;
|
||||
}
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ public final class HttpFileUploadManager extends Manager {
|
|||
throw new AssertionError();
|
||||
}
|
||||
|
||||
return connection.createStanzaCollectorAndSend(slotRequest).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(slotRequest);
|
||||
}
|
||||
|
||||
public void setTlsContext(SSLContext tlsContext) {
|
||||
|
|
|
@ -128,7 +128,7 @@ public final class IoTControlManager extends IoTManager {
|
|||
public IoTSetResponse setUsingIq(FullJid jid, Collection<? extends SetData> data) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
IoTSetRequest request = new IoTSetRequest(data);
|
||||
request.setTo(jid);
|
||||
IoTSetResponse response = connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
IoTSetResponse response = connection().sendIqRequestAndWaitForResponse(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ public final class IoTDataManager extends IoTManager {
|
|||
StanzaCollector dataCollector = connection.createStanzaCollector(dataCollectorConfiguration);
|
||||
|
||||
try {
|
||||
connection.createStanzaCollectorAndSend(iotDataRequest).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iotDataRequest);
|
||||
// Wait until a message with an IoTFieldsExtension and the done flag comes in.
|
||||
doneCollector.nextResult();
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ public final class IoTDiscoveryManager extends Manager {
|
|||
final XMPPConnection connection = connection();
|
||||
IoTRegister iotRegister = new IoTRegister(thing.getMetaTags(), thing.getNodeInfo(), thing.isSelfOwened());
|
||||
iotRegister.setTo(registry);
|
||||
IQ result = connection.createStanzaCollectorAndSend(iotRegister).nextResultOrThrow();
|
||||
IQ result = connection.sendIqRequestAndWaitForResponse(iotRegister);
|
||||
if (result instanceof IoTClaimed) {
|
||||
IoTClaimed iotClaimedResult = (IoTClaimed) result;
|
||||
throw new IoTClaimedException(iotClaimedResult);
|
||||
|
@ -293,7 +293,7 @@ public final class IoTDiscoveryManager extends Manager {
|
|||
|
||||
IoTMine iotMine = new IoTMine(metaTags, publicThing);
|
||||
iotMine.setTo(registry);
|
||||
IoTClaimed iotClaimed = connection().createStanzaCollectorAndSend(iotMine).nextResultOrThrow();
|
||||
IoTClaimed iotClaimed = connection().sendIqRequestAndWaitForResponse(iotMine);
|
||||
|
||||
// The 'jid' attribute of the <claimed/> response now represents the XMPP address of the thing we just successfully claimed.
|
||||
Jid thing = iotClaimed.getJid();
|
||||
|
@ -322,7 +322,7 @@ public final class IoTDiscoveryManager extends Manager {
|
|||
|
||||
IoTRemove iotRemove = new IoTRemove(thing, nodeInfo);
|
||||
iotRemove.setTo(registry);
|
||||
connection().createStanzaCollectorAndSend(iotRemove).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(iotRemove);
|
||||
|
||||
// We no not update the ThingState here, as this is done in the <removed/> IQ handler above.;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ public final class IoTDiscoveryManager extends Manager {
|
|||
|
||||
IoTUnregister iotUnregister = new IoTUnregister(nodeInfo);
|
||||
iotUnregister.setTo(registry);
|
||||
connection().createStanzaCollectorAndSend(iotUnregister).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(iotUnregister);
|
||||
|
||||
ThingState state = getStateFor(nodeInfo);
|
||||
state.setUnregistered();
|
||||
|
@ -375,7 +375,7 @@ public final class IoTDiscoveryManager extends Manager {
|
|||
|
||||
IoTDisown iotDisown = new IoTDisown(thing, nodeInfo);
|
||||
iotDisown.setTo(registry);
|
||||
connection().createStanzaCollectorAndSend(iotDisown).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(iotDisown);
|
||||
}
|
||||
|
||||
// Registry utility methods
|
||||
|
|
|
@ -344,7 +344,7 @@ public final class IoTProvisioningManager extends Manager {
|
|||
|
||||
IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion);
|
||||
iotIsFriend.setTo(provisioningServer);
|
||||
IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow();
|
||||
IoTIsFriendResponse response = connection().sendIqRequestAndWaitForResponse(iotIsFriend);
|
||||
assert response.getJid().equals(friendInQuestion);
|
||||
boolean isFriend = response.getIsFriendResult();
|
||||
if (!isFriend) {
|
||||
|
|
|
@ -533,7 +533,7 @@ public final class MamManager extends Manager {
|
|||
MamQueryIQ mamQueryIq = new MamQueryIQ(queryId, node, null);
|
||||
mamQueryIq.setTo(archiveAddress);
|
||||
|
||||
MamQueryIQ mamResponseQueryIq = connection().createStanzaCollectorAndSend(mamQueryIq).nextResultOrThrow();
|
||||
MamQueryIQ mamResponseQueryIq = connection().sendIqRequestAndWaitForResponse(mamQueryIq);
|
||||
|
||||
return mamResponseQueryIq.getDataForm().getFields();
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ public final class MamManager extends Manager {
|
|||
NotConnectedException, InterruptedException, NotLoggedInException {
|
||||
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
|
||||
|
||||
MamPrefsIQ mamPrefsResultIQ = connection.createStanzaCollectorAndSend(mamPrefsIQ).nextResultOrThrow();
|
||||
MamPrefsIQ mamPrefsResultIQ = connection.sendIqRequestAndWaitForResponse(mamPrefsIQ);
|
||||
|
||||
return new MamPrefsResult(mamPrefsResultIQ, DataForm.from(mamPrefsIQ));
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ public class MultiUserChatLight {
|
|||
messageCollector = connection.createStanzaCollector(fromRoomGroupChatFilter);
|
||||
|
||||
try {
|
||||
connection.createStanzaCollectorAndSend(createMUCLightIQ).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(createMUCLightIQ);
|
||||
} catch (NotConnectedException | InterruptedException | NoResponseException | XMPPErrorException e) {
|
||||
removeConnectionCallbacks();
|
||||
throw e;
|
||||
|
@ -332,7 +332,7 @@ public class MultiUserChatLight {
|
|||
affiliations.put(connection.getUser(), MUCLightAffiliation.none);
|
||||
|
||||
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
|
||||
IQ responseIq = connection.createStanzaCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow();
|
||||
IQ responseIq = connection.sendIqRequestAndWaitForResponse(changeAffiliationsIQ);
|
||||
boolean roomLeft = responseIq.getType().equals(IQ.Type.result);
|
||||
|
||||
if (roomLeft) {
|
||||
|
@ -354,7 +354,7 @@ public class MultiUserChatLight {
|
|||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightGetInfoIQ mucLightGetInfoIQ = new MUCLightGetInfoIQ(room, version);
|
||||
|
||||
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightGetInfoIQ).nextResultOrThrow();
|
||||
IQ responseIq = connection.sendIqRequestAndWaitForResponse(mucLightGetInfoIQ);
|
||||
MUCLightInfoIQ mucLightInfoResponseIQ = (MUCLightInfoIQ) responseIq;
|
||||
|
||||
return new MUCLightRoomInfo(mucLightInfoResponseIQ.getVersion(), room,
|
||||
|
@ -388,7 +388,7 @@ public class MultiUserChatLight {
|
|||
public MUCLightRoomConfiguration getConfiguration(String version)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightGetConfigsIQ mucLightGetConfigsIQ = new MUCLightGetConfigsIQ(room, version);
|
||||
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightGetConfigsIQ).nextResultOrThrow();
|
||||
IQ responseIq = connection.sendIqRequestAndWaitForResponse(mucLightGetConfigsIQ);
|
||||
MUCLightConfigurationIQ mucLightConfigurationIQ = (MUCLightConfigurationIQ) responseIq;
|
||||
return mucLightConfigurationIQ.getConfiguration();
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ public class MultiUserChatLight {
|
|||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(room, version);
|
||||
|
||||
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightGetAffiliationsIQ).nextResultOrThrow();
|
||||
IQ responseIq = connection.sendIqRequestAndWaitForResponse(mucLightGetAffiliationsIQ);
|
||||
MUCLightAffiliationsIQ mucLightAffiliationsIQ = (MUCLightAffiliationsIQ) responseIq;
|
||||
|
||||
return mucLightAffiliationsIQ.getAffiliations();
|
||||
|
@ -453,7 +453,7 @@ public class MultiUserChatLight {
|
|||
public void changeAffiliations(HashMap<Jid, MUCLightAffiliation> affiliations)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
|
||||
connection.createStanzaCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(changeAffiliationsIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -466,7 +466,7 @@ public class MultiUserChatLight {
|
|||
*/
|
||||
public void destroy() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(room);
|
||||
IQ responseIq = connection.createStanzaCollectorAndSend(mucLightDestroyIQ).nextResultOrThrow();
|
||||
IQ responseIq = connection.sendIqRequestAndWaitForResponse(mucLightDestroyIQ);
|
||||
boolean roomDestroyed = responseIq.getType().equals(IQ.Type.result);
|
||||
|
||||
if (roomDestroyed) {
|
||||
|
@ -486,7 +486,7 @@ public class MultiUserChatLight {
|
|||
public void changeSubject(String subject)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, null, subject, null);
|
||||
connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(mucLightSetConfigIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -501,7 +501,7 @@ public class MultiUserChatLight {
|
|||
public void changeRoomName(String roomName)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, null);
|
||||
connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(mucLightSetConfigIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -531,7 +531,7 @@ public class MultiUserChatLight {
|
|||
public void setRoomConfigs(String roomName, HashMap<String, String> customConfigs)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, customConfigs);
|
||||
connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(mucLightSetConfigIQ);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
mucLightBlockingIQ.setTo(mucLightService);
|
||||
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(mucLightBlockingIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -323,7 +323,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
mucLightBlockingIQ.setTo(mucLightService);
|
||||
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(mucLightBlockingIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -367,7 +367,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
mucLightBlockingIQ.setTo(mucLightService);
|
||||
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(mucLightBlockingIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -411,7 +411,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
mucLightBlockingIQ.setTo(mucLightService);
|
||||
connection().createStanzaCollectorAndSend(mucLightBlockingIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(mucLightBlockingIQ);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public final class PushNotificationsManager extends Manager {
|
|||
private boolean changePushNotificationsStatus(IQ iq)
|
||||
throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
final XMPPConnection connection = connection();
|
||||
IQ responseIQ = connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
IQ responseIQ = connection.sendIqRequestAndWaitForResponse(iq);
|
||||
return responseIQ.getType() != IQ.Type.error;
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
|
||||
if (blockListCached == null) {
|
||||
BlockListIQ blockListIQ = new BlockListIQ();
|
||||
BlockListIQ blockListIQResult = connection().createStanzaCollectorAndSend(blockListIQ).nextResultOrThrow();
|
||||
BlockListIQ blockListIQResult = connection().sendIqRequestAndWaitForResponse(blockListIQ);
|
||||
blockListCached = blockListIQResult.getBlockedJidsCopy();
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
public void blockContacts(List<Jid> jids)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
BlockContactsIQ blockContactIQ = new BlockContactsIQ(jids);
|
||||
connection().createStanzaCollectorAndSend(blockContactIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(blockContactIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -218,7 +218,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
public void unblockContacts(List<Jid> jids)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ(jids);
|
||||
connection().createStanzaCollectorAndSend(unblockContactIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(unblockContactIQ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,7 +232,7 @@ public final class BlockingCommandManager extends Manager {
|
|||
public void unblockAll()
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ();
|
||||
connection().createStanzaCollectorAndSend(unblockContactIQ).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(unblockContactIQ);
|
||||
}
|
||||
|
||||
public void addJidsBlockedListener(JidsBlockedListener jidsBlockedListener) {
|
||||
|
|
|
@ -149,7 +149,7 @@ public final class BoBManager extends Manager {
|
|||
requestBoBIQ.setTo(to);
|
||||
|
||||
XMPPConnection connection = getAuthenticatedConnectionOrThrow();
|
||||
BoBIQ responseBoBIQ = connection.createStanzaCollectorAndSend(requestBoBIQ).nextResultOrThrow();
|
||||
BoBIQ responseBoBIQ = connection.sendIqRequestAndWaitForResponse(requestBoBIQ);
|
||||
|
||||
bobData = responseBoBIQ.getBoBData();
|
||||
BOB_CACHE.put(bobHash, bobData);
|
||||
|
|
|
@ -424,7 +424,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
final XMPPConnection connection = connection();
|
||||
|
||||
// sending packet will throw exception on timeout or error reply
|
||||
connection.createStanzaCollectorAndSend(byteStreamRequest).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(byteStreamRequest);
|
||||
|
||||
InBandBytestreamSession inBandBytestreamSession = new InBandBytestreamSession(
|
||||
connection, byteStreamRequest, targetJID);
|
||||
|
|
|
@ -228,7 +228,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
Close close = new Close(this.byteStreamRequest.getSessionID());
|
||||
close.setTo(this.remoteJID);
|
||||
try {
|
||||
connection.createStanzaCollectorAndSend(close).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(close);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Sadly we are unable to use the IOException(Throwable) constructor because this
|
||||
|
@ -823,7 +823,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
iq.setTo(remoteJID);
|
||||
|
||||
try {
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// close session unless it is already closed
|
||||
|
|
|
@ -624,8 +624,8 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
for (Jid proxy : proxies) {
|
||||
Bytestream streamHostRequest = createStreamHostRequest(proxy);
|
||||
try {
|
||||
Bytestream response = connection.createStanzaCollectorAndSend(
|
||||
streamHostRequest).nextResultOrThrow();
|
||||
Bytestream response = connection.sendIqRequestAndWaitForResponse(
|
||||
streamHostRequest);
|
||||
streamHosts.addAll(response.getStreamHosts());
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
|
@ -115,7 +115,7 @@ public class Socks5ClientForInitiator extends Socks5Client {
|
|||
private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Bytestream activate = createStreamHostActivation();
|
||||
// if activation fails #nextResultOrThrow() throws an exception
|
||||
connection.get().createStanzaCollectorAndSend(activate).nextResultOrThrow();
|
||||
connection.get().sendIqRequestAndWaitForResponse(activate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,7 +145,7 @@ public class RemoteCommand extends AdHocCommand {
|
|||
|
||||
AdHocCommandData responseData = null;
|
||||
try {
|
||||
responseData = connection.createStanzaCollectorAndSend(data).nextResultOrThrow();
|
||||
responseData = connection.sendIqRequestAndWaitForResponse(data);
|
||||
}
|
||||
finally {
|
||||
// We set the response data in a 'finally' block, so that it also gets set even if an error IQ was returned.
|
||||
|
|
|
@ -603,7 +603,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
.setNode(node)
|
||||
.build();
|
||||
|
||||
Stanza result = connection.createStanzaCollectorAndSend(discoInfoRequest).nextResultOrThrow();
|
||||
Stanza result = connection.sendIqRequestAndWaitForResponse(discoInfoRequest);
|
||||
|
||||
return (DiscoverInfo) result;
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
disco.setTo(entityID);
|
||||
disco.setNode(node);
|
||||
|
||||
Stanza result = connection().createStanzaCollectorAndSend(disco).nextResultOrThrow();
|
||||
Stanza result = connection().sendIqRequestAndWaitForResponse(disco);
|
||||
return (DiscoverItems) result;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ public final class LastActivityManager extends Manager {
|
|||
public LastActivity getLastActivity(Jid jid) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException, InterruptedException {
|
||||
LastActivity activity = new LastActivity(jid);
|
||||
return (LastActivity) connection().createStanzaCollectorAndSend(activity).nextResultOrThrow();
|
||||
return (LastActivity) connection().sendIqRequestAndWaitForResponse(activity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -163,8 +163,8 @@ public final class PrivateDataManager extends Manager {
|
|||
// Create an IQ packet to get the private data.
|
||||
IQ privateDataGet = new PrivateDataIQ(elementName, namespace);
|
||||
|
||||
PrivateDataIQ response = connection().createStanzaCollectorAndSend(
|
||||
privateDataGet).nextResultOrThrow();
|
||||
PrivateDataIQ response = connection().sendIqRequestAndWaitForResponse(
|
||||
privateDataGet);
|
||||
return response.getPrivateData();
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ public final class PrivateDataManager extends Manager {
|
|||
// Create an IQ packet to set the private data.
|
||||
IQ privateDataSet = new PrivateDataIQ(privateData);
|
||||
|
||||
connection().createStanzaCollectorAndSend(privateDataSet).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(privateDataSet);
|
||||
}
|
||||
|
||||
private static final PrivateData DUMMY_PRIVATE_DATA = new PrivateData() {
|
||||
|
|
|
@ -155,7 +155,7 @@ public final class VersionManager extends Manager {
|
|||
}
|
||||
XMPPConnection connection = connection();
|
||||
Version version = Version.builder(connection).to(jid).build();
|
||||
return connection().createStanzaCollectorAndSend(version).nextResultOrThrow();
|
||||
return connection().sendIqRequestAndWaitForResponse(version);
|
||||
}
|
||||
|
||||
private static VersionInformation generateVersionFrom(String name, String version, String os) {
|
||||
|
|
|
@ -90,7 +90,7 @@ public class JingleUtil {
|
|||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
|
||||
Jingle jingle = createSessionInitiateFileOffer(recipient, sessionId, contentCreator, contentName, description, transport);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public IQ sendSessionInitiate(FullJid recipient,
|
||||
|
@ -176,7 +176,7 @@ public class JingleUtil {
|
|||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
|
||||
Jingle jingle = createSessionTerminateDecline(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateSuccess(FullJid recipient, String sessionId) {
|
||||
|
@ -188,7 +188,7 @@ public class JingleUtil {
|
|||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
|
||||
Jingle jingle = createSessionTerminateSuccess(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateBusy(FullJid recipient, String sessionId) {
|
||||
|
@ -200,7 +200,7 @@ public class JingleUtil {
|
|||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
|
||||
Jingle jingle = createSessionTerminateBusy(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateAlternativeSession(FullJid recipient, String sessionId, String altSessionId) {
|
||||
|
@ -212,7 +212,7 @@ public class JingleUtil {
|
|||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
|
||||
Jingle jingle = createSessionTerminateAlternativeSession(recipient, sessionId, altSessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateCancel(FullJid recipient, String sessionId) {
|
||||
|
@ -225,7 +225,7 @@ public class JingleUtil {
|
|||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
|
||||
Jingle jingle = createSessionTerminateCancel(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateContentCancel(FullJid recipient, String sessionId,
|
||||
|
@ -249,7 +249,7 @@ public class JingleUtil {
|
|||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
Jingle jingle = createSessionTerminateContentCancel(recipient, sessionId, contentCreator, contentName);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateUnsupportedTransports(FullJid recipient, String sessionId) {
|
||||
|
@ -260,7 +260,7 @@ public class JingleUtil {
|
|||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
Jingle jingle = createSessionTerminateUnsupportedTransports(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateFailedTransport(FullJid recipient, String sessionId) {
|
||||
|
@ -271,7 +271,7 @@ public class JingleUtil {
|
|||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
Jingle jingle = createSessionTerminateFailedTransport(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateUnsupportedApplications(FullJid recipient, String sessionId) {
|
||||
|
@ -282,7 +282,7 @@ public class JingleUtil {
|
|||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
Jingle jingle = createSessionTerminateUnsupportedApplications(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateFailedApplication(FullJid recipient, String sessionId) {
|
||||
|
@ -293,7 +293,7 @@ public class JingleUtil {
|
|||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
Jingle jingle = createSessionTerminateFailedApplication(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateIncompatibleParameters(FullJid recipient, String sessionId) {
|
||||
|
@ -304,7 +304,7 @@ public class JingleUtil {
|
|||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
Jingle jingle = createSessionTerminateIncompatibleParameters(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public IQ sendContentRejectFileNotAvailable(FullJid recipient, String sessionId, JingleContentDescription description) {
|
||||
|
@ -327,7 +327,7 @@ public class JingleUtil {
|
|||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
Jingle jingle = createSessionPing(recipient, sessionId);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public IQ createAck(Jingle jingle) {
|
||||
|
@ -362,7 +362,7 @@ public class JingleUtil {
|
|||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
Jingle jingle = createTransportReplace(recipient, initiator, sessionId, contentCreator, contentName, transport);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createTransportAccept(FullJid recipient, FullJid initiator, String sessionId,
|
||||
|
@ -389,7 +389,7 @@ public class JingleUtil {
|
|||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
Jingle jingle = createTransportAccept(recipient, initiator, sessionId, contentCreator, contentName, transport);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
public Jingle createTransportReject(FullJid recipient, FullJid initiator, String sessionId,
|
||||
|
@ -416,7 +416,7 @@ public class JingleUtil {
|
|||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
Jingle jingle = createTransportReject(recipient, initiator, sessionId, contentCreator, contentName, transport);
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(jingle);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -119,7 +119,7 @@ public final class JingleS5BTransportManager extends JingleTransportManager<Jing
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(proxy);
|
||||
try {
|
||||
Bytestream response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
Bytestream response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
streamHosts.addAll(response.getStreamHosts());
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
|
@ -137,8 +137,7 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
|||
Jingle jingle = transportManager().createCandidateUsed(jingleSession.getRemote(), jingleSession.getInitiator(), jingleSession.getSessionId(),
|
||||
content.getSenders(), content.getCreator(), content.getName(), theirProposal.getStreamId(), ourChoice.candidate.getCandidateId());
|
||||
try {
|
||||
jingleSession.getConnection().createStanzaCollectorAndSend(jingle)
|
||||
.nextResultOrThrow();
|
||||
jingleSession.getConnection().sendIqRequestAndWaitForResponse(jingle);
|
||||
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
||||
LOGGER.log(Level.WARNING, "Could not send candidate-used.", e);
|
||||
}
|
||||
|
@ -303,7 +302,7 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
|||
activate.setToActivate(jingleSession.getRemote());
|
||||
activate.setFrom(jingleSession.getLocal());
|
||||
try {
|
||||
jingleSession.getConnection().createStanzaCollectorAndSend(activate).nextResultOrThrow();
|
||||
jingleSession.getConnection().sendIqRequestAndWaitForResponse(activate);
|
||||
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
||||
LOGGER.log(Level.WARNING, "Could not activate proxy.", e);
|
||||
return;
|
||||
|
@ -315,8 +314,7 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
|
|||
content.getSenders(), content.getCreator(), content.getName(), nominated.transport.getStreamId(),
|
||||
nominated.candidate.getCandidateId());
|
||||
try {
|
||||
jingleSession.getConnection().createStanzaCollectorAndSend(candidateActivate)
|
||||
.nextResultOrThrow();
|
||||
jingleSession.getConnection().sendIqRequestAndWaitForResponse(candidateActivate);
|
||||
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
||||
LOGGER.log(Level.WARNING, "Could not send candidate-activated", e);
|
||||
return;
|
||||
|
|
|
@ -838,7 +838,7 @@ public class MultiUserChat {
|
|||
iq.setTo(room);
|
||||
iq.setType(IQ.Type.get);
|
||||
|
||||
IQ answer = connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
IQ answer = connection.sendIqRequestAndWaitForResponse(iq);
|
||||
DataForm dataForm = DataForm.from(answer, MucConfigFormManager.FORM_TYPE);
|
||||
return new Form(dataForm);
|
||||
}
|
||||
|
@ -867,7 +867,7 @@ public class MultiUserChat {
|
|||
iq.setType(IQ.Type.set);
|
||||
iq.addExtension(dataForm);
|
||||
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -892,7 +892,7 @@ public class MultiUserChat {
|
|||
reg.setType(IQ.Type.get);
|
||||
reg.setTo(room);
|
||||
|
||||
IQ result = connection.createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
IQ result = connection.sendIqRequestAndWaitForResponse(reg);
|
||||
DataForm dataForm = DataForm.from(result);
|
||||
return new Form(dataForm);
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ public class MultiUserChat {
|
|||
reg.setTo(room);
|
||||
reg.addExtension(form.getDataFormToSubmit());
|
||||
|
||||
connection.createStanzaCollectorAndSend(reg).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(reg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -965,7 +965,7 @@ public class MultiUserChat {
|
|||
iq.setDestroy(destroy);
|
||||
|
||||
try {
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
catch (XMPPErrorException e) {
|
||||
// Note that we do not call userHasLeft() here because an XMPPErrorException would usually indicate that the
|
||||
|
@ -1718,7 +1718,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(affiliation, jid, reason);
|
||||
iq.addItem(item);
|
||||
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
|
||||
private void changeAffiliationByAdmin(Collection<? extends Jid> jids, MUCAffiliation affiliation)
|
||||
|
@ -1732,7 +1732,7 @@ public class MultiUserChat {
|
|||
iq.addItem(item);
|
||||
}
|
||||
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
|
||||
private void changeRole(Resourcepart nickname, MUCRole role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
|
@ -1743,7 +1743,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(role, nickname, reason);
|
||||
iq.addItem(item);
|
||||
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
|
||||
private void changeRole(Collection<Resourcepart> nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
|
@ -1756,7 +1756,7 @@ public class MultiUserChat {
|
|||
iq.addItem(item);
|
||||
}
|
||||
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1914,7 +1914,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(affiliation);
|
||||
iq.addItem(item);
|
||||
|
||||
MUCAdmin answer = (MUCAdmin) connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
MUCAdmin answer = (MUCAdmin) connection.sendIqRequestAndWaitForResponse(iq);
|
||||
|
||||
// Get the list of affiliates from the server's answer
|
||||
List<Affiliate> affiliates = new ArrayList<Affiliate>();
|
||||
|
@ -1969,7 +1969,7 @@ public class MultiUserChat {
|
|||
MUCItem item = new MUCItem(role);
|
||||
iq.addItem(item);
|
||||
|
||||
MUCAdmin answer = (MUCAdmin) connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
MUCAdmin answer = (MUCAdmin) connection.sendIqRequestAndWaitForResponse(iq);
|
||||
// Get the list of participants from the server's answer
|
||||
List<Occupant> participants = new ArrayList<Occupant>();
|
||||
for (MUCItem mucadminItem : answer.getItems()) {
|
||||
|
|
|
@ -178,7 +178,7 @@ public final class OfflineMessageManager extends Manager {
|
|||
});
|
||||
int pendingNodes = nodes.size();
|
||||
try (StanzaCollector messageCollector = connection().createStanzaCollector(messageFilter)) {
|
||||
connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(request);
|
||||
// Collect the received offline messages
|
||||
Message message;
|
||||
do {
|
||||
|
@ -249,7 +249,7 @@ public final class OfflineMessageManager extends Manager {
|
|||
item.setAction("remove");
|
||||
request.addItem(item);
|
||||
}
|
||||
connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,6 +265,6 @@ public final class OfflineMessageManager extends Manager {
|
|||
OfflineMessageRequest request = new OfflineMessageRequest();
|
||||
request.setType(IQ.Type.set);
|
||||
request.setPurge(true);
|
||||
connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ public final class PrivacyListManager extends Manager {
|
|||
// The request is a get iq type
|
||||
requestPrivacy.setType(Privacy.Type.get);
|
||||
|
||||
return connection().createStanzaCollectorAndSend(requestPrivacy).nextResultOrThrow();
|
||||
return connection().sendIqRequestAndWaitForResponse(requestPrivacy);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,7 +252,7 @@ public final class PrivacyListManager extends Manager {
|
|||
// The request is a get iq type
|
||||
requestPrivacy.setType(Privacy.Type.set);
|
||||
|
||||
return connection().createStanzaCollectorAndSend(requestPrivacy).nextResultOrThrow();
|
||||
return connection().sendIqRequestAndWaitForResponse(requestPrivacy);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,7 +57,7 @@ public class LeafNode extends Node {
|
|||
DiscoverItems items = new DiscoverItems();
|
||||
items.setTo(pubSubManager.getServiceJid());
|
||||
items.setNode(getId());
|
||||
return pubSubManager.getConnection().createStanzaCollectorAndSend(items).nextResultOrThrow();
|
||||
return pubSubManager.getConnection().sendIqRequestAndWaitForResponse(items);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -194,7 +194,7 @@ public class LeafNode extends Node {
|
|||
private <T extends Item> List<T> getItems(PubSub request,
|
||||
List<XmlElement> returnedExtensions) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub result = pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
PubSub result = pubSubManager.getConnection().sendIqRequestAndWaitForResponse(request);
|
||||
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
|
||||
if (returnedExtensions != null) {
|
||||
returnedExtensions.addAll(result.getExtensions());
|
||||
|
@ -278,7 +278,7 @@ public class LeafNode extends Node {
|
|||
public void publish() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub packet = createPubsubPacket(IQ.Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
|
||||
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
pubSubManager.getConnection().sendIqRequestAndWaitForResponse(packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -327,7 +327,7 @@ public class LeafNode extends Node {
|
|||
public <T extends Item> void publish(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub packet = createPubsubPacket(IQ.Type.set, new PublishItem<>(getId(), items));
|
||||
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
pubSubManager.getConnection().sendIqRequestAndWaitForResponse(packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -343,7 +343,7 @@ public class LeafNode extends Node {
|
|||
public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub request = createPubsubPacket(IQ.Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()));
|
||||
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
pubSubManager.getConnection().sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -377,6 +377,6 @@ public class LeafNode extends Node {
|
|||
items.add(new Item(id));
|
||||
}
|
||||
PubSub request = createPubsubPacket(IQ.Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
pubSubManager.getConnection().sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public abstract class Node {
|
|||
public void sendConfigurationForm(FillableConfigureForm configureForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
PubSub packet = createPubsubPacket(IQ.Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER,
|
||||
getId(), configureForm.getDataFormToSubmit()));
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
pubSubManager.getConnection().sendIqRequestAndWaitForResponse(packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ public abstract class Node {
|
|||
.to(pubSubManager.getServiceJid())
|
||||
.setNode(getId())
|
||||
.build();
|
||||
return connection.createStanzaCollectorAndSend(discoverInfoRequest).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(discoverInfoRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -302,7 +302,7 @@ public final class PubSubManager extends Manager {
|
|||
.setNode(id)
|
||||
.build();
|
||||
|
||||
DiscoverInfo infoReply = connection.createStanzaCollectorAndSend(info).nextResultOrThrow();
|
||||
DiscoverInfo infoReply = connection.sendIqRequestAndWaitForResponse(info);
|
||||
|
||||
if (infoReply.hasIdentity(PubSub.ELEMENT, "leaf")) {
|
||||
node = new LeafNode(this, id);
|
||||
|
@ -492,7 +492,7 @@ public final class PubSubManager extends Manager {
|
|||
if (nodeId != null)
|
||||
items.setNode(nodeId);
|
||||
items.setTo(pubSubService);
|
||||
DiscoverItems nodeItems = connection().createStanzaCollectorAndSend(items).nextResultOrThrow();
|
||||
DiscoverItems nodeItems = connection().sendIqRequestAndWaitForResponse(items);
|
||||
return nodeItems;
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ public final class PubSubManager extends Manager {
|
|||
|
||||
PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException, InterruptedException {
|
||||
IQ resultIQ = connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
IQ resultIQ = connection().sendIqRequestAndWaitForResponse(packet);
|
||||
if (resultIQ instanceof EmptyResultIQ) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class UserSearch extends SimpleIQ {
|
|||
search.setType(IQ.Type.get);
|
||||
search.setTo(searchService);
|
||||
|
||||
IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow();
|
||||
IQ response = con.sendIqRequestAndWaitForResponse(search);
|
||||
return DataForm.from(response, NAMESPACE);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class UserSearch extends SimpleIQ {
|
|||
search.setTo(searchService);
|
||||
search.addExtension(searchForm);
|
||||
|
||||
IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow();
|
||||
IQ response = con.sendIqRequestAndWaitForResponse(search);
|
||||
return ReportedData.getReportedDataFrom(response);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class UserSearch extends SimpleIQ {
|
|||
search.setType(IQ.Type.set);
|
||||
search.setTo(searchService);
|
||||
|
||||
SimpleUserSearch response = con.createStanzaCollectorAndSend(search).nextResultOrThrow();
|
||||
SimpleUserSearch response = con.sendIqRequestAndWaitForResponse(search);
|
||||
return response.getReportedData();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class SharedGroupManager {
|
|||
SharedGroupsInfo info = new SharedGroupsInfo();
|
||||
info.setType(IQ.Type.get);
|
||||
|
||||
SharedGroupsInfo result = connection.createStanzaCollectorAndSend(info).nextResultOrThrow();
|
||||
SharedGroupsInfo result = connection.sendIqRequestAndWaitForResponse(info);
|
||||
return result.getGroups();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,6 @@ public final class EntityTimeManager extends Manager {
|
|||
Time request = Time.builder(connection)
|
||||
.to(jid)
|
||||
.build();
|
||||
return connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public final class VCardManager extends Manager {
|
|||
// Also make sure to generate a new stanza id (the given vcard could be a vcard result), in which case we don't
|
||||
// want to use the same stanza id again (although it wouldn't break if we did)
|
||||
vcard.setStanzaId();
|
||||
connection().createStanzaCollectorAndSend(vcard).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(vcard);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,7 +137,7 @@ public final class VCardManager extends Manager {
|
|||
public VCard loadVCard(EntityBareJid bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
VCard vcardRequest = new VCard();
|
||||
vcardRequest.setTo(bareJid);
|
||||
VCard result = connection().createStanzaCollectorAndSend(vcardRequest).nextResultOrThrow();
|
||||
VCard result = connection().sendIqRequestAndWaitForResponse(vcardRequest);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,17 @@ public class ConnectionUtils {
|
|||
when(collector.nextResultOrThrow()).thenAnswer(answerOrThrow);
|
||||
when(collector.nextResultOrThrow(anyLong())).thenAnswer(answerOrThrow);
|
||||
|
||||
Answer<IQ> responseIq = new Answer<IQ>() {
|
||||
@Override
|
||||
public IQ answer(InvocationOnMock invocation) throws Throwable {
|
||||
collectorAndSend.answer(invocation);
|
||||
|
||||
IQ response = (IQ) answerOrThrow.answer(invocation);
|
||||
return response;
|
||||
}
|
||||
};
|
||||
when(connection.sendIqRequestAndWaitForResponse(isA(IQ.class))).thenAnswer(responseIq);
|
||||
|
||||
// initialize service discovery manager for this connection
|
||||
ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
|
||||
|
|
|
@ -699,7 +699,7 @@ public final class Roster extends Manager {
|
|||
}
|
||||
}
|
||||
rosterPacket.addRosterItem(item);
|
||||
connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(rosterPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -852,7 +852,7 @@ public final class Roster extends Manager {
|
|||
// Set the item type as REMOVE so that the server will delete the entry
|
||||
item.setItemType(RosterPacket.ItemType.remove);
|
||||
packet.addRosterItem(item);
|
||||
connection.createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,7 +110,7 @@ public final class RosterEntry extends Manager {
|
|||
// Create a new roster item with the current RosterEntry and the *new* name. Note that we can't set the name of
|
||||
// RosterEntry right away, as otherwise the updated event wont get fired, because equalsDeep would return true.
|
||||
packet.addRosterItem(toRosterItem(this, name));
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(packet);
|
||||
|
||||
// We have received a result response to the IQ set, the name was successfully changed
|
||||
item.setName(name);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class RosterGroup extends Manager {
|
|||
item.removeGroupName(this.name);
|
||||
item.addGroupName(name);
|
||||
packet.addRosterItem(item);
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class RosterGroup extends Manager {
|
|||
item.addGroupName(getName());
|
||||
packet.addRosterItem(item);
|
||||
// Wait up to a certain number of seconds for a reply from the server.
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class RosterGroup extends Manager {
|
|||
item.removeGroupName(this.getName());
|
||||
packet.addRosterItem(item);
|
||||
// Wait up to a certain number of seconds for a reply from the server.
|
||||
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
connection().sendIqRequestAndWaitForResponse(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.jingleold.listeners.JingleListener;
|
||||
|
@ -265,7 +267,7 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void triggerContentEstablished() throws NotConnectedException, InterruptedException {
|
||||
public void triggerContentEstablished() throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
|
||||
PayloadType bestCommonAudioPt = getMediaNegotiator().getBestCommonAudioPt();
|
||||
TransportCandidate bestRemoteCandidate = getTransportNegotiator().getBestRemoteCandidate();
|
||||
|
@ -279,8 +281,10 @@ public class ContentNegotiator extends JingleNegotiator {
|
|||
* Trigger a session established event.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException, InterruptedException {
|
||||
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
|
||||
// Let the session know that we've established a content/media segment.
|
||||
JingleSession session = getSession();
|
||||
|
|
|
@ -27,10 +27,12 @@ import java.util.logging.Logger;
|
|||
import org.jivesoftware.smack.AbstractConnectionClosedListener;
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.StanzaListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
@ -847,7 +849,7 @@ public final class JingleSession extends JingleNegotiator implements MediaReceiv
|
|||
JingleTransportListener jingleTransportListener = new JingleTransportListener() {
|
||||
|
||||
@Override
|
||||
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
|
||||
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
if (isFullyEstablished()) {
|
||||
// CHECKSTYLE:OFF
|
||||
// Indicate that this session is active.
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jingleold.listeners;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||
import org.jivesoftware.smackx.jingleold.media.PayloadType;
|
||||
import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
|
||||
|
@ -39,9 +40,11 @@ public interface JingleSessionListener extends JingleListener {
|
|||
* @param jingleSession Session that called the method
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
|
||||
TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException, InterruptedException;
|
||||
TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException;
|
||||
|
||||
/**
|
||||
* Notification that the session was declined.
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jingleold.listeners;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
|
||||
|
||||
/**
|
||||
|
@ -37,9 +38,11 @@ public interface JingleTransportListener extends JingleListener {
|
|||
* transmitting to the remote machine
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
void transportEstablished(TransportCandidate local,
|
||||
TransportCandidate remote) throws NotConnectedException, InterruptedException;
|
||||
TransportCandidate remote) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException;
|
||||
|
||||
/**
|
||||
* Notification that a transport must be cancelled.
|
||||
|
|
|
@ -68,9 +68,10 @@ public class BridgedResolver extends TransportResolver {
|
|||
* The BridgedResolver takes the IP address and ports of a jmf proxy service.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException, NoResponseException {
|
||||
|
||||
setResolveInit();
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jingleold.nat;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||
import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener;
|
||||
import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;
|
||||
|
@ -57,7 +58,7 @@ public class BridgedTransportManager extends JingleTransportManager implements J
|
|||
// Implement a Session Listener to relay candidates after establishment
|
||||
|
||||
@Override
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,11 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||
import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener;
|
||||
import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;
|
||||
|
@ -59,7 +60,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
|
|||
// Implement a Session Listener to relay candidates after establishment
|
||||
|
||||
@Override
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
|
||||
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
if (lc instanceof ICECandidate) {
|
||||
if (((ICECandidate) lc).getType().equals(ICECandidate.Type.relay)) {
|
||||
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
|||
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
@ -400,8 +399,10 @@ public class RTPBridge extends IQ {
|
|||
* @return the new RTPBridge
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
|
||||
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return null;
|
||||
|
@ -416,12 +417,7 @@ public class RTPBridge extends IQ {
|
|||
}
|
||||
rtpPacket.setTo(jid);
|
||||
|
||||
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
|
||||
|
||||
RTPBridge response = collector.nextResult();
|
||||
|
||||
// Cancel the collector.
|
||||
collector.cancel();
|
||||
RTPBridge response = connection.sendIqRequestAndWaitForResponse(rtpPacket);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -477,8 +473,10 @@ public class RTPBridge extends IQ {
|
|||
* @return the RTPBridge
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException {
|
||||
public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return null;
|
||||
|
@ -502,12 +500,7 @@ public class RTPBridge extends IQ {
|
|||
|
||||
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
|
||||
|
||||
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
|
||||
|
||||
RTPBridge response = collector.nextResult();
|
||||
|
||||
// Cancel the collector.
|
||||
collector.cancel();
|
||||
RTPBridge response = connection.sendIqRequestAndWaitForResponse(rtpPacket);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -519,8 +512,10 @@ public class RTPBridge extends IQ {
|
|||
* @return public IP String or null if not found
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException {
|
||||
public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
|
||||
if (!xmppConnection.isConnected()) {
|
||||
return null;
|
||||
|
@ -538,12 +533,7 @@ public class RTPBridge extends IQ {
|
|||
|
||||
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
|
||||
|
||||
StanzaCollector collector = xmppConnection.createStanzaCollectorAndSend(rtpPacket);
|
||||
|
||||
RTPBridge response = collector.nextResult();
|
||||
|
||||
// Cancel the collector.
|
||||
collector.cancel();
|
||||
RTPBridge response = xmppConnection.sendIqRequestAndWaitForResponse(rtpPacket);
|
||||
|
||||
if (response == null) return null;
|
||||
|
||||
|
|
|
@ -22,10 +22,11 @@ import java.util.List;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.SimpleIQ;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
|
@ -180,8 +181,10 @@ public class STUN extends SimpleIQ {
|
|||
* @return the STUN server address
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException {
|
||||
public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
|
||||
if (!connection.isConnected()) {
|
||||
return null;
|
||||
|
@ -196,12 +199,7 @@ public class STUN extends SimpleIQ {
|
|||
}
|
||||
stunPacket.setTo(jid);
|
||||
|
||||
StanzaCollector collector = connection.createStanzaCollectorAndSend(stunPacket);
|
||||
|
||||
STUN response = collector.nextResult();
|
||||
|
||||
// Cancel the collector.
|
||||
collector.cancel();
|
||||
STUN response = connection.sendIqRequestAndWaitForResponse(stunPacket);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,10 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import org.jivesoftware.smackx.jingleold.ContentNegotiator;
|
||||
|
@ -346,7 +348,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
try {
|
||||
triggerTransportEstablished(getAcceptedLocalCandidate(), bestRemote);
|
||||
}
|
||||
catch (InterruptedException | NotConnectedException e) {
|
||||
catch (InterruptedException | NotConnectedException | NoResponseException | XMPPErrorException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
break;
|
||||
|
@ -801,8 +803,10 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
* @param remote TransportCandidate that has been agreed.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
|
||||
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
List<JingleListener> listeners = getListenersList();
|
||||
for (JingleListener li : listeners) {
|
||||
if (li instanceof JingleTransportListener) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class Agent {
|
|||
public static Collection<String> getWorkgroups(Jid serviceJID, Jid agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
AgentWorkgroups request = new AgentWorkgroups(agentJID);
|
||||
request.setTo(serviceJID);
|
||||
AgentWorkgroups response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
AgentWorkgroups response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response.getWorkgroups();
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class Agent {
|
|||
agentInfo.setType(IQ.Type.get);
|
||||
agentInfo.setTo(workgroupJID);
|
||||
agentInfo.setFrom(getUser());
|
||||
AgentInfo response = connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
|
||||
AgentInfo response = connection.sendIqRequestAndWaitForResponse(agentInfo);
|
||||
return response.getName();
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,6 @@ public class Agent {
|
|||
agentInfo.setTo(workgroupJID);
|
||||
agentInfo.setFrom(getUser());
|
||||
agentInfo.setName(newName);
|
||||
connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(agentInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -596,7 +596,7 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
OccupantsInfo response = (OccupantsInfo) connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
OccupantsInfo response = (OccupantsInfo) connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -868,7 +868,7 @@ public class AgentSession {
|
|||
notes.setTo(workgroupJID);
|
||||
notes.setSessionID(sessionID);
|
||||
notes.setNotes(note);
|
||||
connection.createStanzaCollectorAndSend(notes).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(notes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -887,7 +887,7 @@ public class AgentSession {
|
|||
request.setTo(workgroupJID);
|
||||
request.setSessionID(sessionID);
|
||||
|
||||
ChatNotes response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
ChatNotes response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -901,8 +901,9 @@ public class AgentSession {
|
|||
* @throws XMPPException if an error occurs while retrieving the AgentChatHistory.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
public AgentChatHistory getAgentHistory(EntityBareJid jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
public AgentChatHistory getAgentHistory(EntityBareJid jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException, InterruptedException, NoResponseException {
|
||||
AgentChatHistory request;
|
||||
if (startDate != null) {
|
||||
request = new AgentChatHistory(jid, maxSessions, startDate);
|
||||
|
@ -914,8 +915,8 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
AgentChatHistory response = connection.createStanzaCollectorAndSend(
|
||||
request).nextResult();
|
||||
AgentChatHistory response = connection.sendIqRequestAndWaitForResponse(
|
||||
request);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -934,7 +935,7 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
SearchSettings response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
SearchSettings response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -954,7 +955,7 @@ public class AgentSession {
|
|||
request.setTo(workgroupJID);
|
||||
request.setPersonal(!global);
|
||||
|
||||
Macros response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
Macros response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response.getRootGroup();
|
||||
}
|
||||
|
||||
|
@ -974,7 +975,7 @@ public class AgentSession {
|
|||
request.setPersonal(true);
|
||||
request.setPersonalMacroGroup(group);
|
||||
|
||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -985,14 +986,15 @@ public class AgentSession {
|
|||
* @throws XMPPException if an error occurs while getting information from the server.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException, InterruptedException {
|
||||
public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException, InterruptedException, NoResponseException {
|
||||
ChatMetadata request = new ChatMetadata();
|
||||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
request.setSessionID(sessionID);
|
||||
|
||||
ChatMetadata response = connection.createStanzaCollectorAndSend(request).nextResult();
|
||||
ChatMetadata response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
|
||||
return response.getMetadata();
|
||||
}
|
||||
|
@ -1033,7 +1035,7 @@ public class AgentSession {
|
|||
iq.setTo(workgroupJID);
|
||||
iq.setFrom(connection.getUser());
|
||||
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1070,7 +1072,7 @@ public class AgentSession {
|
|||
iq.setTo(workgroupJID);
|
||||
iq.setFrom(connection.getUser());
|
||||
|
||||
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(iq);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1089,8 +1091,8 @@ public class AgentSession {
|
|||
setting.setType(IQ.Type.get);
|
||||
setting.setTo(workgroupJID);
|
||||
|
||||
GenericSettings response = connection.createStanzaCollectorAndSend(
|
||||
setting).nextResultOrThrow();
|
||||
GenericSettings response = connection.sendIqRequestAndWaitForResponse(
|
||||
setting);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1101,7 @@ public class AgentSession {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
MonitorPacket response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
MonitorPacket response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response.isMonitor();
|
||||
}
|
||||
|
||||
|
@ -1109,6 +1111,6 @@ public class AgentSession {
|
|||
request.setTo(workgroupJID);
|
||||
request.setSessionID(sessionID);
|
||||
|
||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class TranscriptManager {
|
|||
public Transcript getTranscript(EntityBareJid workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Transcript request = new Transcript(sessionID);
|
||||
request.setTo(workgroupJID);
|
||||
Transcript response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
Transcript response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class TranscriptManager {
|
|||
public Transcripts getTranscripts(EntityBareJid workgroupJID, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Transcripts request = new Transcripts(userID);
|
||||
request.setTo(workgroupJID);
|
||||
Transcripts response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
Transcripts response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ public class TranscriptSearchManager {
|
|||
search.setType(IQ.Type.get);
|
||||
search.setTo(serviceJID);
|
||||
|
||||
TranscriptSearch response = connection.createStanzaCollectorAndSend(
|
||||
search).nextResultOrThrow();
|
||||
TranscriptSearch response = connection.sendIqRequestAndWaitForResponse(
|
||||
search);
|
||||
return Form.from(response);
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ public class TranscriptSearchManager {
|
|||
search.setTo(serviceJID);
|
||||
search.addExtension(completedForm.getDataFormToSubmit());
|
||||
|
||||
TranscriptSearch response = connection.createStanzaCollectorAndSend(
|
||||
search).nextResultOrThrow();
|
||||
TranscriptSearch response = connection.sendIqRequestAndWaitForResponse(
|
||||
search);
|
||||
return ReportedData.getReportedDataFrom(response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ public class Workgroup {
|
|||
|
||||
JoinQueuePacket joinPacket = new JoinQueuePacket(workgroupJID, answerForm, userID);
|
||||
|
||||
connection.createStanzaCollectorAndSend(joinPacket).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(joinPacket);
|
||||
// Notify listeners that we've joined the queue.
|
||||
fireQueueJoinedEvent();
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ public class Workgroup {
|
|||
}
|
||||
|
||||
DepartQueuePacket departPacket = new DepartQueuePacket(this.workgroupJID);
|
||||
connection.createStanzaCollectorAndSend(departPacket).nextResultOrThrow();
|
||||
connection.sendIqRequestAndWaitForResponse(departPacket);
|
||||
|
||||
// Notify listeners that we're no longer in the queue.
|
||||
fireQueueDepartedEvent();
|
||||
|
@ -657,7 +657,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
ChatSettings response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
ChatSettings response = connection.sendIqRequestAndWaitForResponse(request);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
return connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -714,7 +714,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
return connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -731,7 +731,7 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
return connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -750,8 +750,8 @@ public class Workgroup {
|
|||
request.setType(IQ.Type.get);
|
||||
request.setTo(workgroupJID);
|
||||
|
||||
return connection.createStanzaCollectorAndSend(
|
||||
request).nextResultOrThrow();
|
||||
return connection.sendIqRequestAndWaitForResponse(
|
||||
request);
|
||||
}
|
||||
|
||||
|
||||
|
@ -771,8 +771,8 @@ public class Workgroup {
|
|||
workgroupForm.setType(IQ.Type.get);
|
||||
workgroupForm.setTo(workgroupJID);
|
||||
|
||||
WorkgroupForm response = connection.createStanzaCollectorAndSend(
|
||||
workgroupForm).nextResultOrThrow();
|
||||
WorkgroupForm response = connection.sendIqRequestAndWaitForResponse(
|
||||
workgroupForm);
|
||||
return Form.from(response);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue