src/net/java/sip/communicator/service/protocol/media/AbstractOperationSetTelephonyConferencing.java
/**
     * Updates the conference-related properties of a specific <tt>CallPeer</tt>
     * such as <tt>conferenceFocus</tt> and <tt>conferenceMembers</tt> with
     * information received from it as a conference focus in the form of a
     * partial conference-info XML document.
     *
     * @param callPeer the <tt>CallPeer</tt> which is a conference focus and has
     * sent the specified partial conference-info XML document
     * @param diff the partial conference-info XML document sent by
     * <tt>callPeer</tt> in order to update the conference-related information
     * of the local peer represented by the associated <tt>Call</tt>
     * @return the value of the <tt>version</tt> attribute of the
     * <tt>conference-info</tt> XML element of the specified
     * <tt>conferenceInfoXML</tt> if it was successfully parsed and represented
     * in the specified <tt>callPeer</tt>
     */
Updates the conference-related properties of a specific CallPeer
such as conferenceFocus and conferenceMembers with
information received from it as a conference focus in the form of a
partial conference-info XML document.

@param callPeer the CallPeer which is a conference focus and has
sent the specified partial conference-info XML document
@param diff the partial conference-info XML document sent by
callPeer in order to update the conference-related information
of the local peer represented by the associated Call
@return the value of the version attribute of the
conference-info XML element of the specified
conferenceInfoXML if it was successfully parsed and represented
in the specified callPeer
Updates the conference - related properties of a specific CallPeer such as conferenceFocus and conferenceMembers with information received from it as a conference focus in the form of a partial conference - info XML document . @param callPeer the CallPeer which is a conference focus and has sent the specified partial conference - info XML document @param diff the partial conference - info XML document sent by callPeer in order to update the conference - related information of the local peer represented by the associated Call @return the value of the version attribute of the conference - info XML element of the specified conferenceInfoXML if it was successfully parsed and represented in the specified callPeer
private int updateConferenceInfoDocument(
            MediaAwareCallPeerT callPeer,
            ConferenceInfoDocument diff)
    {
        ConferenceInfoDocument ourDocument
                = callPeer.getLastConferenceInfoReceived();
        ConferenceInfoDocument newDocument;
        ConferenceInfoDocument.State usersState = diff.getUsersState();
        if (usersState == ConferenceInfoDocument.State.FULL)
        {
            try
            {
                newDocument = new ConferenceInfoDocument(diff);
            }
            catch (XMLException e)
            {
                logger.error("Could not create a new ConferenceInfoDocument");
                return -1;
            }
            newDocument.setState(ConferenceInfoDocument.State.FULL);
        }
        else if (usersState == ConferenceInfoDocument.State.DELETED)
        {
            try
            {
                newDocument = new ConferenceInfoDocument();
            }
            catch (XMLException e)
            {
                logger.error("Could not create a new ConferenceInfoDocument", e);
                return -1;
            }
            newDocument.setVersion(diff.getVersion());
            newDocument.setEntity(diff.getEntity());
            newDocument.setUserCount(diff.getUserCount());
        }
        else 
        {
            try
            {
                newDocument = new ConferenceInfoDocument(ourDocument);
            }
            catch (XMLException e)
            {
                logger.error("Could not create a new ConferenceInfoDocument", e);
                return -1;
            }
            newDocument.setVersion(diff.getVersion());
            newDocument.setEntity(diff.getEntity());
            newDocument.setUserCount(diff.getUserCount());
            for (ConferenceInfoDocument.User user : diff.getUsers())
            {
                ConferenceInfoDocument.State userState = user.getState();
                if (userState == ConferenceInfoDocument.State.FULL)
                {
                    newDocument.removeUser(user.getEntity());
                    newDocument.addUser(user);
                }
                else if (userState == ConferenceInfoDocument.State.DELETED)
                {
                    newDocument.removeUser(user.getEntity());
                }
                else 
                {
                    ConferenceInfoDocument.User ourUser
                            = newDocument.getUser(user.getEntity());
                    ourUser.setDisplayText(user.getDisplayText());
                    for (ConferenceInfoDocument.Endpoint endpoint
                            : user.getEndpoints())
                    {
                        ConferenceInfoDocument.State endpointState
                                = endpoint.getState();
                        if (endpointState == ConferenceInfoDocument.State.FULL)
                        {
                            ourUser.removeEndpoint(endpoint.getEntity());
                            ourUser.addEndpoint(endpoint);
                        }
                        else if (endpointState
                                == ConferenceInfoDocument.State.DELETED)
                        {
                            ourUser.removeEndpoint(endpoint.getEntity());
                        }
                        else 
                        {
                            ConferenceInfoDocument.Endpoint ourEndpoint
                                    = ourUser.getEndpoint(endpoint.getEntity());
                            for (ConferenceInfoDocument.Media media
                                        : endpoint.getMedias())
                            {
                                ourEndpoint.removeMedia(media.getId());
                                ourEndpoint.addMedia(media);
                            }
                        }
                    }
                }
            }
        }
        if (logger.isDebugEnabled())
        {
            logger.debug("Applied a partial conference-info notification. "
                    + " Base: " + ourDocument + "\nDiff: " + diff + "\nResult:"
                    + newDocument);
        }
        return setConferenceInfoDocument(callPeer, newDocument);
    }
