diff options
author | damencho <damencho@jitsi.org> | 2015-08-04 16:43:06 -0500 |
---|---|---|
committer | damencho <damencho@jitsi.org> | 2015-08-04 16:43:06 -0500 |
commit | 18bdce0088114bbd8ffe286b88663430017d9f94 (patch) | |
tree | 50db33228eb5aa91d3c03c36c971652b2f025dc4 /src/net/java/sip/communicator/impl | |
parent | d2bac43d3c7c045c82dce2a700a97950bf1545b4 (diff) | |
download | jitsi-18bdce0088114bbd8ffe286b88663430017d9f94.zip jitsi-18bdce0088114bbd8ffe286b88663430017d9f94.tar.gz jitsi-18bdce0088114bbd8ffe286b88663430017d9f94.tar.bz2 |
Replaces boolean recording state with on, off and pending in colibri extension. Removes unused packet extension.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
3 files changed, 72 insertions, 102 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java index d8af6fa..63c71c7 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java @@ -2176,16 +2176,26 @@ public class ColibriConferenceIQ private String directory; - private boolean state; + private State state; private String token; - public Recording(boolean state) + public Recording(String state) + { + this.state = State.parseString(state); + } + + public Recording(State state) { this.state = state; } - public Recording(boolean state, String token) + public Recording(String state, String token) + { + this(State.parseString(state), token); + } + + public Recording(State state, String token) { this(state); @@ -2197,7 +2207,7 @@ public class ColibriConferenceIQ return directory; } - public boolean getState() + public State getState() { return state; } @@ -2234,6 +2244,63 @@ public class ColibriConferenceIQ } xml.append("/>"); } + + /** + * The recording state. + */ + public enum State + { + /** + * Recording is started. + */ + ON("on"), + /** + * Recording is stopped. + */ + OFF("off"), + /** + * Recording is pending. Record has been requested but no conference + * has been established and it will be started once this is done. + */ + PENDING("pending"); + + /** + * The name. + */ + private String name; + + /** + * Constructs new state. + * @param name + */ + private State(String name) + { + this.name = name; + } + + /** + * Returns state name. + * @return returns state name. + */ + public String toString() + { + return name; + } + + /** + * Parses state. + * @param s state name. + * @return the state found. + */ + public static State parseString(String s) + { + if (ON.toString().equalsIgnoreCase(s)) + return ON; + else if (PENDING.toString().equalsIgnoreCase(s)) + return PENDING; + return OFF; + } + } } /** diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java index 931d947..42e136a 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java @@ -587,8 +587,6 @@ public class ColibriIQProvider = parser.getAttributeValue( "", ColibriConferenceIQ.Recording.STATE_ATTR_NAME); - boolean state = Boolean.parseBoolean(stateStr); - String token = parser.getAttributeValue( "", @@ -596,7 +594,7 @@ public class ColibriIQProvider recording = new ColibriConferenceIQ.Recording( - state, + stateStr, token); } else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/RecordingPacketExtension.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/RecordingPacketExtension.java deleted file mode 100644 index cea515a..0000000 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/RecordingPacketExtension.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Jitsi, the OpenSource Java VoIP and Instant Messaging client. - * - * Copyright @ 2015 Atlassian Pty Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.java.sip.communicator.impl.protocol.jabber.extensions.colibri; - -import net.java.sip.communicator.impl.protocol.jabber.extensions.*; - -/** - * Implements <tt>AbstractPacketExtension</tt> for a "recording" element. - * - * @author Boris Grozev - */ -public class RecordingPacketExtension - extends AbstractPacketExtension -{ - /** - * The XML name of the <tt>recording</tt> element. - */ - public static final String ELEMENT_NAME = "recording"; - - /** - * The XML name of the <tt>state</tt> attribute. - */ - private static final String STATE_ATTR_NAME = "state"; - - /** - * The XML name of the <tt>token</tt> attribute. - */ - private static final String TOKEN_ATTR_NAME = "token"; - - /** - * Initializes a new <tt>RecordingPacketExtension</tt> instance. - */ - public RecordingPacketExtension() - { - super(ColibriConferenceIQ.NAMESPACE, ELEMENT_NAME); - } - - public String getToken() - { - return getAttributeAsString(TOKEN_ATTR_NAME); - } - - public void setToken(String token) - { - setAttribute(TOKEN_ATTR_NAME, token); - } - - public State getState() - { - return State.parseString(getAttributeAsString(STATE_ATTR_NAME)); - } - - public void setState(State state) - { - setAttribute(STATE_ATTR_NAME, state.toString()); - } - - private enum State - { - ON("on"), - OFF("off"); - - private String name; - private State(String name) - { - this.name = name; - } - public String toString() - { - return name; - } - public static State parseString(String s) - { - if (ON.toString().equalsIgnoreCase(s)) - return ON; - return OFF; - } - } -} - |