Commit Graph

333 Commits (master)

Author SHA1 Message Date
Vitaliy Filippov 717a6a4793 Use vector<Entry> instead of iterator_adaptor to hide implementation details 2015-05-17 14:32:04 +03:00
Vitaliy Filippov dabaaac38f Cleanup Feed interface (remove some unused methods) 2015-05-17 12:29:00 +03:00
Vitaliy Filippov 6a15dd09a5 Split Resource to global (base/Resource) and API-specific ({drive,drive2}/Syncer) parts 2015-05-17 02:00:00 +03:00
Vitaliy Filippov f41e4f6dd3 Split Entry to v1::Entry1 and v2::Entry2 2015-05-16 21:10:38 +03:00
Vitaliy Filippov b0255d9699 Add Entry constructor for new Drive REST API 2015-05-16 19:38:43 +03:00
Vitaliy Filippov 2d8da5cab3 Remove doclist API specific fields from Entry class: kind, create_link, edit_link and alt_self 2015-05-16 12:35:41 +03:00
Vitaliy Filippov 770baca3fc Reduce syscalls slightly more (os::FileCTime is still left...) 2015-05-16 01:05:19 +03:00
Vitaliy Filippov 5bc503279a Remove JSON-C json wrappers, use YAJL for everything 2015-05-16 00:37:02 +03:00
Vitaliy Filippov ac1763f2c7 Merge https://github.com/visap/grive/commits/visa 2015-05-16 00:36:26 +03:00
Vitaliy Filippov f16f212281 use pkg-config also for finding json-c (fixes paths on debian) 2015-05-14 01:20:35 +03:00
Vitaliy Filippov c0c89c306c Remove useless swap() code 2015-05-14 01:10:09 +03:00
Vitaliy Filippov 400d9e0c0f Fix long/int cast errors 2014-07-23 14:51:13 +04:00
Vitaliy Filippov 459313ecf5 Find YAJL via pkg-config 2014-07-23 14:51:13 +04:00
Visa Putkinen 3775572f46 Retry upload on XML error instead of crashing
Sometimes the Google Drive API sends malformed XML which crashes grive.
This patch adds a simple try-catch to Resource::Upload that retries the
upload if an XML exception is thrown from AuthAgent::Put.
2013-11-27 00:15:24 +02:00
Visa Putkinen 84785ec473 Fix hang when upload receives HTTP 500
When an uploading PUT request got a HTTP 500 as reponse, grive hanged
forever inside libcurl. This was because the File parameter was not
rewound to 0 position on retry. The XmlResponse had to be cleared as
well.

