mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Merge fixes (wip)
This commit is contained in:
commit
efdf6d7db8
11 changed files with 25 additions and 31 deletions
|
@ -32,7 +32,7 @@ import org.jivesoftware.smackx.jingle.JingleSessionHandler;
|
||||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
import org.jivesoftware.smackx.jingle.element.JingleAction;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionPayloadElement;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||||
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
|
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingJingleFileTransferCallback;
|
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingJingleFileTransferCallback;
|
||||||
|
@ -131,7 +131,7 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
||||||
JingleFileTransferPayloadElement payload = new JingleFileTransferPayloadElement(
|
JingleFileTransferPayloadElement payload = new JingleFileTransferPayloadElement(
|
||||||
lastModified, "A file", hashElement,
|
lastModified, "A file", hashElement,
|
||||||
"application/octet-stream", file.getName(), (int) file.length(), null);
|
"application/octet-stream", file.getName(), (int) file.length(), null);
|
||||||
ArrayList<JingleContentDescriptionPayloadElement> payloadTypes = new ArrayList<>();
|
ArrayList<JingleContentDescriptionChildElement> payloadTypes = new ArrayList<>();
|
||||||
payloadTypes.add(payload);
|
payloadTypes.add(payload);
|
||||||
|
|
||||||
JingleContentDescriptionFileTransfer descriptionFileTransfer = new JingleContentDescriptionFileTransfer(payloadTypes);
|
JingleContentDescriptionFileTransfer descriptionFileTransfer = new JingleContentDescriptionFileTransfer(payloadTypes);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.jivesoftware.smackx.jingle_filetransfer.element;
|
package org.jivesoftware.smackx.jingle_filetransfer.element;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionPayloadElement;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.JingleFileTransferManager;
|
import org.jivesoftware.smackx.jingle_filetransfer.JingleFileTransferManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -27,7 +27,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class JingleContentDescriptionFileTransfer extends JingleContentDescription {
|
public class JingleContentDescriptionFileTransfer extends JingleContentDescription {
|
||||||
|
|
||||||
public JingleContentDescriptionFileTransfer(List<JingleContentDescriptionPayloadElement> payloadTypes) {
|
public JingleContentDescriptionFileTransfer(List<JingleContentDescriptionChildElement> payloadTypes) {
|
||||||
super(payloadTypes);
|
super(payloadTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jivesoftware.smackx.hash.element.HashElement;
|
import org.jivesoftware.smackx.hash.element.HashElement;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionPayloadElement;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -26,7 +26,7 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* Content of type File.
|
* Content of type File.
|
||||||
*/
|
*/
|
||||||
public class JingleFileTransferPayloadElement extends JingleContentDescriptionPayloadElement {
|
public class JingleFileTransferPayloadElement extends JingleContentDescriptionChildElement {
|
||||||
public static final String ELEMENT = "file";
|
public static final String ELEMENT = "file";
|
||||||
public static final String ELEM_DATE = "date";
|
public static final String ELEM_DATE = "date";
|
||||||
public static final String ELEM_DESC = "desc";
|
public static final String ELEM_DESC = "desc";
|
||||||
|
@ -107,11 +107,6 @@ public class JingleFileTransferPayloadElement extends JingleContentDescriptionPa
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNamespace() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private Date date;
|
private Date date;
|
||||||
private String desc;
|
private String desc;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle_filetransfer.provider;
|
package org.jivesoftware.smackx.jingle_filetransfer.provider;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionPayloadElement;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||||
import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider;
|
import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleContentDescriptionFileTransfer;
|
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleContentDescriptionFileTransfer;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferPayloadElement;
|
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferPayloadElement;
|
||||||
|
@ -34,7 +34,7 @@ public class JingleContentDescriptionFileTransferProvider
|
||||||
extends JingleContentDescriptionProvider<JingleContentDescriptionFileTransfer> {
|
extends JingleContentDescriptionProvider<JingleContentDescriptionFileTransfer> {
|
||||||
@Override
|
@Override
|
||||||
public JingleContentDescriptionFileTransfer parse(XmlPullParser parser, int initialDepth) throws Exception {
|
public JingleContentDescriptionFileTransfer parse(XmlPullParser parser, int initialDepth) throws Exception {
|
||||||
ArrayList<JingleContentDescriptionPayloadElement> payloads = new ArrayList<>();
|
ArrayList<JingleContentDescriptionChildElement> payloads = new ArrayList<>();
|
||||||
while (true) {
|
while (true) {
|
||||||
int tag = parser.nextTag();
|
int tag = parser.nextTag();
|
||||||
String name = parser.getName();
|
String name = parser.getName();
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.jivesoftware.smack.test.util.TestUtils;
|
||||||
import org.jivesoftware.smackx.hash.HashManager;
|
import org.jivesoftware.smackx.hash.HashManager;
|
||||||
import org.jivesoftware.smackx.hash.element.HashElement;
|
import org.jivesoftware.smackx.hash.element.HashElement;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionPayloadElement;
|
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferPayloadElement;
|
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferPayloadElement;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleContentDescriptionFileTransfer;
|
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleContentDescriptionFileTransfer;
|
||||||
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;
|
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;
|
||||||
|
|
|
@ -16,15 +16,10 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle;
|
package org.jivesoftware.smackx.jingle;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.WeakHashMap;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.Manager;
|
import org.jivesoftware.smack.Manager;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
|
||||||
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
|
||||||
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.IQ.Type;
|
import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||||
|
@ -33,6 +28,11 @@ import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||||
import org.jxmpp.jid.FullJid;
|
import org.jxmpp.jid.FullJid;
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public final class JingleManager extends Manager {
|
public final class JingleManager extends Manager {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(JingleManager.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(JingleManager.class.getName());
|
||||||
|
@ -102,7 +102,7 @@ public final class JingleManager extends Manager {
|
||||||
return jingleSessionHandlers.put(fullJidAndSessionId, sessionHandler);
|
return jingleSessionHandlers.put(fullJidAndSessionId, sessionHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JingleSessionHandler unregisterJingleSessionhandler(FullJid otherJid, String sessionId, JingleSessionHandler sessionHandler) {
|
public JingleSessionHandler unregisterJingleSessionHandler(FullJid otherJid, String sessionId, JingleSessionHandler sessionHandler) {
|
||||||
FullJidAndSessionId fullJidAndSessionId = new FullJidAndSessionId(otherJid, sessionId);
|
FullJidAndSessionId fullJidAndSessionId = new FullJidAndSessionId(otherJid, sessionId);
|
||||||
return jingleSessionHandlers.remove(fullJidAndSessionId);
|
return jingleSessionHandlers.remove(fullJidAndSessionId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,9 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "description";
|
public static final String ELEMENT = "description";
|
||||||
|
|
||||||
private final List<JingleContentDescriptionPayloadElement> payloads;
|
private final List<JingleContentDescriptionChildElement> payloads;
|
||||||
|
|
||||||
protected JingleContentDescription(List<JingleContentDescriptionPayloadElement> payloads) {
|
protected JingleContentDescription(List<JingleContentDescriptionChildElement> payloads) {
|
||||||
if (payloads != null) {
|
if (payloads != null) {
|
||||||
this.payloads = Collections.unmodifiableList(payloads);
|
this.payloads = Collections.unmodifiableList(payloads);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
return ELEMENT;
|
return ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JingleContentDescriptionPayloadElement> getJinglePayloadTypes() {
|
public List<JingleContentDescriptionChildElement> getJinglePayloadTypes() {
|
||||||
return payloads;
|
return payloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.element;
|
package org.jivesoftware.smackx.jingle.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An element found usually in 'description' elements.
|
* An element found usually in 'description' elements.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentDescriptionPayloadElement implements ExtensionElement {
|
public abstract class JingleContentDescriptionChildElement implements NamedElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "payload-type";
|
public static final String ELEMENT = "payload-type";
|
||||||
|
|
|
@ -63,12 +63,12 @@ public abstract class JingleContentTransport implements ExtensionElement {
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
xml.append(candidates);
|
xml.append(candidates);
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public final class JingleError implements ExtensionElement {
|
||||||
/**
|
/**
|
||||||
* Creates a new error with the specified code and errorName.
|
* Creates a new error with the specified code and errorName.
|
||||||
*
|
*
|
||||||
* @param errorName name describing the error.
|
* @param errorName a name describing the error.
|
||||||
*/
|
*/
|
||||||
private JingleError(final String errorName) {
|
private JingleError(final String errorName) {
|
||||||
this.errorName = errorName;
|
this.errorName = errorName;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class JingleContentProviderManager {
|
||||||
private static final Map<String, JingleContentTransportProvider<?>> jingleContentTransportProviders = new ConcurrentHashMap<>();
|
private static final Map<String, JingleContentTransportProvider<?>> jingleContentTransportProviders = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static JingleContentDescriptionProvider<?> addJingleContentDescriptionProvider(String namespace,
|
public static JingleContentDescriptionProvider<?> addJingleContentDescriptionProvider(String namespace,
|
||||||
JingleContentDescriptionProvider<?> provider) {
|
JingleContentDescriptionProvider<?> provider) {
|
||||||
return jingleContentDescriptionProviders.put(namespace, provider);
|
return jingleContentDescriptionProviders.put(namespace, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class JingleContentProviderManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JingleContentTransportProvider<?> addJingleContentTransportProvider(String namespace,
|
public static JingleContentTransportProvider<?> addJingleContentTransportProvider(String namespace,
|
||||||
JingleContentTransportProvider<?> provider) {
|
JingleContentTransportProvider<?> provider) {
|
||||||
return jingleContentTransportProviders.put(namespace, provider);
|
return jingleContentTransportProviders.put(namespace, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue