1822 Commits

Author SHA1 Message Date
Lukas Fleischer
e4e2e0eb20 Gracefully parse iCal parameters with colons
According to RFC 5545, iCalendar content lines can have optional
parameters, which can be quoted strings containing colons (":"). Make
sure that such colons are not interpreted as delimiters marking the
start of the value string.

Also, add a test case that covers this corner case.

Reported-by: Håkan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-02-07 21:54:05 +01:00
Lukas Fleischer
3375fddb4e Release 4.2.2
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-01-14 14:09:46 +01:00
Lukas Fleischer
9f6678bc49 Update copyright ranges
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-01-12 08:40:30 +01:00
Lukas Fleischer
e2086c426c calcurse-caldav: Use right diffs when synchronizing
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>
2016-12-15 18:41:24 +01:00
Lukas Fleischer
6a80e156dd calcurse-caldav: Fix scrambled comment
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-12-13 18:47:38 +01:00
Lukas Fleischer
c8d3d87c84 calcurse-caldav: Compute diffs before synchronizing
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>
2016-12-13 18:32:12 +01:00
Lukas Fleischer
338e556f8d calcurse-caldav: Fix appointment imports
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>
2016-12-08 21:43:35 +01:00
Lukas Fleischer
e70b41bda9 calcurse-caldav: Add debug output for sync DB operations
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-12-08 16:22:00 +01:00
Lukas Fleischer
9fdb714aea calcurse-caldav: Avoid empty multiget
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>
2016-12-08 16:22:00 +01:00
Lukas Fleischer
7b5602ae17 calcurse-caldav: Split object addition and removal
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>
2016-12-08 16:22:00 +01:00
Lukas Fleischer
8cd7c76db3 Release 4.2.1
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-30 12:08:12 +01:00
Lukas Fleischer
fd97187bcd Fix visible region after loading list box items
Make sure the visible region is updated after loading items, e.g. when
the users switches from the full todo list to the "uncompleted items
only" view.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-30 11:57:01 +01:00
Lukas Fleischer
cf75caeb61 Fix listbox_fix_visible_region()
Make sure that listbox_fix_visible_region() always updates the visible
region to show the entire list if it fits into the box. Also, reuse
listbox_fix_visible_region() in listbox_resize() instead of duplicating
the code.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-30 11:56:02 +01:00
Lukas Fleischer
0d74c14fd1 Do not start the daemon more than once
Avoid starting multiple daemon instances if the --daemon argument is
passed and the daemon is already running. Terminate the already running
instance before spawning a new one instead.

