changed try-catch formatting
added deletePreferencesItem() to authentication module
This commit is contained in:
parent
5c5e8c7de9
commit
db0fcb87fb
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.6 $
|
||||
Version : $Revision: 1.7 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/include/LiveSupport/Authentication/AuthenticationClientInterface.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -69,7 +69,7 @@ using namespace LiveSupport::Core;
|
|||
* An interface for authentication clients.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.6 $
|
||||
* @version $Revision: 1.7 $
|
||||
*/
|
||||
class AuthenticationClientInterface
|
||||
{
|
||||
|
@ -162,6 +162,29 @@ class AuthenticationClientInterface
|
|||
Ptr<const Glib::ustring>::Ref value)
|
||||
throw (XmlRpcException)
|
||||
= 0;
|
||||
|
||||
/**
|
||||
* Delete a `user preferences' item from the server.
|
||||
*
|
||||
* @param sessionId the ID of the current session (from login())
|
||||
* @param key the name of the item
|
||||
*
|
||||
* @exception XmlRpcInvalidArgumentException
|
||||
* bad sessionId argument
|
||||
* @exception XmlRpcCommunicationException
|
||||
* problem with performing XML-RPC call
|
||||
* @exception XmlRpcMethodFaultException
|
||||
* XML-RPC method returned fault response
|
||||
* @exception XmlRpcMethodResponseException
|
||||
* response from XML-RPC method is incorrect
|
||||
* @exception XmlRpcException other error
|
||||
* (TestAuthenticationClient only)
|
||||
*/
|
||||
virtual void
|
||||
deletePreferencesItem(Ptr<SessionId>::Ref sessionId,
|
||||
const Glib::ustring & key)
|
||||
throw (XmlRpcException)
|
||||
= 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.4 $
|
||||
Version : $Revision: 1.5 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -199,7 +199,7 @@ AuthenticationClientFactoryTest :: preferencesTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(*newPrefValue == "страстные");
|
||||
|
||||
// check another normal save and load
|
||||
// check another normal save and load...
|
||||
prefValue.reset(new const Glib::ustring("ne dobryj"));
|
||||
try {
|
||||
authentication->savePreferencesItem(sessionId, "hour", prefValue);
|
||||
|
@ -207,6 +207,14 @@ AuthenticationClientFactoryTest :: preferencesTest(void)
|
|||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
// ... but now change session ID in the middle
|
||||
try {
|
||||
authentication->logout(sessionId);
|
||||
sessionId = authentication->login("root", "q");
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
try {
|
||||
newPrefValue = authentication->loadPreferencesItem(sessionId, "hour");
|
||||
} catch (XmlRpcException &e) {
|
||||
|
@ -214,6 +222,19 @@ AuthenticationClientFactoryTest :: preferencesTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
|
||||
|
||||
// check the delete method
|
||||
try {
|
||||
authentication->deletePreferencesItem(sessionId, "hour");
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
try {
|
||||
newPrefValue = authentication->loadPreferencesItem(sessionId, "hour");
|
||||
CPPUNIT_FAIL("Allowed to load preference after it was deleted");
|
||||
} catch (XmlRpcException &e) {
|
||||
}
|
||||
|
||||
// and log out
|
||||
try {
|
||||
authentication->logout(sessionId);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.5 $
|
||||
Version : $Revision: 1.6 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -168,8 +168,7 @@ TestAuthenticationClient :: login(const std::string & login,
|
|||
sessionIdList.insert(sessionIdStream.str());
|
||||
sessionId.reset(new SessionId(sessionIdStream.str()));
|
||||
return sessionId;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw XmlRpcException("incorrect login or password");
|
||||
}
|
||||
}
|
||||
|
@ -185,8 +184,7 @@ TestAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
|
|||
// this returns the number of entries found and erased
|
||||
if (!sessionId || sessionIdList.erase(sessionId->getId())) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw XmlRpcException("logout() called without previous login()");
|
||||
}
|
||||
}
|
||||
|
@ -203,10 +201,10 @@ TestAuthenticationClient :: loadPreferencesItem(
|
|||
{
|
||||
if (!sessionId
|
||||
|| sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
|
||||
throw XmlRpcException("loadPreferences() called before login()");
|
||||
throw XmlRpcException("bad session ID");
|
||||
}
|
||||
|
||||
preferencesType::iterator it;
|
||||
PreferencesType::iterator it;
|
||||
|
||||
if ((it = preferences.find(key)) == preferences.end()) {
|
||||
throw XmlRpcException("no such user preferences item");
|
||||
|
@ -227,6 +225,11 @@ TestAuthenticationClient :: savePreferencesItem(
|
|||
Ptr<const Glib::ustring>::Ref value)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
if (!sessionId
|
||||
|| sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
|
||||
throw XmlRpcException("bad session ID");
|
||||
}
|
||||
|
||||
if (sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
|
||||
throw XmlRpcException("loadPreferences() called before login()");
|
||||
}
|
||||
|
@ -234,3 +237,27 @@ TestAuthenticationClient :: savePreferencesItem(
|
|||
preferences[key] = value;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Delete a `user preferences' item from the server.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
TestAuthenticationClient :: deletePreferencesItem(
|
||||
Ptr<SessionId>::Ref sessionId,
|
||||
const Glib::ustring & key)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
if (!sessionId
|
||||
|| sessionIdList.find(sessionId->getId()) == sessionIdList.end()) {
|
||||
throw XmlRpcException("bad session ID");
|
||||
}
|
||||
|
||||
PreferencesType::iterator it;
|
||||
|
||||
if ((it = preferences.find(key)) == preferences.end()) {
|
||||
throw XmlRpcException("no such user preferences item");
|
||||
}
|
||||
|
||||
preferences.erase(it);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -65,7 +65,10 @@ using namespace LiveSupport::Core;
|
|||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A dummy authentication client.
|
||||
* A dummy authentication client. It only supports one user, whose name and
|
||||
* password are read from a configuration file. It issues session IDs when
|
||||
* login() is called, and deletes these session IDs when logout() is called.
|
||||
* It also stores (key, value) pairs of user preferences for this one user.
|
||||
*
|
||||
* This object has to be configured with an XML configuration element
|
||||
* called testAuthentication. This element contains a child element
|
||||
|
@ -92,7 +95,7 @@ using namespace LiveSupport::Core;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.7 $
|
||||
* @version $Revision: 1.8 $
|
||||
*/
|
||||
class TestAuthenticationClient :
|
||||
virtual public Configurable,
|
||||
|
@ -119,12 +122,12 @@ class TestAuthenticationClient :
|
|||
* A type for the list of sessionId's.
|
||||
*/
|
||||
typedef std::set<std::string>
|
||||
sessionIdListType;
|
||||
SessionIdListType;
|
||||
|
||||
/**
|
||||
* A list of the sessionId's we have issued.
|
||||
*/
|
||||
sessionIdListType sessionIdList;
|
||||
SessionIdListType sessionIdList;
|
||||
|
||||
/**
|
||||
* The number of the sessionId's we have issued.
|
||||
|
@ -135,12 +138,12 @@ class TestAuthenticationClient :
|
|||
* A type for the list of user preferences.
|
||||
*/
|
||||
typedef std::map<const Glib::ustring, Ptr<const Glib::ustring>::Ref>
|
||||
preferencesType;
|
||||
PreferencesType;
|
||||
|
||||
/**
|
||||
* A list of the user preferences items stored.
|
||||
*/
|
||||
preferencesType preferences;
|
||||
PreferencesType preferences;
|
||||
|
||||
|
||||
public:
|
||||
|
@ -228,6 +231,18 @@ class TestAuthenticationClient :
|
|||
const Glib::ustring & key,
|
||||
Ptr<const Glib::ustring>::Ref value)
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Delete a `user preferences' item from the server.
|
||||
*
|
||||
* @param sessionId the ID of the current session (from login())
|
||||
* @param key the name of the item
|
||||
* @exception XmlRpcException invalid session ID, or no such key
|
||||
*/
|
||||
virtual void
|
||||
deletePreferencesItem(Ptr<SessionId>::Ref sessionId,
|
||||
const Glib::ustring & key)
|
||||
throw (XmlRpcException);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.5 $
|
||||
Version : $Revision: 1.6 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -207,7 +207,7 @@ TestAuthenticationClientTest :: preferencesTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(*newPrefValue == "страстные");
|
||||
|
||||
// check another normal save and load
|
||||
// check another normal save and load...
|
||||
prefValue.reset(new const Glib::ustring("ne dobryj"));
|
||||
try {
|
||||
tac->savePreferencesItem(sessionId, "hour", prefValue);
|
||||
|
@ -215,6 +215,14 @@ TestAuthenticationClientTest :: preferencesTest(void)
|
|||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
|
||||
// ... but now change session ID in the middle
|
||||
try {
|
||||
tac->logout(sessionId);
|
||||
sessionId = tac->login("root", "q");
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
try {
|
||||
newPrefValue = tac->loadPreferencesItem(sessionId, "hour");
|
||||
} catch (XmlRpcException &e) {
|
||||
|
@ -222,6 +230,19 @@ TestAuthenticationClientTest :: preferencesTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
|
||||
|
||||
// check the delete method
|
||||
try {
|
||||
tac->deletePreferencesItem(sessionId, "hour");
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
try {
|
||||
newPrefValue = tac->loadPreferencesItem(sessionId, "hour");
|
||||
CPPUNIT_FAIL("Allowed to load preference after it was deleted");
|
||||
} catch (XmlRpcException &e) {
|
||||
}
|
||||
|
||||
// and log out
|
||||
try {
|
||||
tac->logout(sessionId);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -139,6 +139,11 @@ static const std::string loadPreferencesMethodName = "locstor.loadPref";
|
|||
*----------------------------------------------------------------------------*/
|
||||
static const std::string savePreferencesMethodName = "locstor.savePref";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the delete preferences method on the server
|
||||
*----------------------------------------------------------------------------*/
|
||||
static const std::string deletePreferencesMethodName = "locstor.delPref";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the session ID parameter in the input structure
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -450,6 +455,59 @@ WebAuthenticationClient :: savePreferencesItem(
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Delete a `user preferences' item from the server.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WebAuthenticationClient :: deletePreferencesItem(
|
||||
Ptr<SessionId>::Ref sessionId,
|
||||
const Glib::ustring & key)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
if (!sessionId) {
|
||||
throw Core::XmlRpcInvalidArgumentException("Missing session ID.");
|
||||
}
|
||||
|
||||
XmlRpcValue parameters;
|
||||
XmlRpcValue result;
|
||||
|
||||
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
|
||||
storageServerPath.c_str(), false);
|
||||
|
||||
parameters.clear();
|
||||
parameters[preferencesSessionIdParamName] = sessionId->getId();
|
||||
parameters[preferencesKeyParamName] = std::string(key);
|
||||
|
||||
result.clear();
|
||||
if (!xmlRpcClient.execute(deletePreferencesMethodName.c_str(),
|
||||
parameters, result)) {
|
||||
throw Core::XmlRpcCommunicationException(
|
||||
"Could not execute XML-RPC method.");
|
||||
}
|
||||
|
||||
if (xmlRpcClient.isFault()) {
|
||||
std::stringstream eMsg;
|
||||
eMsg << "XML-RPC method "
|
||||
<< deletePreferencesMethodName
|
||||
<< " returned fault response:\n"
|
||||
<< result;
|
||||
throw Core::XmlRpcMethodFaultException(eMsg.str());
|
||||
}
|
||||
|
||||
if (! result.hasMember(preferencesStatusParamName)
|
||||
|| result[preferencesStatusParamName].getType()
|
||||
!= XmlRpcValue::TypeBoolean
|
||||
|| ! bool(result[preferencesStatusParamName])) {
|
||||
std::stringstream eMsg;
|
||||
eMsg << "XML-RPC method "
|
||||
<< deletePreferencesMethodName
|
||||
<< " returned unexpected response:\n"
|
||||
<< result;
|
||||
throw Core::XmlRpcMethodResponseException(eMsg.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Reset the list of preferences to its initial (empty) state.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.4 $
|
||||
Version : $Revision: 1.5 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -93,7 +93,7 @@ using namespace LiveSupport::Core;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.4 $
|
||||
* @version $Revision: 1.5 $
|
||||
*/
|
||||
class WebAuthenticationClient :
|
||||
virtual public Configurable,
|
||||
|
@ -236,6 +236,26 @@ class WebAuthenticationClient :
|
|||
Ptr<const Glib::ustring>::Ref value)
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Delete a `user preferences' item from the server.
|
||||
*
|
||||
* @param sessionId the ID of the current session (from login())
|
||||
* @param key the name of the item
|
||||
*
|
||||
* @exception XmlRpcInvalidArgumentException
|
||||
* bad sessionId argument
|
||||
* @exception XmlRpcCommunicationException
|
||||
* problem with performing XML-RPC call
|
||||
* @exception XmlRpcMethodFaultException
|
||||
* XML-RPC method returned fault response
|
||||
* @exception XmlRpcMethodResponseException
|
||||
* response from XML-RPC method is incorrect
|
||||
*/
|
||||
virtual void
|
||||
deletePreferencesItem(Ptr<SessionId>::Ref sessionId,
|
||||
const Glib::ustring & key)
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Reset the list of preferences to its initial (empty) state.
|
||||
*
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.8 $
|
||||
Version : $Revision: 1.9 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClientTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -212,7 +212,7 @@ WebAuthenticationClientTest :: preferencesTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(*newPrefValue == "страстные");
|
||||
|
||||
// check another normal save and load
|
||||
// check another normal save and load ...
|
||||
prefValue.reset(new const Glib::ustring("ne dobryj"));
|
||||
try {
|
||||
wac->savePreferencesItem(sessionId, "hour", prefValue);
|
||||
|
@ -220,6 +220,14 @@ WebAuthenticationClientTest :: preferencesTest(void)
|
|||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
// ... but now change session ID in the middle
|
||||
try {
|
||||
wac->logout(sessionId);
|
||||
sessionId = wac->login("root", "q");
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
try {
|
||||
newPrefValue = wac->loadPreferencesItem(sessionId, "hour");
|
||||
} catch (XmlRpcException &e) {
|
||||
|
@ -227,6 +235,19 @@ WebAuthenticationClientTest :: preferencesTest(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(*newPrefValue == *prefValue);
|
||||
|
||||
// check the delete method
|
||||
try {
|
||||
wac->deletePreferencesItem(sessionId, "hour");
|
||||
} catch (XmlRpcException &e) {
|
||||
CPPUNIT_FAIL(e.what());
|
||||
}
|
||||
|
||||
try {
|
||||
newPrefValue = wac->loadPreferencesItem(sessionId, "hour");
|
||||
CPPUNIT_FAIL("Allowed to load preference after it was deleted");
|
||||
} catch (XmlRpcException &e) {
|
||||
}
|
||||
|
||||
// and log out
|
||||
try {
|
||||
wac->logout(sessionId);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.16 $
|
||||
Version : $Revision: 1.17 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -288,8 +288,7 @@ AudioClip :: configure(const xmlpp::Element & element)
|
|||
if (dataElement->has_child_text()) {
|
||||
playlength.reset(new time_duration(duration_from_string(
|
||||
dataElement->get_child_text()->get_content() )));
|
||||
}
|
||||
else { // or just leave blank? bad either way
|
||||
} else { // or just leave blank? bad either way
|
||||
playlength.reset(new time_duration(0,0,0,0));
|
||||
}
|
||||
}
|
||||
|
@ -299,8 +298,7 @@ AudioClip :: configure(const xmlpp::Element & element)
|
|||
Glib::ustring value;
|
||||
if (dataElement->has_child_text()) {
|
||||
value = dataElement->get_child_text()->get_content();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
Ptr<const Glib::ustring>::Ref ptrToValue(
|
||||
|
@ -413,8 +411,7 @@ AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
|||
xmlpp::Element* metadata;
|
||||
if (rootList.size() > 0) {
|
||||
metadata = dynamic_cast<xmlpp::Element*> (rootList.front());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
metadata = rootNode->add_child("metadata");
|
||||
metadata->set_namespace_declaration(defaultPrefixUri);
|
||||
metadata->set_namespace_declaration(titleElementUri,
|
||||
|
|
|
@ -73,7 +73,7 @@ documentation and/or software.
|
|||
------------------------------------------------------------------------------
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.1 $
|
||||
Version : $Revision: 1.2 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Md5.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -198,8 +198,7 @@ void Md5::update (uint1 *input, uint4 input_length)
|
|||
transform (input+input_index);
|
||||
}
|
||||
buffer_index = 0; // so we can buffer remaining
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
input_index=0; // so we can buffer the whole input
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.25 $
|
||||
Version : $Revision: 1.26 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -109,8 +109,7 @@ Playlist :: configure(const xmlpp::Element & element)
|
|||
|
||||
if ((attribute = element.get_attribute(titleAttrName))) {
|
||||
title.reset(new const Glib::ustring(attribute->get_value()));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
title.reset(new const Glib::ustring(""));
|
||||
}
|
||||
|
||||
|
@ -276,17 +275,14 @@ Playlist::setLockedForEditing(const bool lockStatus)
|
|||
if (lockStatus == true) {
|
||||
if (isLockedForPlaying || isLockedForEditing) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
isLockedForEditing = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (isLockedForPlaying) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
isLockedForEditing = false;
|
||||
return true; // returns true also if playlist
|
||||
} // was already unlocked!
|
||||
|
@ -304,13 +300,11 @@ Playlist::setLockedForPlaying(const bool lockStatus)
|
|||
if (lockStatus == true) {
|
||||
if (isLockedForPlaying) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
isLockedForPlaying = true; // preserve LockedForEditing state
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
isLockedForPlaying = false; // restore LockedForEditing state;
|
||||
return true; // returns true also if playlist
|
||||
} // was already unlocked!
|
||||
|
@ -337,15 +331,14 @@ Playlist::valid(void) throw ()
|
|||
if (playlistElement->getType() == PlaylistElement::AudioClipType) {
|
||||
audioClip = playlistElement->getAudioClip();
|
||||
*runningTime += *(audioClip->getPlaylength());
|
||||
}
|
||||
else if (playlistElement->getType() == PlaylistElement::PlaylistType) {
|
||||
} else if (playlistElement->getType()
|
||||
== PlaylistElement::PlaylistType) {
|
||||
playlist = playlistElement->getPlaylist();
|
||||
if (!playlist->valid()) {
|
||||
return false;
|
||||
}
|
||||
*runningTime += *(playlist->getPlaylength());
|
||||
}
|
||||
else { // this should never happen
|
||||
} else { // this should never happen
|
||||
return false;
|
||||
}
|
||||
++it;
|
||||
|
@ -409,8 +402,7 @@ Playlist :: getMetadata(const string &key, const string &ns) const
|
|||
if (it != metadata.end()) {
|
||||
Ptr<Glib::ustring>::Ref data(new Glib::ustring(*it->second));
|
||||
return data;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Ptr<Glib::ustring>::Ref nullPointer;
|
||||
return nullPointer;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.9 $
|
||||
Version : $Revision: 1.10 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -135,8 +135,7 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
|||
eMsg += " XML element";
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
childNodes = element.get_children(playlistElementName);
|
||||
it = childNodes.begin();
|
||||
if (it != childNodes.end()) {
|
||||
|
@ -153,8 +152,7 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
|||
eMsg += " XML element";
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
std::string eMsg = "missing ";
|
||||
eMsg += audioClipElementName;
|
||||
eMsg += " or ";
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.28 $
|
||||
Version : $Revision: 1.29 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -371,8 +371,7 @@ TestStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
smilAudioClipUriAttrName,
|
||||
*(audioClip->getUri()) );
|
||||
++it;
|
||||
}
|
||||
else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
} else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
Ptr<Playlist>::Ref playlist
|
||||
= acquirePlaylist(sessionId, plElement
|
||||
->getPlaylist()
|
||||
|
@ -387,8 +386,7 @@ TestStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
smilPlaylistUriAttrName,
|
||||
*(playlist->getUri()) );
|
||||
++it;
|
||||
}
|
||||
else { // this should never happen
|
||||
} else { // this should never happen
|
||||
throw XmlRpcInvalidArgumentException(
|
||||
"unexpected playlist element type "
|
||||
"(neither audio clip nor playlist)");
|
||||
|
@ -442,8 +440,7 @@ TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
eMsg += "\n";
|
||||
}
|
||||
++it;
|
||||
}
|
||||
else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
} else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
try {
|
||||
releasePlaylist(sessionId, it->second->getPlaylist());
|
||||
}
|
||||
|
@ -452,8 +449,7 @@ TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
eMsg += "\n";
|
||||
}
|
||||
++it;
|
||||
}
|
||||
else { // this should never happen
|
||||
} else { // this should never happen
|
||||
eMsg += "unexpected playlist element type\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.23 $
|
||||
Version : $Revision: 1.24 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -1016,8 +1016,7 @@ WebStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
smilAudioClipUriAttrName,
|
||||
*(audioClip->getUri()) );
|
||||
++it;
|
||||
}
|
||||
else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
} else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
Ptr<Playlist>::Ref playlist
|
||||
= acquirePlaylist(sessionId, plElement
|
||||
->getPlaylist()
|
||||
|
@ -1032,8 +1031,7 @@ WebStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
smilPlaylistUriAttrName,
|
||||
*(playlist->getUri()) );
|
||||
++it;
|
||||
}
|
||||
else { // this should never happen
|
||||
} else { // this should never happen
|
||||
throw XmlRpcInvalidArgumentException(
|
||||
"unexpected playlist element type "
|
||||
"(neither audio clip nor playlist)");
|
||||
|
@ -1086,8 +1084,7 @@ WebStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
eMsg += "\n";
|
||||
}
|
||||
++it;
|
||||
}
|
||||
else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
} else if (plElement->getType() == PlaylistElement::PlaylistType) {
|
||||
try {
|
||||
releasePlaylist(sessionId, it->second->getPlaylist());
|
||||
}
|
||||
|
@ -1096,8 +1093,7 @@ WebStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
|
|||
eMsg += "\n";
|
||||
}
|
||||
++it;
|
||||
}
|
||||
else { // this should never happen
|
||||
} else { // this should never happen
|
||||
eMsg += "unexpected playlist element type\n";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue