Replaces boolean recording state with on, off and pending in colibri extension. Removes unused packet extension.

smack4
damencho 10 years ago
parent d2bac43d3c
commit 18bdce0088

@ -2176,16 +2176,26 @@ public static class Recording
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 String getDirectory()
return directory;
}
public boolean getState()
public State getState()
{
return state;
}
@ -2234,6 +2244,63 @@ public void toXML(StringBuilder xml)
}
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;
}
}
}
/**

@ -587,8 +587,6 @@ else if (ColibriConferenceIQ.Recording.ELEMENT_NAME.equals(
= parser.getAttributeValue(
"",
ColibriConferenceIQ.Recording.STATE_ATTR_NAME);
boolean state = Boolean.parseBoolean(stateStr);
String token
= parser.getAttributeValue(
"",
@ -596,7 +594,7 @@ else if (ColibriConferenceIQ.Recording.ELEMENT_NAME.equals(
recording
= new ColibriConferenceIQ.Recording(
state,
stateStr,
token);
}
else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME

@ -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;
}
}
}
Loading…
Cancel
Save