aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Avoid double free on iCal import errorsLukas Fleischer2020-11-071-2/+13
| | | | | | | Set pointers to NULL after calling free() to prevent double free on cleanup. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Return failure if import skips any itemLars Henriksen2020-11-073-8/+13
| | | | | | | | | Other items may have been imported succesfully. Adresses Github issue #323, last part. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make iCal event import independent of property orderingLars Henriksen2020-11-073-143/+168
| | | | | | | | | | 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>
* Fix parallelized test runsLukas Fleischer2020-10-1314-84/+83
| | | | | | | 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>
* Release 4.7.0v4.7.0Lukas Fleischer2020-10-124-4/+63
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* test: indent continuation linesLukas Fleischer2020-10-122-4/+4
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* test: fix recur-010.shLukas Fleischer2020-10-121-8/+15
| | | | | | | | 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>
* Update message catalogLukas Fleischer2020-10-128-617/+2732
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use dynamically allocated string in struct io_fileLukas Fleischer2020-10-112-2/+3
| | | | | | Avoid using fixed-size buffers and strncpy(). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Implemented rendering of notes in events/appts as wellAmbika Eshwar2020-10-111-4/+38
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Implemented rendering of notes in todo viewAmbika Eshwar2020-10-113-1/+33
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix memory leak in run_hook()Lukas Fleischer2020-10-111-4/+5
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Redesign the item deletion menuLukas Fleischer2020-10-111-58/+66
| | | | | | | | | | | | | | | | | | | Instead of the previous inconsistent and potentially nested menus, the following message is now displayed when deleting an item: Delete (s)elected occurrence, (a)ll occurrences, or only the (n)ote? Options that are not available (e.g. because the item is not recurrent or does not have a note) are omitted. For a non-recurrent item without a note the message becomes Delete (s)elected occurrence? and is skipped if general.confirmdelete is disabled. Implements GitHub feature request #308. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add p(revious) commandLars Henriksen2020-10-113-3/+74
| | | | | | | | | | The p(rev) command finds the previous occurrence of a recurrent item, analogous to the n(ext) command. A bug in the next command is corrected.. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Replace 'ical_rpt_t' with 'struct rpt'Lars Henriksen2020-10-071-113/+71
| | | | | | | | Refactoring and simplification only, no functional change. All error checking and logging done before call of ical_store_event/apoint(). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Always exit with failure in case of option parsing errorsLars Henriksen2020-10-071-14/+9
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Extend icalendar exportLars Henriksen2020-08-264-82/+354
| | | | | | | | 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>
* Update use of note file for importLars Henriksen2020-08-268-112/+40
| | | | | | | | | | | 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>
* Improve event text for cancelled periodic saveLars Henriksen2020-07-261-1/+2
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Revert "Interrupt periodic save when launching process"Lars Henriksen2020-07-261-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0f3d198 (Interrupt periodic save when launching process, 2017-09-08). Stopping and starting periodic save when external/hook programs are run causes deadlocks. The periodic save thread cannot be stopped/started at will, but should be started once and run uninterrupted as long as calcurse runs. Only if the configuration parameter is changed, must the thread be stopped and possibly restarted. The reasons are - the start routine unconditionally starts a thread. - the mechanism used to detect whether a thread is running or not, is designed to be used by the main calcurse thread only and with only one running thread of each kind (the thread ID of each running thread is kept in a variable; if the thread is not running, the variable has the main thread ID as value). Any load hook will be run at the initial dataload, and the stop/start calls will start a perodic save thread (this is true for the notify thread as well). Later when threads are started, a second periodic save thread is started (for the notify thread, a running thread is stopped before restart). When hooks are run by the periodic save thread, the stop call breaks down, leading to two running save threads (if not the case already) and subsequently to a deadlock when one thread tries to stop the other. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Run hooks quietlyLars Henriksen2020-07-261-15/+20
| | | | | | | | Hooks should not be run like external programs, but like load and save operations that do not take possession of the terminal. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Remove SIGCHLD signal handlerLars Henriksen2020-07-264-19/+17
| | | | | | | | | | | | | | The purpose is to make child_wait() reliable. The handler is meant for the notify main thread, but signal handlers are shared by all threads. In the calcurse main thread and the periodic save thread (hooks) the handler and child_wait() will compete (if the signal handler kicks in first, the waitpid() call in child_wait() will fail with errno ECHILD). All child processes in the main thread, the notify thread, the periodic save thread and the notify demon are explicitly waited for. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add Lars to AUTHORSLukas Fleischer2020-07-191-1/+2
| | | | | | Thanks for all the work, Lars! Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix configuration menu 'Quit' actionLars Henriksen2020-06-211-1/+4
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Improve help texts for recurrence rulesLars Henriksen2020-06-132-16/+19
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Icalendar templates for recurrence rulesLars Henriksen2020-06-136-0/+66
| | | | | | | To provide a starting point for advanced repeating items. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Remove systemdialogs option from configurationLars Henriksen2020-06-138-51/+9
| | | | | | | | | The option controls the welcome window and the export/import result messages. The former is dropped. The latter are now always displayed unless calcurse is invoked with the "quiet" option (-q). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Allow repeat count input (for until) in interactive UILars Henriksen2020-06-133-18/+48
| | | | | | | | | | Shortened repetition type text. Avoid "duration" in until-contexts (reserve it for appointment duration): "duration" changed to "increment" in user texts as well as source. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Extend import of recurrence rulesLars Henriksen2020-06-138-29/+2284
| | | | | | | | 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>
* Update import of basic recurrence rulesLars Henriksen2020-06-138-128/+329
| | | | | | | | | | | | | | | | | | | 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>
* Support import of time zones (RFC 5545)Lars Henriksen2020-06-136-48/+112
| | | | | | | | | 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>
* Fix typosMartin Michlmayr2020-06-103-17/+17
| | | | | Signed-off-by: Martin Michlmayr <tbm@cyrius.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Let RETURN set frequency type to current value in repeat command UILars Henriksen2020-05-242-13/+19
| | | | | | | In addition, the prompt text is shortened. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Include start day in error message for recurrence ruleLars Henriksen2020-05-244-12/+36
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix "next occurrence" for multi-day appointmentsLars Henriksen2020-05-241-6/+9
| | | | | | | Better name: day for occur. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix recurrence rule expansion with ordered weekdayLars Henriksen2020-05-123-20/+57
| | | | | | | | | | | | | | 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>
* Take value data type of event start into account in iCal import/exportLars Henriksen2020-05-033-77/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* calcurse-caldav: Ensure config and data dirs existNitroretro2020-05-011-13/+21
| | | | | | Fixes #283. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Make check_dir create directoriesNitroretro2020-05-011-3/+5
| | | | | | | | This patch makes check_dir(dir) create directories if they don't exist, and it will fail if the path at dir is not a directory. It acts in a similar fashion to io_check_dir from io.c. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Support interactive test of recurrence rule extensionsLars Henriksen2020-04-283-1/+68
| | | | | | | The generic command 'next' is introduced. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Help for recurrence rule extensionsLars Henriksen2020-04-282-58/+267
| | | | | | | | | | | The help command has been updated for "repeat". Context dependent, very terse information is built into the repeat command (edit command) for display in the status bar when editing the Weekdays, Months and Monthdays lists. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Treat recurrent events and appointments alikeLars Henriksen2020-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | The day vector (or "day_items" vector) is used to load the appointments panel with "day_items" (captions, appointments, events). A multi-day appointment has several "day_items" in the day vector. This may also be the case for a recurring item. The day_item structure has a member "start", which for day_items for recurring appointments is set to the occurrence found by recur_item_find_occurrence(), and is used to tell days of a multi-day appointment apart. For day_items for recurring events it was set to "day" of the recur_event structure (the same value for all occurrences) and not used. The value is now the occurrence found by recur_event_find_occurrence(). The patch is backwards compatible and future-proof. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix preselectionLars Henriksen2020-04-281-3/+4
| | | | | | | | | The preselected item is not searched for if the range of days is changed (day_changed = 1). The patch is meant to future-proof the selected-item-algorithm and is backwards compatible. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Refactor the repeat commandLars Henriksen2020-04-282-166/+87
| | | | | | | | | | Code duplication has been eliminated by calling update_rept() from the repeat command ui_day_item_repeat(). The repeat command asks for simple or advanced repetition. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* User interface for recurrence rulesLars Henriksen2020-04-283-77/+416
| | | | | | | | | | | | | | | | | | | | | | | | The function update_rept() is extended with editing of the three recurrence rule lists for BYMONTH, BYMONTHDAY and BYDAY. The integers of the bymonth and bymonthday lists are edited directly as integers, while those of the bywday list are mapped to localized weekday names (as they appear in the calendar panel) with an optional integer prefix (in RFC5545 style: 1MO, -2SA). The RFC5545 (icalendar) requirement that the start day must be the first occurrence and must match the recurrence rule, is met by testing that an occurrence indeed appears on the start day, in these circumstances: - when a recurrent item is loaded from file - when the recurrence rule of an item is edited interactively - when a recurrent appointment gets a new start time - when a recurrent appointment is moved Copy and paste of a recurrent item will only retain the basic recurrence properties of type, frequency, until and exception days. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Tests for recurrence rule extensionsLars Henriksen2020-04-284-1/+5411
| | | | | | Test cases include all the examples from RFC5545 which are supported. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Recurrence rule extensionsLars Henriksen2020-04-286-25/+847
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Terms and concepts are from RFC 5545 (the iCalendar specification). Overall design -------------- Calcurse is extended with full support for BYMONTH, BYDAY and BYMONTHDAY recurrence rule (rrule) parts. The three rule parts are lists of, respectively, months, weekdays and monthdays. The lists are added to 'struct rpt' as linked lists of integers, and the data file format is extended accordingly (details below). Load and save of the lists follow the pattern of the existing list of exception dates, also in 'struct rpt'. The function recur_item_find_occurence() is split into a front-end and a back-end. The back-end, called find_occurrence(), is the original function extended with rrule reductions; the front-end retains the original name and performs rrule expansions. Front-end plus back-end are backwards compatible and require no changes in calling functions. There is no user interface in this patch. Data file extensions -------------------- The BYMONTH, BYDAY and BYMONTHDAY lists are added to that part of an item line which describes the recurrence rule (the "{...}" part). Each list is - like the list of exception days - a space-separated string of values identified by the initial character. Each list is optional and, if present, must follow the until date and precede the exception day list. The lists must appear in order BYMONTHDAY list, BYDAY list and BYMONTH list. The possible list values are - BYMONTH: m1, m2, ..., m12 - BYDAY: w0, w1, ..., w6, w7, w-7, w8, w-8, ..., w377, w-377 - BYMONTHDAY: d1, d2, ..., d31, d-1, d-2, ..., d-31 which are interpreted as (cf. RFC 5545) - BYMONTH: January, February, ..., December. - BYDAY: SU, MO, ..., SA, +1SU, -1SU, +1MO, -1MO, ..., +53SA, -53SA - BYMONTHDAY: the first, the second, ..., the 31st, the last, the last but one, ..., the last but 30 day of the month Examples: Thursday, TH, is w4; Saturday, SA, is w6. The seventh Thursday, +7TH, is w53 (7 * 7 + 4 = 53); the last but second Saturday, -2SA, is w-20 (2 * 7 + 6 = 20); the last day of the month is d-1. Note that the values w-1, w-2, ..., w-6 are not used. A recurrent appointment with a BYDAY rule part: 06/23/2019 @ 12:00 -> 06/23/2019 @ 13:00 {1W w0 w6} |every week on Sunday and Saturday An event with a BYDAY and a BYMONTH rule part: 10/27/2019 [1] {1Y w-7 m10} every year on last Sunday in October An event with until date, a BYMONTH rule part and an exception day: 06/23/2019 [1] {1Y -> 08/31/2021 m5 m6 m7 !07/23/2020} every year on the 23rd in May, June and July for three years, starting on Sunday, 23 June 2019, but not on 23 July 2020. Recurrence set expansion and reduction --------------------------------------- In calcurse a recurrence rule is a quadruple (s, d, r, e) consisting of start, duration, repetition pattern and exception days and is implemented as: (time_t start, long dur, struct rpt *rpt, llist_t *exc) In RFC 5545 parlance, a recurrence rule defines a recurrence set consisting of all recurrence instances (occurrences) not earlier than start which match the rule pattern. With this concept in mind, recur_item_find_occurremce() may be thought of as a membership function for a recurrence set. The call recur_item_find_occurrence(s, d, r, e, day, occurrence) returns true if day belongs to the recurrence set of (s, d, r, e); if so occurrence points to the recurrence instance (the set member). For a recurrence rule with only the basic DAYLY, WEEKLY, MONTHLY or YEARLY type and frequency the recurrence set consists of periodically repeated instances. The BYxxx rule parts modify the recurrence set by reducing or expanding it as specified by RFC 5545. Expansion is implemented in the front-end by modifications of start and/or frequency of the rule (s, d, r, e), often several times, in such a way that the desired recurrence instances are included in the recurrence set. This is possible because the front-end as the very first thing checks for early days (day < s). When day is known not to be early, start (s) can safely be moved backwards. Likewise, if frequency must be changed, the front-end checks whether the frequency repetition applies to the week, month or year of day. Reduction is easier and is performed in the back-end along with the existing validity checks. It consists in checking whether month, day of month or weekday of a found occurrence is on the appropriate list. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Refactor edit of exception daysLars Henriksen2020-04-283-24/+34
| | | | | | | | | | | | | | | The patch contains no functional changes, but is a necessary precondition for extensions of update_rept() (in ui-day.c) with further recurrence rules. The reason is that recurrence parameters must be treated as a whole: if an edit session is cancelled at any point, no value should change, and all parameters should remain as they were. Hence, the new values must only be set after all of them have been determined. This was not the case for the list of exception days, but as long as it was treated last, it did not matter. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Improve data load error reportingLars Henriksen2020-04-285-53/+54
| | | | | | | | | | | The last part of loading appointments and events is performed by four "scan" functions called from io_load_app(). Failure in this part of data load does not use io_load_error(). The four "scan" functions are changed to return an error message on failure and NULL otherwise (the previous return value was not used). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Refactor function calls: recurrence parameters as a single argumentLars Henriksen2020-04-285-189/+151
| | | | | | | | | | | | | | | | | | | | | The recurrence parameters are type, frequency, until date and exception list (in RFC 5545 parlance FREQ, INTERVAL, UNTIL and EXDATE's). When these are passed in a function call, the argument list becomes long and not very readable. When support for extended recurrence rules is implemented, the number of recurrence parameters increases, and function signatures must be amended. Solution: The "struct rpt" is extended with the exception list; any future recurrence parameters are added here. A pointer to this structure replaces the recurrence parameters in function calls. Note: Each recurrent event and appoinment instance has (a pointer to) a "struct rpt" and in addition an exception list. The latter is retained to avoid the derived changes, and the exception list in the structure is initialized to an empty list when the recurrent instance is created. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>