Rewinding the File and clearing the XmlResponse were not enough to fix
the problem, because when retrying after 500, HTTP 410 Gone or 412
Precondition failed is often received, and CheckHttpResponse would throw
an exception that crashes grive. Therefore, I implemented a retry logic
to Resource::Upload that retries the whole upload transaction if 410 or
412 was received.
2013-11-27 00:15:24 +02:00
Visa Putkinen 645bb2e7d4 Add delay before auth token refresh
This is sometimes necessary to prevent too frequent requests.
2013-11-27 00:15:15 +02:00
Visa Putkinen 986ab4acc6 Log XML on parse failure 2013-11-25 00:18:47 +02:00
Visa Putkinen 8b434dad14 Reduce number of syscalls while scanning local files 2013-11-24 14:34:03 +02:00
Visa Putkinen c15bfbe8bc Ignore only .grive and .grive_state 2013-11-24 14:25:01 +02:00
Vitaliy Filippov 752eb3fdda Allow to sync just one directory in the root 2013-09-08 02:36:30 +04:00
Nestal Wan 27817e835f using the new Json classes for bgrive 2013-05-03 00:40:04 +08:00
Nestal Wan 6ba04dcfba added operator<< to print out json 2013-05-02 00:55:39 +08:00
Nestal Wan 6fa6e690c6 added json writer 2013-05-02 00:41:47 +08:00
Nestal Wan abfa9ce765 added ValResponse class to parse JSON from http 2013-05-02 00:04:42 +08:00
Nestal Wan 2d29692601 added yajl parser 2013-05-01 22:47:37 +08:00
Nestal Wan 540e3d82db added type conversion to supported types 2013-05-01 13:36:29 +08:00
Nestal Wan 658fb757e3 added Val class for generic representation of JSON, but there's some problems with maps 2013-05-01 01:56:34 +08:00
Nestal Wan d5ca8e0afa show title and mime in GUI 2013-04-30 00:13:13 +08:00
Nestal Wan 15b3b85807 UT compile fixes 2013-04-29 23:49:01 +08:00
Nestal Wan bba65c0cc7 show files now. working good. 2013-04-29 23:47:33 +08:00
Nestal Wan 93fe68ce4c fixing the problems with multiple parent 2013-04-29 23:47:33 +08:00
Nestal Wan 94d66f0d30 can show tree now, but still has issues 2013-04-29 23:47:33 +08:00
Nestal Wan 326ae20ca7 showing in qt model, but no child 2013-04-29 23:47:33 +08:00
Nestal Wan ee6408d05f changed to store parent IDs 2013-04-29 23:47:33 +08:00
Nestal Wan 87d96972f7 Added Query() helper to Feed. and common URI header 2013-04-29 23:47:33 +08:00
Nestal Wan 209d0b5a59 added code to fetch all folders 2013-04-29 23:47:33 +08:00
Nestal Wan 62dc542341 refactored old GDoc API into v1 namespace. using v2 namespace for new Google Drive API 2013-04-29 23:47:33 +08:00
Nestal Wan 738435837b using DataStream instead of Receiveable 2013-04-29 23:47:32 +08:00
Nestal Wan 443a85d558 removing redundant header parameter in Feed 2013-04-29 23:47:32 +08:00
Nestal Wan d4a7fae273 refactored exception handling 2013-04-29 23:47:32 +08:00
Nestal Wan 755ee1c9ad new qt gui 2013-04-29 23:47:32 +08:00
justin 29f17397c1 fix broken unit tests 2012-08-01 20:46:59 +01:00
Nestal Wan 804fe923f2 refactored the config file part from #109 2012-07-30 16:52:59 +08:00
Nestal Wan 612b35a090 fixed compiler warnings 2012-07-30 16:43:51 +08:00
Nestal Wan bec8362639 added template contructor for object 2012-07-30 16:43:36 +08:00
Nestal Wan 0b2a8c0a54 clean up on #109 2012-07-30 15:24:47 +08:00
justin 034891a610 issue 86 allow sync folder to be specified, move Config class and add basic unit test 2012-07-29 18:17:41 +01:00
justin e0383a843c remove unused code 2012-07-29 17:53:02 +01:00
Nestal Wan d831b8d59f support creating revisions with --new-rev (#87) 2012-07-27 00:45:53 +08:00
Nestal Wan fd81cc1fe4 added --log-xml for debugging (#80) 2012-07-27 00:17:44 +08:00
Nestal Wan 5a0c6ae56e don't throw in CurlAgent for all HTTP errors (#82) 2012-07-26 01:25:44 +08:00
Nestal Wan 51e42914f3 refreshing the token if HTTP 401 is returned (#83) 2012-07-23 16:00:21 +08:00
Nestal Wan 3acd25cb55 proper fix for (#98: missing reference count for Json::Get() ) 2012-07-23 15:43:11 +08:00
justin 96227d38cf store modified time of file in m_mtime instead of passing value as param 2012-07-19 22:22:34 +01:00
Nestal Wan c6a1c47d40 added retry on HTTP 500 & 503 (#82) 2012-07-20 00:50:40 +08:00
Nestal Wan 28e8012ca5 added AuthAgent, a wrapper around http agent 2012-07-20 00:39:36 +08:00
Nestal Wan 57c431dd83 added logs for tracing last sync time 2012-07-19 23:48:01 +08:00
Jan Winkler 2f94168599 Set up an else-clause for IBERTY_LIBRARY and removed unnecessary BOOST-find
In ./CMakeLists.txt the added find_package( Boost ) was removed due to being unnecessary. In libgrive/CMakeLists.txt the IBERTY_LIBRARY is now set to an empty string of it was not found (otherwise the linker breaks during `cmake').
2012-07-19 17:19:40 +02:00
Jan Winkler 56de93c8c7 Commented out iberty_library stuff
The iberty_library could not be found anywhere in my repos or on my system. Compiles and runs fine without.
2012-07-19 16:51:03 +02:00
Nestal Wan 7cc4984932 use mmap for checksum 2012-07-17 01:59:00 +08:00
Nestal Wan ce245576b5 use StdioFile for uploading (#88) 2012-07-17 01:58:16 +08:00
Nestal Wan 75c67dad8d added class & functions for memory mapped files 2012-07-17 01:08:34 +08:00
Nestal Wan 94383e0030 ignoring files with missing MD5 checksum in remote feeds 2012-07-16 23:37:50 +08:00
Nestal Wan 593c335a5e improved logging for HTTP responses 2012-07-16 23:23:08 +08:00
Nestal Wan 394982da4e added _FILE_OFFSET_BITS=64 (#88) 2012-07-16 22:30:30 +08:00
justin e28fe96260 fix deleted local file downloaded again 2012-07-15 17:33:33 +01:00
Nestal Wan 80f3fbf370 refactored the logs to debug sync problems 2012-07-12 00:36:58 +08:00
Nestal Wan 278037b07b fixed incorrect name in pdf files 2012-07-12 00:30:19 +08:00
Ben L 06bf4fe58d Fix empty filenames for Google Docs 2012-07-03 13:42:16 -05:00
Nestal Wan daa1fe9ca3 refactored a bit for the fix in #76 2012-06-27 23:18:12 +08:00
Georges Dubus 34be2e7a87 Fixed a bug where grive crashed on the first run.
It gived a negative start index to get the changes feed, which is
illegal. The error returned by the server triggered a crash.

Fixes #76.
2012-06-27 14:17:13 +02:00
Nestal Wan 460a4fd8f2 save the changestamp after sync (#68) 2012-06-26 00:13:18 +08:00
georg wiltschek 6ecbd8d0ea depending on libboost 1.40 seems no worse than on 1.42 but makes compiling much easier on ubuntu 10.04 :-) 2012-06-25 09:59:22 +02:00
Nestal Wan 1d1365ea1a refactored code in Update() to DetectChanges() 2012-06-23 18:23:43 +08:00
Erik Hardesty 62238c5ba6 Move update logic out of Grive constructor
This is to make it easier to repeatedly sync the
directory when used in a daemon-like setting without
reinstantiating the class
2012-06-21 18:47:01 -05:00
Nestal Wan 6850785667 added zlib for SUSE (#63) 2012-06-21 23:39:53 +08:00
Nestal Wan c5a5221f4b disable an unimportant assertion and replace it with a warning 2012-06-20 22:46:17 +08:00
Nestal Wan a799e7a611 fixed boost fs v2 compile error found by pavel.savara 2012-06-20 22:02:42 +08:00
Nestal Wan 55c0f4e6d5 mark folder and its children as created/deleted recursively (#61) 2012-06-18 23:44:28 +08:00
Nestal Wan 023c208d85 fixed assertion on dry-runs 2012-06-18 23:17:28 +08:00
Nestal Wan dfe89b19b9 don't install the headers when "make install" (#67) 2012-06-18 22:39:43 +08:00
Nestal Wan e388d0bf34 added mock agents for unit tests 2012-06-17 16:34:57 +08:00
Nestal Wan 48391bb16f added more log for dry-run (#65) 2012-06-17 16:33:38 +08:00
Nestal Wan 55ac367255 escape the directory names when uploading (#66) 2012-06-17 15:58:27 +08:00
Nestal Wan 277274f026 fixed handling on changes feed. 2012-06-15 00:55:00 +08:00
Nestal Wan ea4fda5b54 fix recursively add folder (#59) 2012-06-14 01:42:41 +08:00
Nestal Wan 5740d7b77f cherry-picked commits from petrj (#60) 2012-06-12 23:53:32 +08:00
Nestal Wan 72052edf37 removed signal handler 2012-06-12 01:24:27 +08:00
Nestal Wan a79edc9c2b merged compile fixes from LemonBoy #58 2012-06-11 23:37:15 +08:00
LemonBoy 6157dc57f3 Fix some compilation issues. 2012-06-10 19:50:26 +02:00
Nestal Wan b0c0353fdb seems like the changes handling is still not perfect 2012-06-11 00:52:04 +08:00
Nestal Wan 8d822e3582 now sync'ing folder is the same as sync'ing files 2012-06-11 00:40:56 +08:00
Nestal Wan 991d8e444f recursively sync the resources 2012-06-10 23:38:27 +08:00
Nestal Wan 7be193c35b added unit test case 2012-06-10 23:11:32 +08:00
Nestal Wan f0ce00ca7b improved support for changes feed 2012-06-10 21:13:47 +08:00
Nestal Wan 55572c7fc4 refactored. Resource does not contain Entry 2012-06-10 21:13:46 +08:00
Nestal Wan a863939b05 "fixed" UT 2012-06-10 21:13:46 +08:00
Nestal Wan 5f61be489b check for broken link when iterating directory (#55) 2012-06-10 21:12:32 +08:00
Nestal Wan 89e07bb257 removed OpenSSL in Download.cc 2012-06-10 15:36:37 +08:00
Nestal Wan 6aaf84aae5 added grive version and build time in log file 2012-06-09 14:43:04 +08:00
Nestal Wan e259478fb3 removed redundant function 2012-06-09 14:23:39 +08:00
Nestal Wan facdf88058 log uploading of files 2012-06-09 11:02:18 +08:00
Nestal Wan 271dd95b24 escape the document header. fix HTTP 400 when uploading 2012-06-07 18:26:57 +08:00
Nestal Wan 3d27b1af69 force using boost v1.44 or later (#51) 2012-06-07 17:56:03 +08:00
Nestal Wan d24440fa48 added static library (by Jose) 2012-06-07 00:14:21 +08:00
Nestal Wan 01effa1f60 revised the log messages 2012-06-06 23:40:17 +08:00
Nestal Wan c81bb0aaec fixed assertion if remote has dot file (#43) 2012-06-06 23:35:29 +08:00
Nestal Wan 856914c4dc added catch exception for auth code 2012-06-06 23:21:04 +08:00
Nestal Wan b6aafd7ccd fix MD5 and remote XML dump 2012-06-05 23:29:37 +08:00
Nestal Wan 8ff04683a8 removing debug code and minor fixes 2012-06-05 23:08:03 +08:00
Nestal Wan cbf40e9b90 fixed uninitialized change stamp 2012-06-05 22:52:14 +08:00
Nestal Wan 935ac608ff handling change feed. some good news about trashed documents 2012-06-05 22:52:14 +08:00
Nestal Wan a09ba40dbc use libgcrypt instead of OpenSSL 2012-06-05 22:51:54 +08:00
Nestal Wan 5cba612084 adding the Feed class 2012-06-04 01:07:14 +08:00
Nestal Wan 8466095e7b adding change stamp 2012-06-03 23:58:28 +08:00
Nestal Wan 28b32c6f43 recursive delete handling for remote_deleted 2012-06-03 21:53:51 +08:00
Nestal Wan 197abfdea6 removed debug verbose setting in curl 2012-06-03 18:34:03 +08:00
Nestal Wan 379dddc532 fully configurable log 2012-06-03 18:31:02 +08:00
Nestal Wan 53f9c39941 disable debug log during authenication 2012-06-03 17:31:16 +08:00
Nestal Wan 54b65bb738 update the resource by a GET before deleting it 2012-06-03 16:57:21 +08:00
Nestal Wan c17ba4e880 added the http::Header class. should add it long ago. 2012-06-03 16:42:51 +08:00
Nestal Wan 81f71f8406 fixed missing assignment of entry IDs 2012-06-03 15:55:32 +08:00
Nestal Wan 3d7ad69915 don't delete the file if its parent folder will be deleted 2012-06-03 14:44:09 +08:00
Nestal Wan 15c582159a don't log debug info by default 2012-06-02 10:31:37 +08:00
Nestal Wan 88cdb576c4 use ctime instead of mtime to detect changes 2012-06-01 23:30:04 +08:00
Matchman Green da6c99089f enabled code to "delete" files 2012-06-01 00:40:07 +08:00
Matchman Green 59d0761d68 minor refactoring 2012-05-31 23:48:30 +08:00
Matchman Green 6db0b4a7aa refactored the creation of resources 2012-05-31 23:37:47 +08:00
Matchman Green 7830136518 fixed the log messages and some state update 2012-05-31 19:22:18 +08:00
Matchman Green 7e5b7e0b7d should be able to detect new and deleted files correctly now 2012-05-31 01:17:22 +08:00
Matchman Green 8b1b388713 not tracking the status of all files/dir in .grive_state 2012-05-30 01:30:06 +08:00
Matchman Green 167e2eaac5 fixed create subfolder & seg fault 2012-05-29 00:31:29 +08:00
Matchman Green 07553e51fa ignore file and folders with '/' 2012-05-28 00:36:02 +08:00
Matchman Green bb6124c02c can now create new folders 2012-05-28 00:24:37 +08:00
Matchman Green 729ec106f8 no need to check MD5 or mtime for folders 2012-05-27 22:49:49 +08:00
Matchman Green e09bdc5a8a trying to add fdopen 2012-05-27 14:55:26 +08:00
Matchman Green d78728938f added resource test 2012-05-25 01:24:59 +08:00
Matchman Green 61c01019f7 added more test cases and some minor refactoring 2012-05-25 01:24:59 +08:00
Matchman Green 050c89c3d8 trying to make libiberty optional 2012-05-25 00:56:19 +08:00
Matchman Green 97884cf25c improved HTTP error handling to troubleshoot issue #31 2012-05-24 23:50:23 +08:00
Matchman Green ade83c6d70 added libiberty. now can be built in OpenSUSE 12.1.
Thanks Arif Widi Nugroho for the help!
2012-05-24 23:25:49 +08:00
Matchman Green 50f1d813e2 set the mode of .grive to 0600 for security.
Thanks Huin for the reminder.
2012-05-24 19:06:03 +08:00
Matchman Green a0570d507c Revert "Add OS notification support (libnotify)"
This reverts commit 428afa6538.
2012-05-24 18:57:37 +08:00
Matchman Green a49794897a added Chmod for files 2012-05-24 18:56:48 +08:00
daniele 428afa6538 Add OS notification support (libnotify) 2012-05-24 18:10:30 +08:00
Matchman Green 3c769a720a remove Gdbm stuff as it won't compile on some system 2012-05-24 17:52:04 +08:00
Matchman Green c01ace7d18 can upload new files to remote 2012-05-21 01:18:16 +08:00
Matchman Green c7c49b094a fixed upload 2012-05-21 00:10:29 +08:00
Matchman Green 99f6e4cc58 improved logging and fixed exception on MD5 calculation 2012-05-20 23:16:59 +08:00
Matchman Green 90bf78e716 minor clean up 2012-05-20 19:28:44 +08:00