mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-15 03:59:38 +02:00
Heavy reworking in progress
This commit is contained in:
parent
7658369d63
commit
6818a52da7
108 changed files with 2117 additions and 1229 deletions
|
@ -37,9 +37,9 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
|||
import org.jivesoftware.smackx.jet.element.JetSecurityElement;
|
||||
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||
import org.jivesoftware.smackx.jingle.JingleUtil;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.OutgoingJingleFileOffer;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||
|
@ -150,15 +150,15 @@ public final class JetManager extends Manager {
|
|||
JingleFileTransferChild fileTransferChild = JingleFileTransferChild.getBuilder().setFile(file).build();
|
||||
JingleFileTransfer fileTransfer = new JingleFileTransfer(Collections.<JingleContentDescriptionChildElement>singletonList(fileTransferChild));
|
||||
|
||||
JingleContent content = JingleContent.getBuilder()
|
||||
.setCreator(JingleContent.Creator.initiator)
|
||||
JingleContentElement content = JingleContentElement.getBuilder()
|
||||
.setCreator(JingleContentElement.Creator.initiator)
|
||||
.setName(contentName)
|
||||
.setTransport(offer.getTransportSession().createTransport())
|
||||
.setSecurity(securityElement)
|
||||
.setDescription(fileTransfer)
|
||||
.build();
|
||||
|
||||
Jingle initiate = jutil.createSessionInitiate(recipient, JingleManager.randomId(), content);
|
||||
JingleElement initiate = jutil.createSessionInitiate(recipient, JingleManager.randomId(), content);
|
||||
return offer;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jet.element;
|
|||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
import org.jivesoftware.smackx.jet.JetManager;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentSecurity;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement;
|
||||
|
||||
/**
|
||||
* Implementation of the Jingle security element as specified in XEP-XXXX (Jingle Encrypted Transfers).
|
||||
|
@ -31,7 +31,7 @@ import org.jivesoftware.smackx.jingle.element.JingleContentSecurity;
|
|||
* </content>
|
||||
* </jingle>
|
||||
*/
|
||||
public class JetSecurityElement extends JingleContentSecurity {
|
||||
public class JetSecurityElement extends JingleContentSecurityElement {
|
||||
public static final String ATTR_NAME = "name";
|
||||
public static final String ATTR_TYPE = "type";
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
|||
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||
import org.jivesoftware.smackx.jingle.JingleTransportMethodManager;
|
||||
import org.jivesoftware.smackx.jingle.Role;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleReason;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
|
||||
import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback;
|
||||
import org.jivesoftware.smackx.jingle.transports.JingleTransportManager;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback;
|
||||
|
@ -45,7 +45,7 @@ import org.jxmpp.jid.FullJid;
|
|||
*/
|
||||
public class IncomingJingleFileOffer extends JingleFileTransferSession implements IncomingFileOfferCallback {
|
||||
private static final Logger LOGGER = Logger.getLogger(IncomingJingleFileOffer.class.getName());
|
||||
private Jingle pendingSessionInitiate = null;
|
||||
private JingleElement pendingSessionInitiate = null;
|
||||
private ReceiveTask receivingThread;
|
||||
private File target;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
|||
queued.remove(task);
|
||||
}
|
||||
|
||||
notifyEndedListeners(JingleReason.Reason.cancel);
|
||||
notifyEndedListeners(JingleReasonElement.Reason.cancel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,12 +77,12 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
|||
state = State.fresh;
|
||||
}
|
||||
|
||||
public IncomingJingleFileOffer(XMPPConnection connection, Jingle request) {
|
||||
public IncomingJingleFileOffer(XMPPConnection connection, JingleElement request) {
|
||||
this(connection, request.getInitiator(), request.getSid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IQ handleSessionInitiate(final Jingle initiate)
|
||||
public IQ handleSessionInitiate(final JingleElement initiate)
|
||||
throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException,
|
||||
SmackException.NoResponseException {
|
||||
JingleTransportMethodManager tm = JingleTransportMethodManager.getInstanceFor(connection);
|
||||
|
@ -130,7 +130,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public IQ handleTransportReplace(final Jingle transportReplace)
|
||||
public IQ handleTransportReplace(final JingleElement transportReplace)
|
||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
final JingleTransportManager<?> replacementManager = JingleTransportMethodManager.getInstanceFor(connection)
|
||||
|
@ -179,7 +179,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public IQ handleTransportAccept(Jingle transportAccept) {
|
||||
public IQ handleTransportAccept(JingleElement transportAccept) {
|
||||
LOGGER.log(Level.INFO, "Received transport-accept.");
|
||||
if (state != State.sent_transport_replace) {
|
||||
LOGGER.log(Level.WARNING, "Session is in state " + state + ", so the transport-accept is out of order.");
|
||||
|
@ -199,7 +199,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public FileTransferHandler acceptIncomingFileOffer(final Jingle request, final File target) {
|
||||
public FileTransferHandler acceptIncomingFileOffer(final JingleElement request, final File target) {
|
||||
this.target = target;
|
||||
LOGGER.log(Level.INFO, "Client accepted incoming file offer. Try to start receiving.");
|
||||
if (transportSession == null) {
|
||||
|
@ -218,7 +218,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
|||
|
||||
try {
|
||||
jutil.sendSessionAccept(getInitiator(), sid, getContents().get(0).getCreator(),
|
||||
getContents().get(0).getName(), JingleContent.Senders.initiator, file,
|
||||
getContents().get(0).getName(), JingleContentElement.Senders.initiator, file,
|
||||
transportSession.createTransport());
|
||||
} catch (SmackException.NotConnectedException | SmackException.NoResponseException |
|
||||
XMPPException.XMPPErrorException | InterruptedException e) {
|
||||
|
@ -245,7 +245,7 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void declineIncomingFileOffer(Jingle request) {
|
||||
public void declineIncomingFileOffer(JingleElement request) {
|
||||
state = State.terminated;
|
||||
try {
|
||||
jutil.sendSessionTerminateDecline(request.getInitiator(), request.getSid());
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingle_filetransfer;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||
import org.jivesoftware.smackx.jingle.Role;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
|
||||
import org.jxmpp.jid.FullJid;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class JingleFileRequest extends JingleFileTransferSession {
|
|||
JingleManager.randomId());
|
||||
}
|
||||
|
||||
public static JingleFileRequest createIncomingFileRequest(XMPPConnection connection, Jingle request) {
|
||||
public static JingleFileRequest createIncomingFileRequest(XMPPConnection connection, JingleElement request) {
|
||||
return new JingleFileRequest(connection, request.getInitiator(), connection.getUser().asFullJidOrThrow(), Role.responder,
|
||||
request.getSid());
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
|||
import org.jivesoftware.smackx.jingle.JingleHandler;
|
||||
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||
import org.jivesoftware.smackx.jingle.JingleUtil;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleAction;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle3.provider.JingleContentProviderManager;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||
|
@ -85,7 +85,7 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
|||
}
|
||||
|
||||
@Override
|
||||
public IQ handleJingleRequest(Jingle jingle) {
|
||||
public IQ handleJingleRequest(JingleElement jingle) {
|
||||
FullJid fullJid = jingle.getFrom().asFullJidOrThrow();
|
||||
String sid = jingle.getSid();
|
||||
|
||||
|
@ -107,18 +107,18 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
|||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private JingleFileTransferSession createSessionHandler(Jingle request) {
|
||||
private JingleFileTransferSession createSessionHandler(JingleElement request) {
|
||||
if (request.getAction() != JingleAction.session_initiate) {
|
||||
LOGGER.log(Level.WARNING, "First received action must be session-initiate.");
|
||||
throw new IllegalArgumentException("Requests action MUST be session-initiate.");
|
||||
}
|
||||
|
||||
JingleContent content = request.getContents().get(0);
|
||||
JingleContentElement content = request.getContents().get(0);
|
||||
//File Offer
|
||||
if (content.getSenders() == JingleContent.Senders.initiator) {
|
||||
if (content.getSenders() == JingleContentElement.Senders.initiator) {
|
||||
return new IncomingJingleFileOffer(connection(), request);
|
||||
} //File Request
|
||||
else if (content.getSenders() == JingleContent.Senders.responder) {
|
||||
else if (content.getSenders() == JingleContentElement.Senders.responder) {
|
||||
return JingleFileRequest.createIncomingFileRequest(connection(), request);
|
||||
}
|
||||
else {
|
||||
|
@ -129,7 +129,7 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
|||
}
|
||||
}
|
||||
|
||||
public void notifyIncomingFileOffer(Jingle initiate, IncomingFileOfferCallback callback) {
|
||||
public void notifyIncomingFileOffer(JingleElement initiate, IncomingFileOfferCallback callback) {
|
||||
for (JingleFileTransferOfferListener l : jingleFileTransferOfferListeners) {
|
||||
l.onFileOffer(initiate, callback);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smackx.jingle.JingleSession;
|
||||
import org.jivesoftware.smackx.jingle.JingleUtil;
|
||||
import org.jivesoftware.smackx.jingle.Role;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleReason;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler;
|
||||
|
||||
|
@ -99,7 +99,7 @@ public abstract class JingleFileTransferSession extends JingleSession implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void notifyEndedListeners(JingleReason.Reason reason) {
|
||||
public void notifyEndedListeners(JingleReasonElement.Reason reason) {
|
||||
ended = true;
|
||||
for (EndedListener e : endedListeners) {
|
||||
e.onEnded(reason);
|
||||
|
|
|
@ -31,9 +31,9 @@ import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
|||
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||
import org.jivesoftware.smackx.jingle.JingleTransportMethodManager;
|
||||
import org.jivesoftware.smackx.jingle.Role;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleReason;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
|
||||
import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback;
|
||||
import org.jivesoftware.smackx.jingle.transports.JingleTransportManager;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
|
@ -65,7 +65,7 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
|||
}
|
||||
|
||||
jutil.sendSessionTerminateCancel(getRemote(), getSessionId());
|
||||
notifyEndedListeners(JingleReason.Reason.cancel);
|
||||
notifyEndedListeners(JingleReasonElement.Reason.cancel);
|
||||
}
|
||||
|
||||
public enum State {
|
||||
|
@ -96,7 +96,7 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
|||
String contentName = JingleManager.randomId();
|
||||
JingleFileTransfer transfer = JingleFileTransferManager.fileTransferFromFile(file);
|
||||
|
||||
initiateFileOffer(transfer, JingleContent.Creator.initiator, contentName);
|
||||
initiateFileOffer(transfer, JingleContentElement.Creator.initiator, contentName);
|
||||
}
|
||||
|
||||
public SmackFuture<?> sendAsync(File file) {
|
||||
|
@ -106,7 +106,7 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
|||
return null; //TODO
|
||||
}
|
||||
|
||||
public void initiateFileOffer(JingleFileTransfer file, JingleContent.Creator creator, String name) throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
public void initiateFileOffer(JingleFileTransfer file, JingleContentElement.Creator creator, String name) throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
if (state != State.fresh) {
|
||||
throw new IllegalStateException("This session is not fresh.");
|
||||
}
|
||||
|
@ -122,14 +122,14 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
|||
|
||||
state = State.pending;
|
||||
|
||||
Jingle initiate = jutil.createSessionInitiateFileOffer(getResponder(), getSessionId(), creator, name, file, transportSession.createTransport(), null);
|
||||
JingleElement initiate = jutil.createSessionInitiateFileOffer(getResponder(), getSessionId(), creator, name, file, transportSession.createTransport(), null);
|
||||
this.contents.addAll(initiate.getContents());
|
||||
|
||||
connection.sendStanza(initiate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IQ handleSessionAccept(Jingle sessionAccept) throws SmackException.NotConnectedException, InterruptedException {
|
||||
public IQ handleSessionAccept(JingleElement sessionAccept) throws SmackException.NotConnectedException, InterruptedException {
|
||||
// Out of order?
|
||||
if (state != State.pending) {
|
||||
LOGGER.log(Level.WARNING, "Session state is " + state + ", so session-accept is out of order.");
|
||||
|
@ -158,13 +158,13 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IQ handleSessionTerminate(Jingle sessionTerminate) {
|
||||
public IQ handleSessionTerminate(JingleElement sessionTerminate) {
|
||||
state = State.terminated;
|
||||
return jutil.createAck(sessionTerminate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IQ handleTransportReplace(final Jingle transportReplace)
|
||||
public IQ handleTransportReplace(final JingleElement transportReplace)
|
||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
final JingleTransportManager<?> replacementManager = JingleTransportMethodManager.getInstanceFor(connection)
|
||||
|
@ -196,7 +196,7 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IQ handleTransportAccept(Jingle transportAccept)
|
||||
public IQ handleTransportAccept(JingleElement transportAccept)
|
||||
throws SmackException.NotConnectedException, InterruptedException {
|
||||
|
||||
return handleSessionAccept(transportAccept);
|
||||
|
@ -205,7 +205,7 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
|||
@Override
|
||||
public void onTransportMethodFailed(String namespace) {
|
||||
state = State.pending;
|
||||
JingleContent content = contents.get(0);
|
||||
JingleContentElement content = contents.get(0);
|
||||
failedTransportMethods.add(namespace);
|
||||
JingleTransportMethodManager tm = JingleTransportMethodManager.getInstanceFor(getConnection());
|
||||
JingleTransportManager<?> next = tm.getBestAvailableTransportManager(failedTransportMethods);
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleReason;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class ReceiveTask implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
session.notifyEndedListeners(JingleReason.Reason.success);
|
||||
session.notifyEndedListeners(JingleReasonElement.Reason.success);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleReason;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 21.06.17.
|
||||
|
@ -78,7 +78,7 @@ public class SendTask implements Runnable {
|
|||
LOGGER.log(Level.SEVERE, "Could not close session.", e);
|
||||
}
|
||||
|
||||
session.notifyEndedListeners(JingleReason.Reason.success);
|
||||
session.notifyEndedListeners(JingleReasonElement.Reason.success);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.callback;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler;
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler;
|
|||
*/
|
||||
public interface IncomingFileOfferCallback {
|
||||
|
||||
FileTransferHandler acceptIncomingFileOffer(Jingle request, File target);
|
||||
FileTransferHandler acceptIncomingFileOffer(JingleElement request, File target);
|
||||
|
||||
void declineIncomingFileOffer(Jingle request);
|
||||
void declineIncomingFileOffer(JingleElement request);
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ package org.jivesoftware.smackx.jingle_filetransfer.callback;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
|
||||
/**
|
||||
* Callback used to accept/decline file requests.
|
||||
*/
|
||||
public interface IncomingFileRequestCallback {
|
||||
|
||||
void acceptIncomingFileRequest(Jingle request, File source);
|
||||
void acceptIncomingFileRequest(JingleElement request, File source);
|
||||
|
||||
void declineIncomingFileRequest(Jingle request);
|
||||
void declineIncomingFileRequest(JingleElement request);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.element;
|
|||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
|
||||
/**
|
||||
* Checksum element.
|
||||
|
@ -29,11 +29,11 @@ public class Checksum implements ExtensionElement {
|
|||
public static final String ATTR_CREATOR = "creator";
|
||||
public static final String ATTR_NAME = "name";
|
||||
|
||||
private final JingleContent.Creator creator;
|
||||
private final JingleContentElement.Creator creator;
|
||||
private final String name;
|
||||
private final JingleFileTransferChild file;
|
||||
|
||||
public Checksum(JingleContent.Creator creator, String name, JingleFileTransferChild file) {
|
||||
public Checksum(JingleContentElement.Creator creator, String name, JingleFileTransferChild file) {
|
||||
this.creator = creator;
|
||||
this.name = name;
|
||||
this.file = Objects.requireNonNull(file, "file MUST NOT be null.");
|
||||
|
|
|
@ -18,13 +18,13 @@ package org.jivesoftware.smackx.jingle_filetransfer.element;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
|
||||
|
||||
/**
|
||||
* File element.
|
||||
*/
|
||||
public class JingleFileTransfer extends JingleContentDescription {
|
||||
public class JingleFileTransfer extends JingleContentDescriptionElement {
|
||||
public static final String NAMESPACE_V5 = "urn:xmpp:jingle:apps:file-transfer:5";
|
||||
|
||||
public JingleFileTransfer(List<JingleContentDescriptionChildElement> payloads) {
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Date;
|
|||
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
|
||||
|
||||
/**
|
||||
* Content of type File.
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.handler;
|
|||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleReason;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
|
||||
|
||||
/**
|
||||
* Handler that provides some control over the JingleFileOffer session.
|
||||
|
@ -57,7 +57,7 @@ public interface FileTransferHandler {
|
|||
/**
|
||||
* Notify all registered FinishedListeners that the file transfer has ended.
|
||||
*/
|
||||
void notifyEndedListeners(JingleReason.Reason reason);
|
||||
void notifyEndedListeners(JingleReasonElement.Reason reason);
|
||||
|
||||
/**
|
||||
* Notify all registered AcceptedListeners that the file transfer session has been accepted by the remote user.
|
||||
|
@ -68,7 +68,7 @@ public interface FileTransferHandler {
|
|||
* A FinishedListener will be notified by the SendFileHandler when the corresponding file transfer is ended.
|
||||
*/
|
||||
interface EndedListener {
|
||||
void onEnded(JingleReason.Reason reason);
|
||||
void onEnded(JingleReasonElement.Reason reason);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jingle_filetransfer.listener;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback;
|
||||
|
||||
/**
|
||||
|
@ -24,5 +24,5 @@ import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCal
|
|||
*/
|
||||
public interface JingleFileTransferOfferListener {
|
||||
|
||||
void onFileOffer(Jingle request, IncomingFileOfferCallback callback);
|
||||
void onFileOffer(JingleElement request, IncomingFileOfferCallback callback);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
|||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.Checksum;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;
|
||||
|
@ -36,10 +36,10 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
public class ChecksumProvider extends ExtensionElementProvider<Checksum> {
|
||||
@Override
|
||||
public Checksum parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||
JingleContent.Creator creator = null;
|
||||
JingleContentElement.Creator creator = null;
|
||||
String creatorString = parser.getAttributeValue(null, Checksum.ATTR_CREATOR);
|
||||
if (creatorString != null) {
|
||||
creator = JingleContent.Creator.valueOf(creatorString);
|
||||
creator = JingleContentElement.Creator.valueOf(creatorString);
|
||||
}
|
||||
String name = parser.getAttributeValue(null, Checksum.ATTR_NAME);
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ import java.util.ArrayList;
|
|||
import org.jivesoftware.smack.util.ParserUtils;
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle3.provider.JingleContentDescriptionProvider;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.test.util.SmackTestSuite;
|
|||
import org.jivesoftware.smack.test.util.TestUtils;
|
||||
import org.jivesoftware.smackx.hashes.HashManager;
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.Checksum;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;
|
||||
|
@ -39,7 +39,7 @@ public class ChecksumTest extends SmackTestSuite {
|
|||
public void parserTest() throws Exception {
|
||||
HashElement hash = new HashElement(HashManager.ALGORITHM.SHA_256, "f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=");
|
||||
JingleFileTransferChild file = new JingleFileTransferChild(null, null, hash, null, null, -1, null);
|
||||
Checksum checksum = new Checksum(JingleContent.Creator.initiator, "name", file);
|
||||
Checksum checksum = new Checksum(JingleContentElement.Creator.initiator, "name", file);
|
||||
|
||||
String xml = "<checksum xmlns='urn:xmpp:jingle:apps:file-transfer:5' creator='initiator' name='name'>" +
|
||||
"<file>" +
|
||||
|
@ -52,7 +52,7 @@ public class ChecksumTest extends SmackTestSuite {
|
|||
|
||||
Range range = new Range(12L,34L);
|
||||
file = new JingleFileTransferChild(null, null, hash, null, null, -1, range);
|
||||
checksum = new Checksum(JingleContent.Creator.initiator, "name", file);
|
||||
checksum = new Checksum(JingleContentElement.Creator.initiator, "name", file);
|
||||
|
||||
xml = "<checksum xmlns='urn:xmpp:jingle:apps:file-transfer:5' creator='initiator' name='name'>" +
|
||||
"<file>" +
|
||||
|
|
|
@ -32,10 +32,10 @@ import org.jivesoftware.smackx.hashes.element.HashElement;
|
|||
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||
import org.jivesoftware.smackx.jingle.JingleUtil;
|
||||
import org.jivesoftware.smackx.jingle.JingleUtilTest;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleElement;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleAction;
|
||||
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
|
||||
|
@ -80,9 +80,9 @@ public class JingleUtilFileTransferTest extends SmackTestSuite {
|
|||
|
||||
String contentName = "content";
|
||||
|
||||
Jingle initiate = jutil.createSessionInitiate(juliet, "letsstart", JingleContent.Creator.initiator, contentName, JingleContent.Senders.initiator, description, transport);
|
||||
Jingle accept = jutil.createSessionAccept(juliet, "acceptID", JingleContent.Creator.initiator, contentName, JingleContent.Senders.initiator, description, transport);
|
||||
Jingle fileOffer = jutil.createSessionInitiateFileOffer(juliet, "fileOffer", JingleContent.Creator.initiator, contentName, description, transport);
|
||||
JingleElement initiate = jutil.createSessionInitiate(juliet, "letsstart", JingleContentElement.Creator.initiator, contentName, JingleContentElement.Senders.initiator, description, transport);
|
||||
JingleElement accept = jutil.createSessionAccept(juliet, "acceptID", JingleContentElement.Creator.initiator, contentName, JingleContentElement.Senders.initiator, description, transport);
|
||||
JingleElement fileOffer = jutil.createSessionInitiateFileOffer(juliet, "fileOffer", JingleContentElement.Creator.initiator, contentName, description, transport);
|
||||
|
||||
assertEquals(JingleAction.session_initiate, initiate.getAction());
|
||||
assertEquals(JingleAction.session_accept, accept.getAction());
|
||||
|
@ -99,13 +99,13 @@ public class JingleUtilFileTransferTest extends SmackTestSuite {
|
|||
assertEquals(1, initiate.getContents().size());
|
||||
assertEquals(1, accept.getContents().size());
|
||||
|
||||
JingleContent content = initiate.getContents().get(0);
|
||||
JingleContentElement content = initiate.getContents().get(0);
|
||||
assertEquals(content.toXML().toString(), initiate.getContents().get(0).toXML().toString());
|
||||
assertEquals(content.toXML().toString(), accept.getContents().get(0).toXML().toString());
|
||||
|
||||
assertEquals("content", content.getName());
|
||||
assertEquals(JingleContent.Creator.initiator, content.getCreator());
|
||||
assertEquals(JingleContent.Senders.initiator, content.getSenders());
|
||||
assertEquals(JingleContentElement.Creator.initiator, content.getCreator());
|
||||
assertEquals(JingleContentElement.Senders.initiator, content.getSenders());
|
||||
|
||||
assertEquals(1, description.getJingleContentDescriptionChildren().size());
|
||||
assertEquals(file, description.getJingleContentDescriptionChildren().get(0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue