aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/caldav
Commit message (Collapse)AuthorAgeFilesLines
* calcurse-caldav: add HTTP supportDino Macri2018-07-221-6/+18
| | | | | | | | | | | Introduce support for HTTP connections. Use "HTTPS" in the config file to enable/disable (default is enabled). The option modifies the prefix of the host name to "http://" when disabled, rather than always using "https://" with no option to change. httplib2 automatically handles URLs beginning with either http or https. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: remove authorization data from logsLukas Fleischer2018-05-231-1/+7
| | | | | | | | The Authorization header contains the Base64-encoded user name and password. Remove this information from debug logs, unless the user explicitly requests to keep them by using the --debug-raw flag. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Avoid corrupting the sync DBLukas Fleischer2017-11-231-2/+9
| | | | | | | | | When importing an iCal event via calcurse fails (i.e. does not return a single object hash), do not write anything to the synchronization database instead of blindly appending the entry, thereby potentially corrupting the database. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* contrib/caldav/README.md: Fix localhost URIRaf Czlonka2017-11-111-1/+1
| | | | | Signed-off-by: Raf Czlonka <rczlonka@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Document external password optionRandy Ramos2017-11-101-0/+8
| | | | | | | Add information about the CALCURSE_CALDAV_PASSWORD environment variable. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Read password from env variableRandy Ramos2017-11-101-3/+4
| | | | | | | | Add the option to read the basic authentication password from the CALCURSE_CALDAV_PASSWORD environment variable. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Revert "calcurse-caldav: Add --password command line argument"Lukas Fleischer2017-11-081-5/+3
| | | | | | | | | | This reverts commit efd76a0d995292e48f5466fccada4901618f7d97. Passing passwords as command line arguments is not a good idea, since they may appear in process listings which are potentially visible to other users logged into the system. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Add SyncFilter config optionSatvik Sharma2017-11-053-12/+53
| | | | | | | | The SyncFilter option filters the types of items synced from/to a CalDAV server by making use of the --filter-type command line argument. Signed-off-by: Satvik Sharma <satvik.sharma2@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Use /usr/bin/env in the shebangStefan Hagen2017-11-051-1/+1
| | | | | | | | | | | | It is best practice to use `/usr/bin/env python3` instead of a hard coded path. This will search for "python3" in the PATH environment variable. Most Linux distributions install python to "/usr/bin". Most BSDs to "/usr/local/bin". Signed-off-by: Stefan Hagen <github@textmail.me> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Add --password command line argumentRandy Ramos2017-10-191-3/+5
| | | | | | | | The "--password" argument overrides the corresponding option in the config file. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update calcurse-caldav documentation for OAuth2Randy Ramos2017-09-081-0/+90
| | | | | | | | Append instructions and information on synchronization with OAuth2-based services, specifically Google Calendar. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Rename README to README.mdRandy Ramos2017-09-081-2/+2
| | | | | | | | | This ensures that the Markdown syntax is properly displayed by Github and other Markdown readers. Also added quotes to a couple of paths and a flag. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add OAuth2 support for calcurse-caldavRandy Ramos2017-09-082-0/+124
| | | | | | | | | OAuth2 authentication is completely optional. It is controlled by the AuthMethod option in the config file. Other required options were appended to config.sample. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Refactor calcurse-caldav to use httplib2Randy Ramos2017-09-082-29/+17
| | | | | | | | | | This will allow much more flexibility and less code duplication when adding OAuth2 support. OAuth2 support will require this library as it is a dependency of oauth2client. The documentation was updated to reflect the new dependency. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Change remote_wipe to delete objects individuallyRandy Ramos2017-09-081-1/+3
| | | | | | | | | Certain CalDAV servers prohibit a single DELETE request to be sent to the calendar collection root. Instead items need to be deleted one by one. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* URL encode href before saving to sync.dbRandy Ramos2017-09-081-1/+2
| | | | | | | | | | When pushing objects, the unencoded uri path would be saved into the sync.db. The unencoded path and the encoded path from the server would be seen as two different objects, causing both to be resynced unnecessarily. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Specify depth in the initial requestLukas Fleischer2017-08-281-1/+3
| | | | | | | | | | For the initial calendar-query request, set the Depth header to 1. This is required because according to RFC 4791, the depth value defaults to 0 if no header is specified. Fixes GitHub issue #38. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Use right diffs when synchronizingLukas Fleischer2016-12-151-8/+8
| | | | | | | | | | | Some parameters where swapped accidentally when reworking the diff computation in c8d3d87 (calcurse-caldav: Compute diffs before synchronizing, 2016-12-13) such that the synchronization functions were working with incorrect diffs since that commit. Exchange the parameters again to fix this. Reported-by: Guillaume Laurès <guillaume@lauresfamily.fr> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix scrambled commentLukas Fleischer2016-12-131-2/+2
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Compute diffs before synchronizingLukas Fleischer2016-12-131-31/+29
| | | | | | | | Instead of computing the objects to push/pull on-demand, use a snapshot of the synchronization database taken before the synchronization process starts. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix appointment importsLukas Fleischer2016-12-081-0/+1
| | | | | | | | When importing an appointment from the server, make sure we store a hash of the item in the sync DB, and not the serialized item itself. Reported-by: Guillaume Laurès <guillaume@lauresfamily.fr> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Add debug output for sync DB operationsLukas Fleischer2016-12-081-5/+17
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Avoid empty multigetLukas Fleischer2016-12-081-0/+3
| | | | | | | When there are no new objects to pull from the server, skip the import routine instead of sending a query that requests zero items. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Split object addition and removalLukas Fleischer2016-12-081-18/+34
| | | | | | | | | | | | | | Instead of performing two synchronization steps (push/pull), split the synchronization protocol into four steps: 1. Retrieve new objects from the server. 2. Delete local objects that no longer exist on the server. 3. Push new objects to the server. 4. Delete remote objects that no longer exist locally. Each of the steps is performed by a separate function. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Encode the request body in UTF-8Lukas Fleischer2016-06-181-0/+3
| | | | | | | | | When a string is passed to HTTPConnection.request(), it is automatically ISO 8859-1 encoded. Therefore, since we already specify UTF-8 as character set in the headers, we need to UTF-8 encode the request body manually. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Document the hooks featureLukas Fleischer2016-04-011-1/+16
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Support format strings when dumping imported itemsLukas Fleischer2016-02-111-1/+5
| | | | | | | | | | | | | | In commit 3eae7ce (Add --list-imported command line option, 2016-01-12), we added an option to print the hashes of imported items to stdout. Extend this command line option such that it dumps the items using the specified formatting strings. With the new behavior it is, for example, easier to check items for import errors. Also, rename the option from --list-imported to --dump-imported (it is not part of any official release yet so we do not need to care about backwards compatibility). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Install calcurse-caldav by defaultLukas Fleischer2016-02-091-0/+13
| | | | | | | Add a new Makefile to build and install calcurse-caldav and include it in the top-level build process. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Improve example hooksLukas Fleischer2016-02-081-6/+11
| | | | | | | | | | | | The post-save and post-sync hooks now automatically detect whether the data directory contains a .git/ directory and skip the commit creation process if it does not. The post-save hook and the new pre-load hook now also run calcurse-caldav in the background if that script is available and the data directory contains a caldav/ directory. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Do not put all files under version control in example hooksLukas Fleischer2016-02-071-1/+1
| | | | | | Modify the Git hooks such they only add known data files to the index. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Add hook supportLukas Fleischer2016-02-072-0/+30
| | | | | | | | | | | Introduce pre-sync and post-sync hooks which need to be located under ~/.calcurse/caldav/hooks/ and are executed before/after synchronization with a CalDAV server. Also, add an example post-sync hook and change the example post-save hook such that it does not create tiny commits during synchronization. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Use -G and %(hash) to list hashesLukas Fleischer2016-02-051-13/+7
| | | | | | | | Instead of reimplementing the code to generate object hashes in the synchronization script, use format strings to print the hashes in grep mode. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Reword dry-run warningLukas Fleischer2016-02-021-3/+3
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Modernize format stringsLukas Fleischer2016-02-011-20/+21
| | | | | | Replace %-style string formatting with format(). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Make synchronization more robustLukas Fleischer2016-02-011-52/+83
| | | | | | | | | | In addition to storing ETag-hash tuples in the synchronization database, also store the URI of each object. This makes the synchronization process a bit more robust as we do not need to depend on ETags being globally unique. It also allows us to detect conflicts which occur when an object is modified locally and on the server at the same time. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix issues reported by pylintLukas Fleischer2016-02-011-29/+50
| | | | | | Add missing parameter to remote_query() and fix various style issues. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix version checkLukas Fleischer2016-01-281-1/+1
| | | | | | | Since commit 41389ab (args.c: Revise help/usage/version output, 2016-01-28), the version string starts with "calcurse" (lowercase). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Use calendar-multiget to obtain ETagLukas Fleischer2016-01-261-14/+17
| | | | | | | | Some CalDAV servers do not support calendar-query with a UID filter. Use a calendar-multiget request to obtain the ETag of submitted objects instead. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix property filterLukas Fleischer2016-01-261-3/+3
| | | | | | | Fix a TypeError that occurred during string formatting by putting parentheses around the multi-line string. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Handle missing ETag gracefullyLukas Fleischer2016-01-251-1/+4
| | | | | | | | | | This was partly fixed by 475c341 (calcurse-caldav: Fix late retrieval of ETag, 2016-01-25). However, the case where the server does not return ETag after creating a new item still wasn't handled properly. This patch hopefully addresses this and also makes sure that the ETag header is matched case-insensitively. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Improve version checkLukas Fleischer2016-01-251-11/+7
| | | | | | Make sure that at least a current Git build of calcurse is used. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Print XML dump in debug mode onlyLukas Fleischer2016-01-251-1/+1
| | | | | | | | In die_atnode(), we currently print a full dump of the XML node if verbose mode is enabled. Change this behavior such that a dump is only created in debug mode. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* contrib/caldav/README: Minor improvementsLukas Fleischer2016-01-251-5/+5
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix comment on certificate checksLukas Fleischer2016-01-251-1/+1
| | | | | | Clarify that ssl._create_unverified_context() was added in Python 3.4.3. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Support custom HTTP headersLukas Fleischer2016-01-252-1/+11
| | | | | | | Add support for specifying additional HTTP headers, such as the User-Agent, in the configuration file. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix late retrieval of ETagLukas Fleischer2016-01-251-2/+2
| | | | | | | Fixes another regression introduced in badbd71 (calcurse-caldav: Add a debug mode, 2016-01-23). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix --init=keep-localLukas Fleischer2016-01-251-1/+1
| | | | | | | Fixes a regression introduced in badbd71 (calcurse-caldav: Add a debug mode, 2016-01-23). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix duplicate Content-Type prefixLukas Fleischer2016-01-251-2/+2
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Fix MIME type in requestsLukas Fleischer2016-01-251-1/+4
| | | | | | | Specify application/xml in the Content-Type of requests except for PUT, where we actually submit calendar data. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Show debug output before checking statusLukas Fleischer2016-01-241-5/+5
| | | | | | | Make sure we print the headers and the body of a HTTP response in debug mode, even if the HTTP status code indicates failure. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>