removing redundant header parameter in Feed

pull/40/head
Nestal Wan 2013-04-29 00:13:34 +08:00
parent d4a7fae273
commit 443a85d558
5 changed files with 18 additions and 18 deletions

View File

@ -29,6 +29,7 @@ class DriveModel : public QAbstractItemModel
public :
DriveModel( ) ;
// QAbstractItemModel overrides
Qt::ItemFlags flags( const QModelIndex & index ) const ;
QVariant data( const QModelIndex& index, int role ) const ;
QVariant headerData( int section, Qt::Orientation orientation, int role ) const ;

View File

@ -29,7 +29,7 @@
#include "http/CurlAgent.hh"
#include "http/Header.hh"
#include "http/XmlResponse.hh"
//#include "http/XmlResponse.hh"
#include "protocol/Json.hh"
#include "protocol/OAuth2.hh"
@ -55,11 +55,9 @@ int main( int argc, char **argv )
OAuth2 token( refresh_token, client_id, client_secret ) ;
AuthAgent agent( token, std::auto_ptr<http::Agent>( new http::CurlAgent ) ) ;
/*
http::XmlResponse xml ;
agent.Get( feed_base + "/-/folder?max-results=50&showroot=true", &xml, http::Header() ) ;
Feed feed ;
feed.Start( &agent, feed_base + "/-/folder?max-results=50&showroot=true" ) ;
Feed feed( xml.Response() ) ;
do
{
// first, get all collections from the query result
@ -68,8 +66,8 @@ int main( int argc, char **argv )
Entry e( *i ) ;
qDebug() << e.Name().c_str() ;
}
} while ( feed.GetNext( &agent, http::Header() ) ) ;
*/
} while ( feed.GetNext( &agent ) ) ;
QApplication app( argc, argv ) ;
MainWnd wnd ;
wnd.show();

View File

@ -120,7 +120,7 @@ void Drive::SyncFolders( )
m_state.FromRemote( e ) ;
}
}
} while ( feed.GetNext( m_http, http::Header() ) ) ;
} while ( feed.GetNext( m_http ) ) ;
m_state.ResolveEntry() ;
}
@ -140,7 +140,7 @@ void Drive::DetectChanges()
if ( m_options["log-xml"].Bool() )
feed.EnableLog( "/tmp/file", ".xml" ) ;
feed.Start( m_http, http::Header(), feed_base + "?showfolders=true&showroot=true" ) ;
feed.Start( m_http, feed_base + "?showfolders=true&showroot=true" ) ;
m_resume_link = feed.Root()["link"].
Find( "@rel", "http://schemas.google.com/g/2005#resumable-create-media" )["@href"] ;
@ -151,7 +151,7 @@ void Drive::DetectChanges()
feed.begin(), feed.end(),
boost::bind( &Drive::FromRemote, this, _1 ) ) ;
} while ( feed.GetNext( m_http, http::Header() ) ) ;
} while ( feed.GetNext( m_http ) ) ;
// pull the changes feed
if ( prev_stamp != -1 )
@ -161,7 +161,7 @@ void Drive::DetectChanges()
if ( m_options["log-xml"].Bool() )
feed.EnableLog( "/tmp/changes", ".xml" ) ;
feed.Start( m_http, http::Header(), ChangesFeed(prev_stamp+1) ) ;
feed.Start( m_http, ChangesFeed(prev_stamp+1) ) ;
std::for_each(
changes.begin(), changes.end(),

View File

@ -20,6 +20,7 @@
#include "Feed.hh"
#include "http/Agent.hh"
#include "http/Header.hh"
#include "http/ResponseLog.hh"
#include "http/XmlResponse.hh"
#include "xml/NodeSet.hh"
@ -62,7 +63,7 @@ std::string Feed::Next() const
return nss.empty() ? "" : std::string(nss["@href"]) ;
}
void Feed::Start( http::Agent *http, const http::Header& auth, const std::string& url )
void Feed::Start( http::Agent *http, const std::string& url )
{
http::XmlResponse xrsp ;
http::ResponseLog log( &xrsp ) ;
@ -73,20 +74,20 @@ void Feed::Start( http::Agent *http, const http::Header& auth, const std::string
(boost::format( "-#%1%%2%" ) % m_log->sequence++ % m_log->suffix ).str(),
&xrsp ) ;
http->Get( url, &log, auth ) ;
http->Get( url, &log, http::Header() ) ;
m_root = xrsp.Response() ;
m_entries = m_root["entry"] ;
}
bool Feed::GetNext( http::Agent *http, const http::Header& auth )
bool Feed::GetNext( http::Agent *http )
{
assert( http != 0 ) ;
xml::NodeSet nss = m_root["link"].Find( "@rel", "next" ) ;
if ( !nss.empty() )
{
Start( http, auth, nss["@href"] ) ;
Start( http, nss["@href"] ) ;
return true ;
}
else

View File

@ -44,7 +44,7 @@ public :
public :
explicit Feed( const xml::Node& root ) ;
Feed( ) ;
void Start( http::Agent *http, const http::Header& auth, const std::string& url ) ;
void Start( http::Agent *http, const std::string& url ) ;
void Assign( const xml::Node& root ) ;
const xml::Node& Root() const ;
@ -53,7 +53,7 @@ public :
iterator end() const ;
std::string Next() const ;
bool GetNext( http::Agent *http, const http::Header& auth ) ;
bool GetNext( http::Agent *http ) ;
void EnableLog( const std::string& prefix, const std::string& suffix ) ;
@ -67,7 +67,7 @@ private :
std::auto_ptr<LogInfo> m_log ;
xml::Node m_root ;
xml::NodeSet m_entries ;
xml::NodeSet m_entries ;
} ;
class Feed::iterator : public boost::iterator_adaptor<