mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Fix typos and xml issues
This commit is contained in:
parent
f5ef42ec56
commit
23190604bd
11 changed files with 26 additions and 18 deletions
|
@ -21,6 +21,6 @@ import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||||
|
|
||||||
public interface JingleHandler {
|
public interface JingleHandler {
|
||||||
|
|
||||||
IQ handleRequest(Jingle jingle);
|
IQ handleJingleRequest(Jingle jingle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ 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;
|
||||||
|
@ -72,7 +72,7 @@ public final class JingleManager extends Manager {
|
||||||
// TODO handle non existing jingle session handler.
|
// TODO handle non existing jingle session handler.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return jingleSessionHandler.handleRequest(jingle, sid);
|
return jingleSessionHandler.handleJingleSessionRequest(jingle, sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jingle.getContents().size() > 1) {
|
if (jingle.getContents().size() > 1) {
|
||||||
|
@ -88,7 +88,7 @@ public final class JingleManager extends Manager {
|
||||||
// TODO handle non existing content description handler.
|
// TODO handle non existing content description handler.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return jingleDescriptionHandler.handleRequest(jingle);
|
return jingleDescriptionHandler.handleJingleRequest(jingle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,6 @@ import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||||
|
|
||||||
public interface JingleSessionHandler {
|
public interface JingleSessionHandler {
|
||||||
|
|
||||||
IQ handleRequest(Jingle jingle, String sessionId);
|
IQ handleJingleSessionRequest(Jingle jingle, String sessionId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ public final class Jingle extends IQ {
|
||||||
else {
|
else {
|
||||||
this.contents = Collections.emptyList();
|
this.contents = Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
setType(Type.set);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -140,7 +140,7 @@ public final class JingleContent implements NamedElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML() {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute(CREATOR_ATTRIBUTE_NAME, creator);
|
xml.attribute(CREATOR_ATTRIBUTE_NAME, creator);
|
||||||
xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition);
|
xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition);
|
||||||
xml.attribute(NAME_ATTRIBUTE_NAME, name);
|
xml.attribute(NAME_ATTRIBUTE_NAME, name);
|
||||||
|
|
|
@ -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<JingleContentDescriptionPayloadType> payloads;
|
private final List<JingleContentDescriptionChildElement> payloads;
|
||||||
|
|
||||||
protected JingleContentDescription(List<JingleContentDescriptionPayloadType> 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<JingleContentDescriptionPayloadType> getJinglePayloadTypes() {
|
public List<JingleContentDescriptionChildElement> getJingleContentDescriptionChildren() {
|
||||||
return payloads;
|
return payloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
|
|
||||||
xml.append(payloads);
|
xml.append(payloads);
|
||||||
|
|
||||||
|
xml.closeElement(this);
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.packet.NamedElement;
|
||||||
* An element found usually in 'description' elements.
|
* An element found usually in 'description' elements.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentDescriptionPayloadType implements NamedElement {
|
public abstract class JingleContentDescriptionChildElement implements NamedElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "payload-type";
|
public static final String ELEMENT = "payload-type";
|
||||||
|
|
|
@ -58,11 +58,17 @@ public abstract class JingleContentTransport implements ExtensionElement {
|
||||||
public final XmlStringBuilder toXML() {
|
public final XmlStringBuilder toXML() {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
addExtraAttributes(xml);
|
addExtraAttributes(xml);
|
||||||
|
|
||||||
|
if (candidates.isEmpty()) {
|
||||||
|
xml.closeEmptyElement();
|
||||||
|
|
||||||
|
} 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 message a message 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;
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class JingleReason implements NamedElement {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
xml.emptyElement(reason);
|
xml.emptyElement(reason.asString);
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
@ -25,7 +25,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<?> addJingleContentDescrptionProvider(String namespace,
|
public static JingleContentDescriptionProvider<?> addJingleContentDescriptionProvider(String namespace,
|
||||||
JingleContentDescriptionProvider<?> provider) {
|
JingleContentDescriptionProvider<?> provider) {
|
||||||
return jingleContentDescriptionProviders.put(namespace, provider);
|
return jingleContentDescriptionProviders.put(namespace, provider);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class JingleContentProviderManager {
|
||||||
return jingleContentDescriptionProviders.get(namespace);
|
return jingleContentDescriptionProviders.get(namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JingleContentTransportProvider<?> addJingleContentDescrptionProvider(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