mirror of https://github.com/vitalif/grive2
Make Syncer return modified date (not needed)
parent
00311e8365
commit
81c2d57890
|
@ -463,7 +463,7 @@ void Resource::SyncSelf( Syncer* syncer, ResourceTree *res_tree, const Val& opti
|
||||||
if ( syncer )
|
if ( syncer )
|
||||||
{
|
{
|
||||||
if ( is_local )
|
if ( is_local )
|
||||||
syncer->Move( from, to->Parent(), to->Name() );
|
syncer->Move( from, to );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fs::rename( from->Path(), to->Path() );
|
fs::rename( from->Path(), to->Path() );
|
||||||
|
|
|
@ -53,7 +53,7 @@ public :
|
||||||
virtual void Download( Resource *res, const fs::path& file );
|
virtual void Download( Resource *res, const fs::path& file );
|
||||||
virtual bool EditContent( Resource *res, bool new_rev ) = 0;
|
virtual bool EditContent( Resource *res, bool new_rev ) = 0;
|
||||||
virtual bool Create( Resource *res ) = 0;
|
virtual bool Create( Resource *res ) = 0;
|
||||||
virtual bool Move( Resource* res, Resource* newParent, std::string newFilename ) = 0;
|
virtual bool Move( Resource* res, Resource* newRes ) = 0;
|
||||||
|
|
||||||
virtual std::auto_ptr<Feed> GetFolders() = 0;
|
virtual std::auto_ptr<Feed> GetFolders() = 0;
|
||||||
virtual std::auto_ptr<Feed> GetAll() = 0;
|
virtual std::auto_ptr<Feed> GetAll() = 0;
|
||||||
|
|
|
@ -89,7 +89,7 @@ bool Syncer2::Create( Resource *res )
|
||||||
return Upload( res );
|
return Upload( res );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Syncer2::Move( Resource* res, Resource* newParentRes, std::string newFilename )
|
bool Syncer2::Move( Resource* res, Resource* newRes )
|
||||||
{
|
{
|
||||||
if ( res->ResourceID().empty() )
|
if ( res->ResourceID().empty() )
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ bool Syncer2::Move( Resource* res, Resource* newParentRes, std::string newFilena
|
||||||
}
|
}
|
||||||
|
|
||||||
Val meta;
|
Val meta;
|
||||||
meta.Add( "title", Val(newFilename) );
|
meta.Add( "title", Val( newRes->Name() ) );
|
||||||
if ( res->IsFolder() )
|
if ( res->IsFolder() )
|
||||||
{
|
{
|
||||||
meta.Add( "mimeType", Val( mime_types::folder ) );
|
meta.Add( "mimeType", Val( mime_types::folder ) );
|
||||||
|
@ -110,14 +110,14 @@ bool Syncer2::Move( Resource* res, Resource* newParentRes, std::string newFilena
|
||||||
// Issue metadata update request
|
// Issue metadata update request
|
||||||
{
|
{
|
||||||
std::string addRemoveParents("");
|
std::string addRemoveParents("");
|
||||||
if (res->Parent()->IsRoot() )
|
if ( res->Parent()->IsRoot() )
|
||||||
addRemoveParents += "&removeParents=root";
|
addRemoveParents += "&removeParents=root";
|
||||||
else
|
else
|
||||||
addRemoveParents += "&removeParents=" + res->Parent()->ResourceID();
|
addRemoveParents += "&removeParents=" + res->Parent()->ResourceID();
|
||||||
if ( newParentRes->IsRoot() )
|
if ( newRes->Parent()->IsRoot() )
|
||||||
addRemoveParents += "&addParents=root";
|
addRemoveParents += "&addParents=root";
|
||||||
else
|
else
|
||||||
addRemoveParents += "&addParents=" + newParentRes->ResourceID();
|
addRemoveParents += "&addParents=" + newRes->Parent()->ResourceID();
|
||||||
http::Header hdr2 ;
|
http::Header hdr2 ;
|
||||||
hdr2.Add( "Content-Type: application/json" );
|
hdr2.Add( "Content-Type: application/json" );
|
||||||
http::ValResponse vrsp ;
|
http::ValResponse vrsp ;
|
||||||
|
@ -128,6 +128,9 @@ bool Syncer2::Move( Resource* res, Resource* newParentRes, std::string newFilena
|
||||||
) ;
|
) ;
|
||||||
valr = vrsp.Response();
|
valr = vrsp.Response();
|
||||||
assert( http_code == 200 && !( valr["id"].Str().empty() ) );
|
assert( http_code == 200 && !( valr["id"].Str().empty() ) );
|
||||||
|
Entry2 responseEntry = Entry2( valr ) ;
|
||||||
|
AssignIDs( newRes, responseEntry ) ;
|
||||||
|
newRes->SetServerTime( responseEntry.MTime() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public :
|
||||||
void DeleteRemote( Resource *res );
|
void DeleteRemote( Resource *res );
|
||||||
bool EditContent( Resource *res, bool new_rev );
|
bool EditContent( Resource *res, bool new_rev );
|
||||||
bool Create( Resource *res );
|
bool Create( Resource *res );
|
||||||
bool Move( Resource* res, Resource* newParent, std::string newFilename );
|
bool Move( Resource* res, Resource* newRes );
|
||||||
|
|
||||||
std::auto_ptr<Feed> GetFolders();
|
std::auto_ptr<Feed> GetFolders();
|
||||||
std::auto_ptr<Feed> GetAll();
|
std::auto_ptr<Feed> GetAll();
|
||||||
|
|
Loading…
Reference in New Issue