restoreBackup client changes; part of #2183

This commit is contained in:
fgerlits 2007-02-13 13:10:13 +00:00
parent ce9518d23c
commit eadf37505c
2 changed files with 12 additions and 3 deletions

View file

@ -756,7 +756,7 @@ const std::string restoreBackupSessionIdParamName = "sessid";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the file name parameter in the input structure * The name of the file name parameter in the input structure
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string restoreBackupFileNameParamName = "filename"; const std::string restoreBackupChecksumParamName = "chsum";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the URL parameter in the input or output structure * The name of the URL parameter in the input or output structure
@ -2524,14 +2524,22 @@ WebStorageClient :: restoreBackupOpen(
Ptr<const Glib::ustring>::Ref path) const Ptr<const Glib::ustring>::Ref path) const
throw (XmlRpcException) throw (XmlRpcException)
{ {
std::ifstream ifs(path->c_str());
if (!ifs) {
ifs.close();
throw XmlRpcIOException("Could not read the playlist archive file.");
}
std::string md5string = Md5(ifs);
ifs.close();
XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpcValue result; XmlRpcValue result;
parameters.clear(); parameters.clear();
parameters[restoreBackupSessionIdParamName] parameters[restoreBackupSessionIdParamName]
= sessionId->getId(); = sessionId->getId();
parameters[restoreBackupFileNameParamName] parameters[restoreBackupChecksumParamName]
= std::string(*path); = md5string;
execute(restoreBackupOpenMethodName, parameters, result); execute(restoreBackupOpenMethodName, parameters, result);

View file

@ -256,6 +256,7 @@ RestoreBackupWindow :: restoreBackupClose(void) throw ()
try { try {
storage->restoreBackupClose(*token); storage->restoreBackupClose(*token);
token.reset();
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
signalError(e.what()); signalError(e.what());