aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* git-version-gen: Add default versionLukas Fleischer2017-09-081-8/+4
| | | | | | | | | | | Instead of bailing out early in the build process when neither a version file nor a valid Git repository is detected, use a hardcoded default version string. This fixes building from shallow clones or Git snapshots. Also fixes GitHub issue #22. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Reload data after resolving save conflictLukas Fleischer2017-09-081-1/+10
| | | | | | | After resolving a save conflict with the merge tool, we need to reload the data files to import the result of the conflict resolution. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Unset modification flag after mergingLukas Fleischer2017-09-081-0/+2
| | | | | | | Turn off the local modification flag to avoid a bogus warning when reloading the data files immediately after the merge process. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Recompute hashes after savingLukas Fleischer2017-09-081-0/+3
| | | | | | | After saving the data files, we need to recompute and store the hashes to make sure the updated contents is reflected. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Factor out hash computationLukas Fleischer2017-09-081-7/+14
| | | | | | Move code to compute the hash of a data file to a separate function. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use a shared input/output mutexLukas Fleischer2017-09-082-16/+23
| | | | | | | | | Replace the save mutex with a common mutex, which is locked whenever read or write operations on the data files are performed. Also, since this mutex is an implementation detail, mark the locking functions static and remove them from the header file. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Interrupt periodic save when launching processLukas Fleischer2017-09-081-0/+4
| | | | | | | | To avoid interactions between the periodic save thread and external processes, stop the periodic save thread before launching an external program and restart the thread as soon as the program is terminated. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Only reload if data files were changedLukas Fleischer2017-09-083-7/+15
| | | | | | | | Instead of blindly reloading data in io_reload_data(), compare the stored hashes of the data files with hashes of the current file contents and only reload if any of the hashes differs. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Factor out check for external modificationsLukas Fleischer2017-09-081-15/+20
| | | | | | | | Move the check to compare the stored hashes of the data files with the current hash to a separate function. This makes the code easier to read and reusable. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Do not blindly overwrite files when savingLukas Fleischer2017-09-081-0/+59
| | | | | | | | | When reading the data files, compute a cryptographic hash of the file contents and store it. When saving the files later, ensure that the hash still matches the current file contents. If it does not, show a warning to the user and ask whether she wants to execute the merge tool. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use .new as file extension when mergingLukas Fleischer2017-09-081-15/+15
| | | | | | | | Using the file name extension .sav and naming the variables "backup" is slightly misleading, since the affected files actually contain the updated content and not some old snapshot. Use the term "new" instead. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Factor out merge routineLukas Fleischer2017-09-081-48/+44
| | | | | | | Move the code, which runs the merge tool with current and updated data files, to a separate function to make it reusable. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add CALCURSE_{EDITOR,PAGER,MERGETOOL} environment variablesLukas Fleischer2017-09-081-3/+9
| | | | | | | Support environment variables specific to calcurse to override $EDITOR, $PAGER and $MERGETOOL. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make the day heading position configurableLars Henriksen2017-09-085-2/+62
| | | | | | | | | The date at the top of the appointments list may be positioned either to the left, in the middle or to the right. Default is to the right. Can be configured from the general options menu. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Remove phase of moon featureLars Henriksen2017-09-084-185/+2
| | | | | | | | | | The computation never really worked before and it seems like the feature is not very helpful, sometimes even confusing (see GitHub issue #21). The macro ISLEAP is moved to calcurse.h. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix phase of moon calculationLars Henriksen2017-09-081-27/+30
| | | | | | | | | | | | The reported phase was often one day early because calculations were based on midnight. For full and new moon this is changed to noon. For first and last quarter a direct check of the appearance of the half moon during the selected day is performed. Comments are relocated and expanded. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add missing string initializationLars Henriksen2017-09-041-0/+1
| | | | | | | | | | | When introducing the fmt_day_heading() function in commit d56cc7a (Make heading in appointments panel configurable, 2017-08-19), we forgot to initialize the dynamic string. This resulted in calling mem_free() with a garbage pointer, potentially resulting in a segmentation fault. Fix this by calling string_init() before using the string. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Replace remaining uses of wgetch() by keys_wgetch()Lukas Fleischer2017-09-033-3/+3
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add a function to wait for any key pressLukas Fleischer2017-09-037-26/+32
| | | | | | | Introduce a new function keys_wait_for_any_key() and use it instead of wgetch() whenever the return value is discarded. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Improve default selection when editing key bindingsLukas Fleischer2017-09-031-4/+4
| | | | | | | | When adding a new key binding, automatically select the new binding. When removing a key binding, keep the selection index (unless the last binding of a row is removed). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use strncpy() properly in general_option_edit()Lukas Fleischer2017-09-031-6/+8
| | | | | | | Always use strncpy() to copy strings between fixed-size buffers and pass the buffer size as maximal length parameter. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add support for UTF-8 key bindingsLukas Fleischer2017-08-303-30/+112
| | | | | | | | | | | | | | | | A new function keys_wgetch() reads full UTF-8 characters instead of single ASCII characters only. Key bindings for regular ASCII characters are stored in a hash map while the actions of keys with higher code points are stored in a linked list for space efficiency. The key serialization methods are updated to handle UTF-8 characters as well; extended UTF-8 characters (characters not in the ASCII range) are serialized by using the hexadecimal representation of the corresponding code points (e.g. "U+00E4"). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Rename keys_getch() to keys_get()Lukas Fleischer2017-08-305-34/+29
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Factor out UTF-8 code point decodingLukas Fleischer2017-08-302-16/+16
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Relocate HANDLE_KEY macrosLukas Fleischer2017-08-301-46/+44
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Implement CTRL-U in getstring()Quentin Hibon2017-08-291-1/+7
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use nl_langinfo() for month and day namesLars Henriksen2017-08-283-35/+8
| | | | | | | | Use the locale setting to fetch the month names and abbreviated day names. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add basic Travis CI supportLukas Fleischer2017-08-281-0/+10
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Remove extra star from recurrent appointmentsLars Henriksen2017-08-281-2/+1
| | | | | | | | | | | In the appointments panel, an appointment has a '-' to mark the time span, and the description on the following line is slightly indented. When the appointment is changed into a recurrent one, the '-' is changed to a '*', making it easily distinguishable but the description also gets a '*', thus breaking the pattern. Drop the extra '*'. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Remove some leftovers from the pastLars Henriksen2017-08-281-7/+0
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Rename README to README.mdLukas Fleischer2017-08-281-0/+0
| | | | | | | Make sure that the Markdown syntax already used in the README file is recognized by repository browsers such as cgit or GitHub. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make heading in appointments panel configurableLars Henriksen2017-08-285-7/+40
| | | | | | | | Add a new configuration variable format.dayheading to set the format of the date displayed at the top of the event and appointment list. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Extend strings API for formatted datesLukas Fleischer2017-08-282-0/+22
| | | | | | | | Add two new functions string_catftime(), resp. string_strftime(), which can be used to append, resp. print, a formatted date to a dynamic string. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make the selected day in the calendar stand outLars Henriksen2017-08-282-3/+3
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* ical-002: Fix broken testLukas Fleischer2017-08-281-0/+2
| | | | | | | | | | | 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>
* Fix support for punctual appointments at 00:00Lukas Fleischer2017-08-281-2/+3
| | | | | | | | | | | | | | When checking whether an appointment belongs to a given day in apoint_inday(), the return value was 0 if the end time of the appointment matched 00:00 on that day (because we do not want to include appointments starting on the day before and lasting until midnight). However, this means that punctual appointments at 00:00 were not included in any day. Fix the apoint_inday() logic to take this into consideration. Fixes GitHub issue #39. 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>
* Fix empty warning box when key is already in useLars Henriksen2017-08-121-0/+2
| | | | | | | | | | | | When adding a key already in use for another action, a warning box is displayed. The text length is limited by the window width through the use of strncpy(). If the limit is exceeded, the string will have no null termination, resulting in unpredictable behaviour. A similar problem in fatalbox() is fixed as well. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix fatal error when using the help commandLars Henriksen2017-08-121-5/+6
| | | | | | | Check that an action is defined for the key. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Check for optional argument to -s optionLars Henriksen2017-08-121-0/+2
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Include stdarg.h when using variable argument listsLukas Fleischer2017-07-283-0/+4
| | | | | | Fixes GitHub issue #36. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix segmentation fault when changing colorsLukas Fleischer2017-07-281-3/+3
| | | | | | | | | | | | | | | | The pair_content() function can be used to retrieve a color pair. The foreground and the background color numbers are written to addresses specified by the second and third parameters. While both parameters were optional in older ncurses implementations (making it possible to pass NULL pointers if the one does not care about either foreground or background color), recent implementations seem to assume that both parameters are valid pointers. Thus, instead of passing NULL, we need to pass a pointer to a dummy variable when we do not care about the background color. Partly fixes GitHub issue #31. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix another error in the notification codeLukas Fleischer2017-02-111-1/+6
| | | | | | | | | | In addition to checking whether a recurrent item predates the current next appointment, we need to check that the actual occurrence of the item predates the current appointment as well. Fixes GitHub issue #26. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix notification of recurrent appointmentsLukas Fleischer2017-02-091-2/+8
| | | | | | | | | | | | | | | The recur_apoint_starts_before() filter function expected the second parameter to be passed by value, whereas its only caller passed the value by reference. For consistency with apoint_starts_after(), change the signature and the implementation of recur_apoint_starts_before() such that the parameter is passed by reference. Also, add a comment to the only caller of recur_apoint_starts_before() to clarify on why recur_apoint_starts_before() is used. Fixes GitHub issue #25. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>