fix-message-formatting
Danny van Heumen 12 years ago
commit 4876ceebb0

@ -193,7 +193,7 @@ protected void addSDesAdvertisedEncryptions(
}
else
{
sdesControl.cleanup();
sdesControl.cleanup(null);
srtpControls.remove(mediaType, SrtpControlType.SDES);
}
}
@ -207,7 +207,7 @@ else if(isInitiator)
= getSrtpControls().remove(mediaType, SrtpControlType.SDES);
if (sdesControl != null)
sdesControl.cleanup();
sdesControl.cleanup(null);
}
}
@ -479,7 +479,7 @@ protected boolean setSDesEncryptionOnDescription(
{
// none of the offered suites match, destroy the sdes
// control
sdesControl.cleanup();
sdesControl.cleanup(null);
srtpControls.remove(mediaType, SrtpControlType.SDES);
logger.warn(
"Received unsupported sdes crypto attribute");
@ -489,7 +489,7 @@ protected boolean setSDesEncryptionOnDescription(
{
// peer doesn't offer any SDES attribute, destroy the sdes
// control
sdesControl.cleanup();
sdesControl.cleanup(null);
srtpControls.remove(mediaType, SrtpControlType.SDES);
}
}
@ -538,8 +538,6 @@ protected void setAndAddPreferredEncryptionProtocol(
* Selects a specific encryption protocol if it is the preferred (only used
* by the callee).
*
* @param protoName the name of the encryption protocol which is to be
* selected
* @param mediaType The type of media (AUDIO or VIDEO).
* @param localDescription The element containing the media DESCRIPTION and
* its encryption.

@ -2423,7 +2423,7 @@ boolean addDtlsAdvertisedEncryptions(
if (dtlsControl != null)
{
srtpControls.remove(mediaType, SrtpControlType.DTLS_SRTP);
dtlsControl.cleanup();
dtlsControl.cleanup(null);
}
}
return b;
@ -2590,7 +2590,7 @@ private boolean setDtlsEncryptionOnContent(
if (dtlsControl != null)
{
srtpControls.remove(mediaType, SrtpControlType.DTLS_SRTP);
dtlsControl.cleanup();
dtlsControl.cleanup(null);
}
}
return b;

@ -54,6 +54,13 @@ public class ColibriConferenceIQ
*/
private final List<Content> contents = new LinkedList<Content>();
/**
* The list of {@link ChannelBundle}s included into this <tt>conference</tt>
* IQ.
*/
private final List<ChannelBundle> channelBundles
= new LinkedList<ChannelBundle>();
/**
* The ID of the conference represented by this IQ.
*/
@ -112,6 +119,22 @@ public boolean addContent(Content content)
return contents.contains(content) ? false : contents.add(content);
}
/**
* Adds a specific {@link Content} instance to the list of <tt>Content</tt>
* instances included into this <tt>conference</tt> IQ.
* @param the <tt>ChannelBundle</tt> to add.
*/
public boolean addChannelBundle(ChannelBundle channelBundle)
{
if (channelBundle == null)
throw new NullPointerException("channelBundle");
return channelBundles.contains(channelBundles)
? false
: channelBundles.add(channelBundle);
}
/**
* Returns an XML <tt>String</tt> representation of this <tt>IQ</tt>.
*
@ -132,12 +155,14 @@ public String getChildElementXML()
.append('\'');
List<Content> contents = getContents();
List<ChannelBundle> channelBundles = getChannelBundles();
int childrenCount = contents.size();
if (recording != null)
childrenCount++;
boolean hasChildren = recording != null
|| rtcpTerminationStrategy != null
|| contents.size() > 0
|| channelBundles.size() > 0;
if (childrenCount == 0)
if (!hasChildren)
{
xml.append(" />");
}
@ -146,6 +171,8 @@ public String getChildElementXML()
xml.append('>');
for (Content content : contents)
content.toXML(xml);
for (ChannelBundle channelBundle : channelBundles)
channelBundle.toXML(xml);
if (recording != null)
recording.toXML(xml);
@ -187,6 +214,18 @@ public List<Content> getContents()
return Collections.unmodifiableList(contents);
}
/**
* Returns a list of the <tt>ChannelBundle</tt>s included into this
* <tt>conference</tt> IQ.
*
* @return an unmodifiable <tt>List</tt> of the <tt>ChannelBundle</tt>s
* included into this <tt>conference</tt> IQ.
*/
public List<ChannelBundle> getChannelBundles()
{
return Collections.unmodifiableList(channelBundles);
}
/**
* Gets the ID of the conference represented by this IQ.
*
@ -318,6 +357,12 @@ public static abstract class ChannelCommon
*/
public static final String EXPIRE_ATTR_NAME = "expire";
/**
* The name of the "channel-bundle-id" attribute.
*/
public static final String CHANNEL_BUNDLE_ID_ATTR_NAME
= "channel-bundle-id";
/**
* The value of the <tt>expire</tt> property of
* <tt>ColibriConferenceIQ.Channel</tt> which indicates that no actual
@ -359,6 +404,11 @@ public static abstract class ChannelCommon
*/
private String elementName;
/**
* The channel-bundle-id attribute of this <tt>CommonChannel</tt>.
*/
private String channelBundleId = null;
/**
* Initializes this class with given XML <tt>elementName</tt>.
* @param elementName XML element name to be used for producing XML
@ -414,6 +464,16 @@ public Boolean isInitiator()
return initiator;
}
/**
* Get the channel-bundle-id attribute of this <tt>CommonChannel</tt>.
* @return the channel-bundle-id attribute of this
* <tt>CommonChannel</tt>.
*/
public String getChannelBundleId()
{
return channelBundleId;
}
/**
* Sets the identifier of the endpoint of the conference participant
* associated with this <tt>Channel</tt>.
@ -465,6 +525,15 @@ public void setTransport(IceUdpTransportPacketExtension transport)
this.transport = transport;
}
/**
* Sets the channel-bundle-id attribute of this <tt>CommonChannel</tt>.
* @param channelBundleId the value to set.
*/
public void setChannelBundleId(String channelBundleId)
{
this.channelBundleId = channelBundleId;
}
/**
* Derived class implements this method in order to print additional
* attributes to main XML element.
@ -534,6 +603,13 @@ public void toXML(StringBuilder xml)
.append(initiator).append('\'');
}
String channelBundleId = getChannelBundleId();
if (channelBundleId != null)
{
xml.append(' ').append(CHANNEL_BUNDLE_ID_ATTR_NAME)
.append("='").append(channelBundleId).append('\'');
}
// Print derived class attributes
printAttributes(xml);
@ -582,6 +658,99 @@ public void toXML(StringBuilder xml)
}
}
/**
* Represents a "channel-bundle" element.
*/
public static class ChannelBundle
{
/**
* The name of the "channel-bundle" element.
*/
public static final String ELEMENT_NAME = "channel-bundle";
/**
* The name of the "id" attribute.
*/
public static final String ID_ATTR_NAME = "id";
/**
* The ID of this <tt>ChannelBundle</tt>.
*/
private String id;
/**
* The transport element of this <tt>ChannelBundle</tt>.
*/
private IceUdpTransportPacketExtension transport;
/**
* Initializes a new <tt>ChannelBundle</tt> with the given ID.
* @param id the ID.
*/
public ChannelBundle(String id)
{
this.id = id;
}
/**
* Returns the transport element of this <tt>ChannelBundle</tt>.
* @return the transport element of this <tt>ChannelBundle</tt>.
*/
public IceUdpTransportPacketExtension getTransport()
{
return transport;
}
/**
* Sets the transport element of this <tt>ChannelBundle</tt>.
* @param transport the transport to set.
*/
public void setTransport(IceUdpTransportPacketExtension transport)
{
this.transport = transport;
}
/**
* Returns the ID of this <tt>ChannelBundle</tt>.
* @return the ID of this <tt>ChannelBundle</tt>.
*/
public String getId()
{
return id;
}
/**
* Sets the ID of this <tt>ChannelBundle</tt>.
* @param id the ID to set.
*/
public void setId(String id)
{
this.id = id;
}
/**
* Appends an XML representation of this <tt>ChannelBundle</tt> to
* <tt>xml</tt>.
* @param xml the <tt>StringBuilder</tt> to append to.
*/
public void toXML(StringBuilder xml)
{
xml.append('<').append(ELEMENT_NAME).append(' ')
.append(ID_ATTR_NAME).append("='").append(id).append('\'');
if (transport != null)
{
xml.append('>');
xml.append(transport.toXML());
xml.append("</").append(ELEMENT_NAME).append('>');
}
else
{
xml.append(" />");
}
}
}
/**
* Represents a <tt>channel</tt> included into a <tt>content</tt> of a Jitsi
* Videobridge <tt>conference</tt> IQ.

@ -271,6 +271,14 @@ else if (ColibriConferenceIQ.Recording.ELEMENT_NAME.equals(
if ((endpoint != null) && (endpoint.length() != 0))
channel.setEndpoint(endpoint);
String channelBundleId
= parser.getAttributeValue(
"",
ColibriConferenceIQ.ChannelCommon
.CHANNEL_BUNDLE_ID_ATTR_NAME);
if (!StringUtils.isNullOrEmpty(channelBundleId))
channel.setChannelBundleId(channelBundleId);
// expire
String expire
= parser.getAttributeValue(
@ -438,9 +446,17 @@ else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
= parser.getAttributeValue(
"",
ColibriConferenceIQ.SctpConnection.PORT_ATTR_NAME);
if(!StringUtils.isNullOrEmpty(port))
if (!StringUtils.isNullOrEmpty(port))
sctpConnection.setPort(Integer.parseInt(port));
String channelBundleId
= parser.getAttributeValue(
"",
ColibriConferenceIQ.ChannelCommon
.CHANNEL_BUNDLE_ID_ATTR_NAME);
if (!StringUtils.isNullOrEmpty(channelBundleId))
sctpConnection.setChannelBundleId(channelBundleId);
// initiator
String initiator
= parser.getAttributeValue(

@ -14,15 +14,14 @@
import org.jivesoftware.smack.util.*;
/**
* Implements the Jitsi Videobridge <tt>stats</tt> extension within the
* COnferencing with LIghtweight BRIdging that will provide various statistics.
* Implements the Jitsi Videobridge <tt>stats</tt> extension within COnferencing
* with LIghtweight BRIdging that will provide various statistics.
*
* @author Hristo Terezov
*/
public class ColibriStatsExtension
extends AbstractPacketExtension
{
/**
* The XML element name of the Jitsi Videobridge <tt>stats</tt> extension.
*/
@ -38,9 +37,9 @@ public class ColibriStatsExtension
/**
* Constructs new <tt>ColibriStatsExtension</tt>
*/
public ColibriStatsExtension() {
public ColibriStatsExtension()
{
super(NAMESPACE, ELEMENT_NAME);
}
/**
@ -58,7 +57,8 @@ public List<? extends PacketExtension> getChildExtensions()
return Collections.unmodifiableList(super.getChildExtensions());
}
public static class Stat implements PacketExtension
public static class Stat
implements PacketExtension
{
/**
* The XML element name of a <tt>content</tt> of a Jitsi Videobridge
@ -67,16 +67,16 @@ public static class Stat implements PacketExtension
public static final String ELEMENT_NAME = "stat";
/**
* The XML name of the <tt>name</tt> attribute of a <tt>stat</tt> of
* a <tt>stats</tt> IQ which represents the <tt>name</tt> property
* of the statistic.
* The XML name of the <tt>name</tt> attribute of a <tt>stat</tt> of a
* <tt>stats</tt> IQ which represents the <tt>name</tt> property of the
* statistic.
*/
public static final String NAME_ATTR_NAME = "name";
/**
* The XML name of the <tt>name</tt> attribute of a <tt>stat</tt> of
* a <tt>stats</tt> IQ which represents the <tt>value</tt> property
* of the statistic.
* The XML name of the <tt>name</tt> attribute of a <tt>stat</tt> of a
* <tt>stats</tt> IQ which represents the <tt>value</tt> property of the
* statistic.
*/
public static final String VALUE_ATTR_NAME = "value";
@ -90,7 +90,9 @@ public static class Stat implements PacketExtension
*/
private Object value;
public Stat() { }
public Stat()
{
}
/**
* Constructs new <tt>Stat</tt> by given name and value.
@ -103,6 +105,12 @@ public Stat(String name, Object value)
this.setValue(value);
}
@Override
public String getElementName()
{
return ELEMENT_NAME;
}
/**
* @return the name
*/
@ -111,12 +119,10 @@ public String getName()
return name;
}
/**
* @param name the name to set
*/
public void setName(String name)
@Override
public String getNamespace()
{
this.name = name;
return NAMESPACE;
}
/**
@ -128,33 +134,39 @@ public Object getValue()
}
/**
* @param value the value to set
* @param name the name to set
*/
public void setValue(Object value)
public void setName(String name)
{
this.value = value;
this.name = name;
}
public String toXML()
/**
* @param value the value to set
*/
public void setValue(Object value)
{
if(name == null || value == null)
return "";
return "<" + ELEMENT_NAME + " " + NAME_ATTR_NAME + "='" +
StringUtils.escapeForXML(getName()) + "' " + VALUE_ATTR_NAME +
"='" + StringUtils.escapeForXML(getValue().toString()) + "' />";
this.value = value;
}
@Override
public String getElementName()
public String toXML()
{
return ELEMENT_NAME;
}
String name = getName();
Object value = getValue();
@Override
public String getNamespace()
{
return NAMESPACE;
if ((name == null) || (value == null))
{
return "";
}
else
{
return
"<" + ELEMENT_NAME + " " + NAME_ATTR_NAME + "='"
+ StringUtils.escapeForXML(name) + "' "
+ VALUE_ATTR_NAME + "='"
+ StringUtils.escapeForXML(value.toString()) + "' />";
}
}
}
}

@ -952,7 +952,7 @@ else if (remoteMd != null) // answer
SrtpControlType.DTLS_SRTP);
if (dtlsControl != null)
dtlsControl.cleanup();
dtlsControl.cleanup(null);
}
}
}
@ -1069,7 +1069,7 @@ private void updateSrtpControlsForDtls(
else
{
srtpControls.remove(mediaType, SrtpControlType.DTLS_SRTP);
dtlsControl.cleanup();
dtlsControl.cleanup(null);
}
}
@ -1149,7 +1149,7 @@ private boolean updateMediaDescriptionForSDes(
else
{
// None of the offered suites match, destroy the SDES control.
sdesControl.cleanup();
sdesControl.cleanup(null);
srtpControls.remove(mediaType, SrtpControlType.SDES);
logger.warn("Received unsupported sdes crypto attribute.");
}
@ -1498,7 +1498,7 @@ private void doNonSynchronisedProcessAnswer(SessionDescription answer)
sdesControl,
mediaDescription) == null)
{
sdesControl.cleanup();
sdesControl.cleanup(null);
srtpControls.remove(mediaType, SrtpControlType.SDES);
logger.warn("Received unsupported sdes crypto attribute.");
}

@ -87,7 +87,7 @@ public Class<?> getDependentServiceClass()
@Override
public void setBundleContext(final BundleContext context)
{
this.bundleContext = context;
IrcAccRegWizzActivator.bundleContext = context;
}
/**

@ -1525,7 +1525,7 @@ protected void removeAndCleanupOtherSrtpControls(
SrtpControl e = srtpControls.remove(mediaType, i);
if (e != null)
e.cleanup();
e.cleanup(null);
}
}
}

Loading…
Cancel
Save