mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 00:59:39 +02:00
Merge branch '4.4'
This commit is contained in:
commit
f78eade4da
21 changed files with 270 additions and 147 deletions
|
@ -23,6 +23,7 @@ import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfo;
|
|||
|
||||
/**
|
||||
* Class representing possible SOCKS5 TransportInfo elements.
|
||||
* @see <a href="https://xmpp.org/extensions/xep-0260.html">XEP-0260: Jingle SOCKS5 Bytestreams Transport Method 1.0.3 (2018-05-15)</a>
|
||||
*/
|
||||
public abstract class JingleS5BTransportInfo implements JingleContentTransportInfo {
|
||||
|
||||
|
@ -71,7 +72,7 @@ public abstract class JingleS5BTransportInfo implements JingleContentTransportIn
|
|||
}
|
||||
|
||||
public static final class CandidateActivated extends JingleS5BCandidateTransportInfo {
|
||||
public static final String ELEMENT = "candidate-activated";
|
||||
public static final String ELEMENT = "activated";
|
||||
|
||||
public CandidateActivated(String candidateId) {
|
||||
super(candidateId);
|
||||
|
|
|
@ -28,6 +28,7 @@ import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.Jing
|
|||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
|
|||
case JingleContentTransportCandidate.ELEMENT:
|
||||
cb = JingleS5BTransportCandidate.getBuilder();
|
||||
cb.setCandidateId(parser.getAttributeValue(null, ATTR_CID));
|
||||
cb.setHost(parser.getAttributeValue(null, ATTR_HOST));
|
||||
cb.setHost(ParserUtils.getInternetAddressIngoringZoneIdAttribute(parser, ATTR_HOST));
|
||||
cb.setJid(parser.getAttributeValue(null, ATTR_JID));
|
||||
cb.setPriority(Integer.parseInt(parser.getAttributeValue(null, ATTR_PRIORITY)));
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ public class MultiUserChat {
|
|||
}
|
||||
}
|
||||
|
||||
Destroy destroy = mucUser.getDestroy();
|
||||
Destroy destroy = mucUser == null ? null : mucUser.getDestroy();
|
||||
// The room has been destroyed.
|
||||
if (destroy != null) {
|
||||
EntityBareJid alternateMucJid = destroy.getJid();
|
||||
|
|
|
@ -40,11 +40,10 @@ public class IBBPacketUtils {
|
|||
*/
|
||||
public static IQ createErrorIQ(Jid from, Jid to, StanzaError.Condition condition) {
|
||||
StanzaError xmppError = StanzaError.getBuilder(condition).build();
|
||||
IQ errorIQ = new ErrorIQ(xmppError);
|
||||
errorIQ.setType(IQ.Type.error);
|
||||
errorIQ.setFrom(from);
|
||||
errorIQ.setTo(to);
|
||||
return errorIQ;
|
||||
return ErrorIQ.builder(xmppError)
|
||||
.from(from)
|
||||
.to(to)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,12 +38,11 @@ import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.NetworkUtil;
|
||||
import org.jivesoftware.smack.util.ExceptionUtil;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
|
@ -415,10 +414,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
Verification.requestTypeGET);
|
||||
|
||||
// build error packet to reject SOCKS5 Bytestream
|
||||
StanzaError stanzaError = StanzaError.getBuilder(StanzaError.Condition.not_acceptable).build();
|
||||
IQ rejectPacket = new ErrorIQ(stanzaError);
|
||||
rejectPacket.setFrom(targetJID);
|
||||
rejectPacket.setTo(initiatorJID);
|
||||
IQ rejectPacket = IBBPacketUtils.createErrorIQ(targetJID, initiatorJID, StanzaError.Condition.not_acceptable);
|
||||
|
||||
// return error packet as response to the bytestream initiation
|
||||
protocol.addResponse(rejectPacket, Verification.correspondingSenderReceiver,
|
||||
|
|
|
@ -30,11 +30,10 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.EmptyResultIQ;
|
||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.util.CloseableUtil;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||
|
||||
|
@ -184,9 +183,7 @@ public class Socks5ClientForInitiatorTest {
|
|||
XMPPConnection connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);
|
||||
|
||||
// build error response as reply to the stream activation
|
||||
IQ error = new ErrorIQ(StanzaError.getBuilder(StanzaError.Condition.internal_server_error).build());
|
||||
error.setFrom(proxyJID);
|
||||
error.setTo(initiatorJID);
|
||||
IQ error = IBBPacketUtils.createErrorIQ(proxyJID, initiatorJID, StanzaError.Condition.internal_server_error);
|
||||
|
||||
protocol.addResponse(error, Verification.correspondingSenderReceiver,
|
||||
Verification.requestTypeSET);
|
||||
|
|
|
@ -164,7 +164,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
|
||||
String candidateActivated =
|
||||
"<transport xmlns='urn:xmpp:jingle:transports:s5b:1' sid='vj3hs98y'>" +
|
||||
"<candidate-activated cid='hr65dqyd'/>" +
|
||||
"<activated cid='hr65dqyd'/>" +
|
||||
"</transport>";
|
||||
JingleS5BTransport candidateActivatedTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(candidateActivated));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue