1565 Commits

Author SHA1 Message Date
Lukas Fleischer
e40646d30f Fix file name of the example hook
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-07 13:18:25 +01:00
Lukas Fleischer
cfd9fc316d Move example hook to contrib/hooks/
The contrib/ directory now contains another script that is not directly
related to hooks. Clean things up by placing example hooks in a separate
subdirectory.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-07 13:12:18 +01:00
Lukas Fleischer
812c6b1dd6 calcurse-caldav: Use -G and %(hash) to list hashes
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>
2016-02-05 19:12:12 +01:00
Lukas Fleischer
4ada3deda2 Fix %(hash) formatting of events
Actually print the hash instead of raw object data.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-05 19:11:43 +01:00
Lukas Fleischer
62f04c3f9a Support format specifiers in grep mode
Honor --format-* parameters when using the -G operation. In the case of
recurring items, the first occurrence is used.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-05 19:09:36 +01:00
Lukas Fleischer
e9c8197e4e Refactor grep mode
Split io_save_{apts,todo}() into functions that write raw data to a file
and functions that write formatted items to stdout such that one can
easily extend the grep mode for format string support in a follow-up
commit.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-05 19:06:54 +01:00
Lukas Fleischer
8bdf0c0b3b calcurse-caldav: Reword dry-run warning
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-02 08:16:08 +01:00
Lukas Fleischer
4671a02846 calcurse-caldav: Modernize format strings
Replace %-style string formatting with format().

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-01 19:11:27 +01:00
Lukas Fleischer
2cf7023b37 calcurse-caldav: Make synchronization more robust
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>
2016-02-01 19:11:27 +01:00
Lukas Fleischer
cb85175524 calcurse-caldav: Fix issues reported by pylint
Add missing parameter to remote_query() and fix various style issues.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-01 19:05:27 +01:00
Lukas Fleischer
19f239e490 po/calcurse.pot: Update message catalog
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-30 11:22:36 +01:00
Lukas Fleischer
978d24a9d2 Update copyright ranges
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-30 11:21:53 +01:00
Lukas Fleischer
fb54b56cac calcurse-caldav: Fix version check
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>
2016-01-28 19:30:29 +01:00
Lukas Fleischer
e491109718 Fix two iCal import tests
When importing iCal files, VTODO entries without an priority are now
imported with undefined priority (internally represented as zero), not
with lowest priority 9.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-28 18:40:46 +01:00
Lukas Fleischer
03c4465baf Fix behavior of --todo with an optional argument
The previous behavior of --todo was to always only list uncompleted
items, unless zero was specified as additional argument. Restore and
document this behavior.

Also, fix two tests that failed because the --todo output is now sorted.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-28 18:37:31 +01:00
Lukas Fleischer
41389abd55 args.c: Revise help/usage/version output
Remove obsolete options from the help text, add new options, clean
everything up, cut translatable strings into atomic chunks.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-28 08:55:54 +01:00
Lukas Fleischer
6061fec01d Add a --daemon command-line parameter
When specifying --daemon, calcurse immediately forks and runs the
notification daemon in the background.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-28 00:04:00 +01:00
Lukas Fleischer
d127ce9447 Display priority todo items above regular items
We now support todo items with undefined priority and currently display
them above todo items with a strictly positive priority. Change this and
always list items with a priority greater than zero first.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-27 23:56:39 +01:00
Lukas Fleischer
ebe483c058 Support sending notifications for all appointments
In 45417bc (Add configuration option to notify all appointments,
2011-07-31), we added an option that allows for choosing whether the
user receives notifications only for flagged or only for unflagged
appointments. Convert this setting into a three-state option and allow
the user to additionally enable notifications for *all* appointments.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-27 08:29:33 +01:00
Lukas Fleischer
e1bffdb52d sigs.c: Suppress compiler warning
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-26 22:10:07 +01:00
Lukas Fleischer
f0ec3247bc Support SIGUSR1 in daemon mode
In commit 7f62fb1 (Let SIGUSR1 trigger a reload, 2014-10-10), we added
support for reloading the data files by sending SIGUSR1 to an
interactive calcurse process. Add the same functionality to the daemon
mode.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-26 19:14:08 +01:00
Lukas Fleischer
3dbfc7c1f5 calcurse-caldav: Use calendar-multiget to obtain ETag
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>
2016-01-26 17:33:49 +01:00
Lukas Fleischer
304ff81836 calcurse-caldav: Fix property filter
Fix a TypeError that occurred during string formatting by putting
parentheses around the multi-line string.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-26 15:31:50 +01:00
Lukas Fleischer
8d2fc95d17 git-version-gen: Do not use echo -n
`echo -n` is non-portable and does not work under some operating
systems, such as OS X. Replace it with printf.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 21:59:29 +01:00
Lukas Fleischer
bfafec3ebf calcurse-caldav: Handle missing ETag gracefully
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>
2016-01-25 21:55:10 +01:00
Lukas Fleischer
4fff8ae4fe calcurse-caldav: Improve version check
Make sure that at least a current Git build of calcurse is used.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 21:02:30 +01:00
Lukas Fleischer
1a45713d1d calcurse-caldav: Print XML dump in debug mode only
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>
2016-01-25 20:17:53 +01:00
Lukas Fleischer
c176b130bb contrib/caldav/README: Minor improvements
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 20:03:46 +01:00
Lukas Fleischer
5e6a61eee9 calcurse-caldav: Fix comment on certificate checks
Clarify that ssl._create_unverified_context() was added in Python 3.4.3.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 19:59:38 +01:00
Lukas Fleischer
849459c63f calcurse-caldav: Support custom HTTP headers
Add support for specifying additional HTTP headers, such as the
User-Agent, in the configuration file.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 19:58:41 +01:00
Lukas Fleischer
475c341686 calcurse-caldav: Fix late retrieval of ETag
Fixes another regression introduced in badbd71 (calcurse-caldav: Add a
debug mode, 2016-01-23).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 13:08:17 +01:00
Lukas Fleischer
5abef70ee5 calcurse-caldav: Fix --init=keep-local
Fixes a regression introduced in badbd71 (calcurse-caldav: Add a debug
mode, 2016-01-23).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 10:55:32 +01:00
Lukas Fleischer
4a14103d38 calcurse-caldav: Fix duplicate Content-Type prefix
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-25 10:24:02 +01:00
Lukas Fleischer
2f82457bbc calcurse-caldav: Fix MIME type in requests
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>
2016-01-25 09:49:24 +01:00
Lukas Fleischer
7e7d21722a calcurse-caldav: Show debug output before checking status
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>
2016-01-24 13:44:27 +01:00
Lukas Fleischer
b9d80c3cf4 calcurse-caldav: Add XML declaration to requests
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-24 02:26:02 +01:00
Lukas Fleischer
84c0f8b5f8 calcurse-caldav: Prefix error messages with "error:"
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-23 16:58:01 +01:00
Lukas Fleischer
03e149d4e1 calcurse-caldav: Check response status
Bail out if the HTTP status code of any of the replies starts with a
digit other than 2.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-23 16:58:01 +01:00
Lukas Fleischer
2f4ca3c9c8 calcurse-caldav: Include command/path in the debug output
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-23 15:08:58 +01:00
Lukas Fleischer
c2e6b31357 calcurse-caldav: Ensure path always starts/ends with a slash
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-23 15:05:53 +01:00
Lukas Fleischer
badbd71275 calcurse-caldav: Add a debug mode
Dump all communication with the server to stdout if --debug is
specified.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-23 12:55:25 +01:00
Lukas Fleischer
448d470b61 calcurse-caldav: Fix parsing of the Verbose config option
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-23 11:21:13 +01:00
Lukas Fleischer
439197dc4c calcurse-caldav: Make InsecureSSL optional 2016-01-23 08:35:36 +01:00
Lukas Fleischer
dcdc792178 calcurse-caldav: Add a workaround for Python <3.4
Python versions prior to 3.4 do not check certificates by default and
thus do not support ssl._create_unverified_context(). Add a workaround.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-23 08:22:49 +01:00
Lukas Fleischer
d516a8ff87 Add a script to synchronize with CalDAV servers
Introduce calcurse-caldav, a Python script that can be used to
synchronize calcurse instances with CalDAV servers.

The script was tested with an instance of the Radicale CalDAV server but
it is still alpha software. Make backups before giving it a try!

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-22 18:44:42 +01:00
Lukas Fleischer
df1bc59812 Make automatic selection of todo items smarter
* Automatically focus new todo items after adding them to the list.
* Keep selection when an item is moved (e.g. by changing its priority).
* Focus the next item in the list when an item is removed.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 19:19:18 +01:00
Lukas Fleischer
25a049951c Improve ordering of todo items
* Show uncompleted items first.
* Order uncompleted and completed items by priority.
* Order items with the same priority alphabetically.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:52:24 +01:00
Lukas Fleischer
4bd8717d80 Hide "0." prefix of todo items with undefined priority
In the todo panel, all uncompleted items are currently prefixed with
their priorities. Drop this prefix from items with priority 0, i.e.
undefined priority.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:09:32 +01:00
Lukas Fleischer
1b75acf01b Save active view on the todo panel
Add a configuration option appearance.todoview and use it to
automatically save the currently active todo panel view and restore it
when restarting calcurse.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:09:23 +01:00
Lukas Fleischer
e3ac5542aa Support todo items with an undefined priority
In addition to priorities 1-9, support todo items without any specific
priority, internally represented by priority 0.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18 18:08:45 +01:00