84 Commits

Author SHA1 Message Date
Lukas Fleischer
213e5f86a5 Update copyright ranges for 2023
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-04-11 17:04:24 -04:00
Lars Henriksen
ec38714bbc Allow newlines in SUMMARY by replacing them with blanks
Addresses Github issue #414 (Android calendar allows them).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2022-03-19 20:21:09 -04:00
Lukas Fleischer
01ad848628 Update copyright ranges for 2022
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2022-03-11 11:33:19 -05:00
Lukas Fleischer
b36e603997 Do not use readlink(1) in tests
Avoid using readlink(1) which is not POSIX-compatible; moreover,
`readlink -f` is not available on Mac OS by default.

Instead, always convert $CALCURSE to an absolute path (that may or may
not be canonical, i.e., be a symlink or contain ../ as component) in
test-init.sh by prepending the current working directory if the original
path is relative. While not fully equivalent to `readlink -f`, this
should be good enough for use in our tests.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2021-04-03 17:55:46 -04:00
Lars Henriksen
d126696999 Make iCal event import independent of property ordering
Refactoring of ical.c: properties DTSTART, DTEND, DURATION, RRULE and EXDATE are
saved and only processed after encountering END:VEVENT.

Adresses Github issue #323, follow-up question.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-11-07 19:50:23 -05:00
Lukas Fleischer
1e243dba90 Fix parallelized test runs
Do not share a common temporary directory between different test cases.

Reported-by: Tomasz Kłoczko <kloczko.tomasz@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-10-13 20:43:37 -04:00
Lukas Fleischer
06ce86c600 test: indent continuation lines
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-10-12 11:16:08 -04:00
Lukas Fleischer
701f8e4fbd test: fix recur-010.sh
Use mktemp(1) to create temporary directory. Copy missing todo file. Do
not modify any files in tests. Simplify and make some commands more
robust. Indent continuation lines.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-10-12 11:15:48 -04:00
Lars Henriksen
f2a7eea311 Extend icalendar export
Export now covers advanced recurrence rules and properties imported to a note
file.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-08-26 07:52:08 -04:00
Lars Henriksen
e3cfca7568 Update use of note file for import
Removes the parts of commit 'Extend use of note file for ical import' that
relate to STATUS. The STATUS property is (partly) supported for todos already.

Corrects insertion of a separator: always insert it before imported properties
(also when there is no description).

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-08-26 07:52:08 -04:00
Lars Henriksen
382e60ba69 Extend import of recurrence rules
Support has been implemented for recurrence rule parts BYMONTH, BYMONTHDAY and
BYDAY.  A new test has been added.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-06-13 10:56:15 -04:00
Lars Henriksen
d2791b046a Update import of basic recurrence rules
Conversion of COUNT to UNTIL was a simple calculation which assumed one
repetiton per period (day, week, month or year); it does not take exception
days and invalid dates into account. Solved by a new function which returns the
n'th occurrence of a recurrence rule.

In calcurse UNTIL is interpreted as a day (DATE), in RFC 5545 as a time of day
(DATE-TIME). This has implications when a recurrence rule has an occurrence on
the UNTIL day, see comment in ical.c

An "Import:" note is added when a multi-day event is imported and turned into a
calcurse all-day event.

Icalendar quotes in comments have been updated to RFC 5545.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-06-13 10:56:15 -04:00
Lars Henriksen
d8c1c48e78 Support import of time zones (RFC 5545)
The property parameter time zone identifier (TZID) is recognized in DTSTART,
DTEND and EXDATE and the DATE-TIME value converted to a local time. The time
zone identifier is logged in the note file.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-06-13 10:56:15 -04:00
Lars Henriksen
bd238bfd7c Fix recurrence rule expansion with ordered weekday
When the order of a weekday in BYDAY rule expansion (like -5SA or 5SU
for monthly or 55WE for yearly) exceeds the number of available weekdays
in the period (month or year), rule expansion with negative order could
result in a floating point exception. The reason: the modified frequency
might become zero.

