Adds an 'endpoint' sub-element to ColibriConferenceIQ.

fix-message-formatting
Boris Grozev 11 years ago
parent 28dd54b4d5
commit 09045fa7a8

@ -66,6 +66,11 @@ public class ColibriConferenceIQ
private RTCPTerminationStrategy rtcpTerminationStrategy = null;
/**
* The list of <tt>Endpoint</tt>s included into this <tt>conference</tt> IQ.
*/
private final List<Endpoint> endpoints = new LinkedList<Endpoint>();
/** Initializes a new <tt>ColibriConferenceIQ</tt> instance. */
public ColibriConferenceIQ()
{
@ -269,6 +274,25 @@ public void setRTCPTerminationStrategy(RTCPTerminationStrategy rtcpTerminationSt
this.rtcpTerminationStrategy = rtcpTerminationStrategy;
}
/**
* Returns the list of <tt>Endpoint</tt>s included in this
* <tt>ColibriConferenceIQ</tt>.
* @return the list of <tt>Endpoint</tt>s included in this
* <tt>ColibriConferenceIQ</tt>.
*/
public List<Endpoint> getEndpoints()
{
return Collections.unmodifiableList(endpoints);
}
/**
* Add an <tt>Endpoint</tt> to this <tt>ColibriConferenceIQ</tt>.
* @param endpoint the <tt>Endpoint</tt> to add.
*/
public void addEndpoint(Endpoint endpoint)
{
endpoints.add(endpoint);
}
/**
* Class contains common code for both <tt>Channel</tt> and
* <tt>SctpConnection</tt> IQ classes.
@ -1640,4 +1664,83 @@ public void toXML(StringBuilder xml)
xml.append("/>");
}
}
/**
* Represents an 'endpoint' element.
*/
public static class Endpoint
{
/**
* The name of the 'endpoint' element.
*/
public static final String ELEMENT_NAME = "endpoint";
/**
* The name of the 'id' attribute.
*/
public static final String ID_ATTR_NAME = "id";
/**
* The name of the 'displayname' attribute.
*/
public static final String DISPLAYNAME_ATTR_NAME = "displayname";
/**
* The 'id' of this <tt>Endpoint</tt>.
*/
private String id;
/**
* The 'display name' of this <tt>Endpoint</tt>.
*/
private String displayName;
/**
* Initializes a new <tt>Endpoint</tt> with the given ID and display
* name.
* @param id the ID.
* @param displayName the display name.
*/
public Endpoint(String id, String displayName)
{
this.id = id;
this.displayName = displayName;
}
/**
* Sets the ID of this <tt>Endpoint</tt>.
* @param id the ID to set.
*/
public void setId(String id)
{
this.id = id;
}
/**
* Returns the ID of this <tt>Endpoint</tt>.
* @return the ID of this <tt>Endpoint</tt>.
*/
public String getId()
{
return id;
}
/**
* Sets the display name of this <tt>Endpoint</tt>.
* @param displayName the display name to set.
*/
public void setDisplayName(String displayName)
{
this.displayName = displayName;
}
/**
* Returns the display name of this <tt>Endpoint</tt>.
* @return the display name of this <tt>Endpoint</tt>.
*/
public String getDisplayName()
{
return displayName;
}
}
}

@ -163,6 +163,7 @@ public IQ parseIQ(XmlPullParser parser)
ColibriConferenceIQ.SctpConnection sctpConnection = null;
ColibriConferenceIQ.Content content = null;
ColibriConferenceIQ.Recording recording = null;
ColibriConferenceIQ.Endpoint conferenceEndpoint = null;
StringBuilder ssrc = null;
while (!done)
@ -189,6 +190,12 @@ else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
content.addSctpConnection(sctpConnection);
sctpConnection = null;
}
else if (ColibriConferenceIQ.Endpoint.ELEMENT_NAME
.equals(name))
{
conference.addEndpoint(conferenceEndpoint);
conferenceEndpoint = null;
}
else if (ColibriConferenceIQ.Channel.SSRC_ELEMENT_NAME
.equals(name))
{
@ -455,6 +462,25 @@ else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
if (!StringUtils.isNullOrEmpty(expire))
sctpConnection.setExpire(Integer.parseInt(expire));
}
else if (ColibriConferenceIQ.Endpoint.ELEMENT_NAME
.equals(name))
{
String id
= parser.getAttributeValue(
"",
ColibriConferenceIQ.Endpoint.ID_ATTR_NAME);
String endpointName
= parser.getAttributeValue(
"",
ColibriConferenceIQ.Endpoint
.DISPLAYNAME_ATTR_NAME);
conferenceEndpoint
= new ColibriConferenceIQ.Endpoint(id,
endpointName);
}
else if (channel != null || sctpConnection != null)
{
String peName = null;

Loading…
Cancel
Save