private int updateConferenceInfoDocument ( MediaAwareCallPeerT callPeer , ConferenceInfoDocument diff ) { ConferenceInfoDocument ourDocument = callPeer . getLastConferenceInfoReceived ( ) ; ConferenceInfoDocument newDocument ; ConferenceInfoDocument . State usersState = diff . getUsersState ( ) ; if ( usersState == ConferenceInfoDocument . State . FULL ) { try { newDocument = new ConferenceInfoDocument ( diff ) ; } catch ( XMLException e ) { logger . error ( "Could not create a new ConferenceInfoDocument" ) ; return - 1 ; } newDocument . setState ( ConferenceInfoDocument . State . FULL ) ; } else if ( usersState == ConferenceInfoDocument . State . DELETED ) { try { newDocument = new ConferenceInfoDocument ( ) ; } catch ( XMLException e ) { logger . error ( "Could not create a new ConferenceInfoDocument" , e ) ; return - 1 ; } newDocument . setVersion ( diff . getVersion ( ) ) ; newDocument . setEntity ( diff . getEntity ( ) ) ; newDocument . setUserCount ( diff . getUserCount ( ) ) ; } else { try { newDocument = new ConferenceInfoDocument ( ourDocument ) ; } catch ( XMLException e ) { logger . error ( "Could not create a new ConferenceInfoDocument" , e ) ; return - 1 ; } newDocument . setVersion ( diff . getVersion ( ) ) ; newDocument . setEntity ( diff . getEntity ( ) ) ; newDocument . setUserCount ( diff . getUserCount ( ) ) ; for ( ConferenceInfoDocument . User user : diff . getUsers ( ) ) { ConferenceInfoDocument . State userState = user . getState ( ) ; if ( userState == ConferenceInfoDocument . State . FULL ) { newDocument . removeUser ( user . getEntity ( ) ) ; newDocument . addUser ( user ) ; } else if ( userState == ConferenceInfoDocument . State . DELETED ) { newDocument . removeUser ( user . getEntity ( ) ) ; } else { ConferenceInfoDocument . User ourUser = newDocument . getUser ( user . getEntity ( ) ) ; ourUser . setDisplayText ( user . getDisplayText ( ) ) ; for ( ConferenceInfoDocument . Endpoint endpoint : user . getEndpoints ( ) ) { ConferenceInfoDocument . State endpointState = endpoint . getState ( ) ; if ( endpointState == ConferenceInfoDocument . State . FULL ) { ourUser . removeEndpoint ( endpoint . getEntity ( ) ) ; ourUser . addEndpoint ( endpoint ) ; } else if ( endpointState == ConferenceInfoDocument . State . DELETED ) { ourUser . removeEndpoint ( endpoint . getEntity ( ) ) ; } else { ConferenceInfoDocument . Endpoint ourEndpoint = ourUser . getEndpoint ( endpoint . getEntity ( ) ) ; for ( ConferenceInfoDocument . Media media : endpoint . getMedias ( ) ) { ourEndpoint . removeMedia ( media . getId ( ) ) ; ourEndpoint . addMedia ( media ) ; } } } } } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Applied a partial conference-info notification. " + " Base: " + ourDocument + "\nDiff: " + diff + "\nResult:" + newDocument ) ; } return setConferenceInfoDocument ( callPeer , newDocument ) ; }
Updates the conference-related properties of a specific <tt>CallPeer</tt>
 such as <tt>conferenceFocus</tt> and <tt>conferenceMembers</tt> with
 information received from it as a conference focus in the form of a
 partial conference-info XML document.
Updates the conference - related properties of a specific <tt > CallPeer< / tt > such as <tt > conferenceFocus< / tt > and <tt > conferenceMembers< / tt > with information received from it as a conference focus in the form of a partial conference - info XML document .
// "apply" diff to ourDocument, result is in newDocument //if users is 'full', all its children must be full //'partial' // partial // partial