Solution. Check order against number of available weekdays and terminate
expansion early whenever possible (also for positive orders).

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-05-12 09:24:11 -04:00
Lars Henriksen
fabacecd16 Take value data type of event start into account in iCal import/export
The patch derives the item type (appointment or event) from the DTSTART
value type. It is then used to perform an extended check of date/time
values and reject non-conformant import files (like those reported in
Github issues #81, (calcurse) events.

The patch includes parsing and code corrections and minor refactoring.

Background:

Ical events are of two types, in calcurse called appointments and
events. RFC 5545 has no distinguishing names for them, but describes
them in section 3.6.1. The event type is derived from the value type of
the DTSTART property. The value type may be either DATE-TIME
(appointment) or DATE (event). If not specified by a VALUE property
parameter in DTSTART, the default value type is DATE-TIME. The value
type must be set explicitly to DATE to get an event. Other properties
and rrule parts must agree with the DTSTART value type (DTEND, DURATION,
EXDATE and UNTIL).

Previously the type of an imported event was derived from the format of
the DTSTART value. The DTSTART value type was not taken into account
when importing, and not specified for recurring events when exporting
(commit 0114289 solved it for events, see GitHub PR #97).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-05-03 08:59:01 -04:00
Lars Henriksen
eda28d3fef Tests for recurrence rule extensions
Test cases include all the examples from RFC5545 which are supported.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-04-28 07:32:44 -04:00
Lars Henriksen
e9deb6fff3 Extend use of note file for iCal import
iCal import to an item note file is extended from DESCRIPTION to
LOCATION, COMMENT and STATUS for both events and todos.

Addresses GitHub issue #9.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-04-28 07:32:44 -04:00
Lars Henriksen
214a761564 Accept empty DESCRIPTION in ical import
Adresses GitHub issue #274.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-04-28 07:32:44 -04:00
Lars Henriksen
e535eff904 Extend iCalendar import tests
Tests ical-010.sh and ical-011.sh assume that Github issue #265 has been fixed
(escape-encoding by export).

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-03-22 13:45:40 -04:00
Lars Henriksen
ffbf714c9e Fix decoding of escaped characters in imported text
Stick strictly to RFC 5545, 3.3.11, Text, for SUMMARY and DESCRIPTION.
Adresses Github issue #271.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-03-22 13:40:28 -04:00
Lars Henriksen
467815d465 Improve ical import logging
The log file is not deleted if items were skipped (adresses Github issue #269).
The log file includes the import file name and time.
The import line numbers have been corrected (and tests amended).

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-03-22 13:40:28 -04:00
Lukas Fleischer
5ad76df5fe Update copyright ranges
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-01-30 19:22:23 +01:00
Nitroretro
4a2f5e2183 Test for the directory structure
Ensure that calcurse uses the right data and configuration directories
depending on the conditions.

Helped-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-12-23 13:16:39 -05:00
Nitroretro
19d2d9229e Change documentation to reflect the new file structure
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-12-23 13:16:39 -05:00
Lukas Fleischer
1b43893c4c test/Makefile.am: Add apts-dst to EXTRA_DIST
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-10-18 17:18:01 -04:00
Lars Henriksen
e25710f650 Test for DST and recurrent items
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-10-18 16:29:34 -04:00
Lars Henriksen
1db1108e86 Test cases for "Fix monthly and yearly recurrence algorithms"
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-09-06 18:17:23 -04:00
Lars Henriksen
52d52208c8 Test cases for impossible dates in recurrence rule
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-20 09:37:17 -04:00
Lars Henriksen
8741334d83 New test cases for next appoinment
The change by commit "Fix display of time left before next appointment"
is not detected by the existing test because the time set has zero
seconds.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-04-13 11:58:16 +02:00
Lars Henriksen
a5e6608992 CLI: tests aligned
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-01-07 16:57:57 +01:00
dott
3f267d0473 Fix priority parsing in iCal imports
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-11-24 00:26:09 +01:00
Lukas Fleischer
4dbb00c595 test/Makefile.am: Add missing data file to EXTRA_DIST
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-02 08:37:47 +01:00
Lukas Fleischer
8d85a58a26 ical-002: Fix broken test
In the expected output, the punctual appointment (lasting one second in
the iCal data) was missing. The test was not failing because calcurse
did not print the missing item due to a bug. This bug was fixed by
7924315 (Fix support for punctual appointments at 00:00, 2017-08-28),
making the test case fail. Fix the test case as well such that
everything behaves as expected again.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-08-28 07:30:15 +02:00
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
9f6678bc49 Update copyright ranges
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-01-12 08:40:30 +01: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
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
978d24a9d2 Update copyright ranges
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-30 11:21:53 +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
1ea97795be Add support for UTC times in iCal imports
According to the iCal standard (4.3.12 Time):

    UTC time, or absolute time, is identified by a LATIN CAPITAL LETTER
    Z suffix character (US-ASCII decimal 90), the UTC designator,
    appended to the time value.

Parse such time values properly when importing iCal files.

Fixes GitHub issue #3.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2015-02-23 10:46:16 +01:00
Lukas Fleischer
9ef427693b Update copyright ranges
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2015-02-07 11:42:20 +01:00
Lukas Fleischer
a12833ec08 Handle dates past January 19th, 2038
Try to support dates past year 2038 on systems with 64-bit time_t.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2015-02-07 09:52:36 +01:00
Lukas Fleischer
61e2206dca test/data/ical-006.ical: Remove timezones
This are neither needed for the tests nor supported by the iCal import.

Reported-by: Håkan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-18 17:30:58 +02:00
Lukas Fleischer
b157f99179 test/Makefile.am: Add missing test
We added ical-005 in f3fe3c8 (Gracefully handle all day events in iCal
imports, 2014-08-18) but forgot to add entries to the Makefile.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-18 15:18:11 +02:00
Lukas Fleischer
76f151ff37 Correctly parse all types of iCal durations
This was supposed to be fixed in 6ca2535 (ical.c: Simplify and fix
ical_durtime2long(), 2014-07-28) but some cases were not covered.

Reported-by: Håkan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-18 15:18:11 +02:00
Lukas Fleischer
f3fe3c818c Gracefully handle all day events in iCal imports
Do not create two events when importing an event that lasts an entire
day.

Reported-by: Jörn Tillmanns <tillmanns@tuxzone.org>
Reported-by: Håkan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-18 12:20:09 +02:00
Lukas Fleischer
bcc820ea74 Handle CRLF line endings in iCal files
RFC 2445 mentions that CRLF line endings may be used in iCal files.
Handle them properly when importing.

Reported-by: Håkan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-18 11:37:41 +02:00
Lukas Fleischer
e57b9654ff test/: Fix date in ical-001
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-18 11:35:01 +02:00
Lukas Fleischer
f9208c0b3d Use backwards-compatible out format for queries
Print TODO items before appointments in query outputs and add an empty
line between the list of TODO items and the list of appointments. This
is how items were printed before the big parser refactoring.

Also, add a test to ensure we do not unintentionally change that format
in the future.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-08-06 15:48:02 +02:00