diff --git a/src/net/java/sip/communicator/util/ConferenceInfoDocument.java b/src/net/java/sip/communicator/util/ConferenceInfoDocument.java index aa907006e..e8273cd01 100644 --- a/src/net/java/sip/communicator/util/ConferenceInfoDocument.java +++ b/src/net/java/sip/communicator/util/ConferenceInfoDocument.java @@ -507,6 +507,37 @@ private State getState(Element element) : state; } + /** + * Sets the status child element of element. If + * statusString is null, the child element is removed + * if present. + * @param element the Element for which to set the status + * child element. + * @param statusString the String to use for the text content of + * the status element + */ + private void setStatus(Element element, String statusString) + { + Element statusElement + = XMLUtils.findChild(element, STATUS_ELEMENT_NAME); + if (statusString == null) + { + if(statusElement == null) + return; + else + element.removeChild(statusElement); + } + else + { + if (statusElement == null) + { + statusElement = document.createElement(STATUS_ELEMENT_NAME); + element.appendChild(statusElement); + } + statusElement.setTextContent(statusString); + } + } + /** * Represents the possible values for the state attribute (see * RFC4575) @@ -820,14 +851,10 @@ public State getState() */ public void setStatus(EndpointStatusType status) { - Element statusElement - = XMLUtils.findChild(endpointElement, STATUS_ELEMENT_NAME); - if (statusElement == null) - { - statusElement = document.createElement(STATUS_ELEMENT_NAME); - endpointElement.appendChild(statusElement); - } - statusElement.setTextContent(status.toString()); + ConferenceInfoDocument.this.setStatus(endpointElement, + status == null + ? null + : status.toString()); } /** @@ -1019,14 +1046,7 @@ public String getType() */ public void setStatus(String status) { - Element statusElement - = XMLUtils.findChild(mediaElement, STATUS_ELEMENT_NAME); - if (statusElement == null) - { - statusElement = document.createElement(STATUS_ELEMENT_NAME); - mediaElement.appendChild(statusElement); - } - statusElement.setTextContent(status); + ConferenceInfoDocument.this.setStatus(mediaElement, status); } /**