Suggested-by: Vlad Glagolev <scm@vaygr.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-19 18:19:02 +02:00
Lukas Fleischer
095576b945 calcurse.1.txt: Document --daemon
Mention the --daemon command line parameter in the man page. This was
forgotten when adding the flag in 6061fec (Add a --daemon command-line
parameter, 2016-01-28).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-19 18:13:02 +02:00
Lukas Fleischer
39d3007318 Prevent segfault when all todo items are hidden
To prevent from illegal memory access, we checked whether the list of
todo items is empty before performing an interactive todo item action
such as flagging or removal. However, since 1a4bf2b (Add a "hide
completed" view to the todo panel, 2016-01-17), it is possible to hide
completed items from the todo panel. Thus, it may occur that the todo
list box is empty while the list of todo items is not.

To detect such situations as well, teach todo_get_item() to return NULL
if the requested item does not exist. Then, instead of checking whether
the todo item list is non-empty, make sure that the item returned by
todo_get_item() is non-NULL when performing an action.

Reported-by: Vlad Glagolev <scm@vaygr.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-14 20:29:50 +02:00
Lukas Fleischer
9ef5fe2191 Always use memory management wrappers
Use mem_*() wrappers instead of directly accessing libc functions when
allocating/deallocating memory.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-13 19:51:43 +02:00
Vlad Glagolev
da6334cf38 Prevent free-before-init of timstr
Fixes a crash when editing the repetition of an appointment and passing
an empty repetition value.

Signed-off-by: Vlad Glagolev <scm@vaygr.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-13 06:44:26 +02:00
Lukas Fleischer
32dcdff20b Release 4.2.0
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-10 22:02:07 +02:00
Lukas Fleischer
89efd4e612 Update message catalog
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-10 22:00:15 +02:00
Lukas Fleischer
007a73f7a2 Replace parse_datetime() constants by named flags
Remove the magic constants used in the return value of parse_datetime()
and use named flags instead.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-10 09:02:42 +02:00
Lukas Fleischer
48bd82a003 Refactor duration/end time parsing
Replace all remaining invocations of parse_time() by parse_datetime()
which now indicates whether a date was supplied or not.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-10 09:02:42 +02:00
Lukas Fleischer
adf29c8ee9 Support dates when specifying start/end times
Add support for combined date/time or date-only strings when specifying
the start or end time of a new item.

This is a follow-up to 1f39b5c (Add support for moving items to another
day, 2016-09-30).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-09 20:21:04 +02:00
Lukas Fleischer
343d68596d Factor out parse_datetime()
Create a new function that takes a time stamp and updates the date or
time components of that time stamp according to a given date/time
string. Use that function for updating the start time of an item.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-09 18:12:45 +02:00
Lukas Fleischer
1f39b5c668 Add support for moving items to another day
When moving an item (or when changing the start time of an item), allow
for optionally specifying a date. If both date and time are entered, the
item is updated to start on the given date and time. If only a date is
entered, the item is modified to start on the given date, keeping the
current start time. If only a time is entered, the item is modified to
start on the current date and the new start time.

Fixes GitHub issue #12.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-08 14:42:51 +02:00
Lukas Fleischer
1003be18df Refactor day_edit_time()
Make the function more flexible by returning the updated time instead of
single hour and minute components.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-10-01 09:00:23 +02:00
Lukas Fleischer
1af9ccccd7 Automatically select new appointments/events
This is a follow-up to commit 65b699f (Make automatic selection of
appointments/events smarter, 2016-02-16). Newly created appointments and
events are now selected automatically.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-09-28 19:03:20 +02:00
Lukas Fleischer
ab9256adf0 Fix out-of-bounds memory access
Do not try to access freed day items. This also fixes unexpected
selection changes after modifying appointments or events.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-09-28 19:02:04 +02:00
Lukas Fleischer
77d5b10ee0 Fix key binding pagination
Do not create an empty key bindings page if the number of bindings is a
multiple of the number of slots per page.

Also, add comments to explain the computation.

Reported-by: Kevin Wang <kevin.wang2004@hotmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-09-27 08:56:12 +02:00
Lukas Fleischer
55afda8a73 Stop all threads before leaving curses mode
This prevents from notification bar artifacts being drawn after leaving
interactive mode.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-09-13 08:28:24 +02:00
Lukas Fleischer
e6f8a2932a Avoid starting the notification thread twice
Starting the notification thread more than once can result in strange
behavior. For example, when launching external commands, only the most
recently started thread is stopped which results in the external
command's screen output being overwritten by the notification bar.

Currently, there are a couple of situations where the thread is started
twice. As a first countermeasure, explicitly check whether the thread is
already running (and terminate it) before starting a new one.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-08-24 21:49:53 +02:00
Lukas Fleischer
8fe9dd1c2b Remove duplicate code in draw_monthly_view()
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-06-27 08:59:35 +02:00
Lukas Fleischer
203ac0aa61 Highlight days with non-recurrent items
Use a different color for days with non-recurrent items in the calendar
panel. This makes it possible to easily spot days that actually contain
appointments.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-06-27 08:57:42 +02:00
Lukas Fleischer
b6f95b380f calcurse-caldav: Encode the request body in UTF-8
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>
2016-06-18 10:30:30 +02:00
Lukas Fleischer
5d793f6b35 Release 4.1.0
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-04-12 17:27:02 +02:00
Lukas Fleischer
2fa33567dd po/: Translation updates from Transifex 2016-04-11 22:06:55 +02:00
Lukas Fleischer
306a207f28 po/calcurse.pot: Update message catalog
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-04-02 08:46:47 +02:00
Lukas Fleischer
1531425005 Support relative dates when adding recurrences
In commit f5d8b5e (Support durations in recurrence ending dates,
2016-02-25), we added support for the `+xxwxxd` syntax when specifying
recurrence end dates. However, this only worked when *editing* the
recurrence, not when converting a regular item to a recurrent one. Fix
this and support the new syntax in both cases.

Also, mention the new syntax in the prompt.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-04-01 08:51:26 +02:00
Lukas Fleischer
2c9ea341cf Document the hooks feature
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-04-01 08:35:14 +02:00
Lukas Fleischer
4633846550 Fix apoint_inday() with long appointments
Fixes a regression introduced in 9e160fa (Do not assume that days always
have 86400 seconds, 2016-03-27).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-03-28 08:45:49 +02:00
Lukas Fleischer
9e160fac16 Do not assume that days always have 86400 seconds
Make that date membership is computed correctly, even if a day has less
than 86400 seconds (e.g. after changing clocks).

Reported-by: Hakan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-03-27 13:06:18 +02:00
Lukas Fleischer
e1b6d22669 Add proper UTF-8 support to the notification area
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-26 21:52:14 +01:00
Lukas Fleischer
f5d8b5e021 Support durations in recurrence ending dates
When spending the end date of recurring items, allow date duration
specifiers such as "+5d" or "+3w2d".

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-26 09:14:40 +01:00
Lukas Fleischer
c34f9aba29 Refactor UTF-8 chopping
Add a function that makes sure a string does not exceed a given display
size. If the string is too long, dots ("...") are appended.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-26 09:14:40 +01:00
Lukas Fleischer
85772d746f Fix tests to match the new item ordering
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-18 22:23:33 +01:00
Lukas Fleischer
8c32812fe1 ui-day.c: Simplify code using ui_day_selitem()
Use the new ui_day_selitem() utility function to retrieve the currently
selected item.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-16 07:55:19 +01:00
Lukas Fleischer
65b699f770 Make automatic selection of appointments/events smarter
Keep item selection when an item is moved (e.g. by changing the start
time or description).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-16 07:53:12 +01:00
Lukas Fleischer
feb059e8cf Fix segmentation fault on reload with pre-load hook
We need to manually force a reinitialization of the todo item list box
before reloading the items. Otherwise, the list box contains dangling
references to the linked list of todo items which has already been
cleared at this point. After the pre-load hook is called, the windows
are redrawn by wins_unprepare_external() and these invalid references
are accessed, leading to a segmentation fault.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-15 19:03:26 +01:00
Lukas Fleischer
eaf8f96e06 Improve ordering of appointments/events
* Order by start time first.
* Order items with the same start time by priority.
* Order items with the same start and priority by description.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-02-15 18:25:55 +01:00
Lukas Fleischer
07954626c6 Support format strings when dumping imported items
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>
2016-02-11 18:33:57 +01:00