aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Use a path instead of a file for -C optionQuentin Hibon2018-08-052-24/+27
| | | | | | | | | | | | Allows to specify a configuration directory containing: * conf * keys * hooks When used in combination with -D $ddir, $ddir contains all the other files not mentioned above. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix multiple, simultaneous periodic savesLars Henriksen2018-07-281-4/+4
| | | | | | | | | | A new save thread was started every time a positive periodic save value was input in the general options configuration menu. And only one thread can be stopped by entering 0, also when done repeatedly. Always stop the old thread before (possibly) starting a new. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Solve deadlock in notification barLars Henriksen2018-07-285-16/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | calcurse deadlocks when 1) an upcoming appointment is on display in the notification bar, 2) an external command (like help) is started, 3) the time for the upcoming appointment arrives, and 4) the external command is exited. The notification bar thread is stopped while the external command is running. Upon exit from the external command, the n-bar thread is restarted and calcurse locks. The cause is the way in which the main notification bar thread is stopped: static pthread_t notify_t_main; void notify_stop_main_thread(void) { if (notify_t_main) { pthread_cancel(notify_t_main); pthread_join(notify_t_main, NULL); } } Objects of type pthread_t are opaque and should not be accessed directly. Initially notify_t_main is an uninitialised static variable (0), but later it has a value, which may or may not be the thread id of the notification main thread. Note that the thread id after exit of a thread may become the thread id of a new thread. Thus the variable set when the thread is created, is invalid after exit of the thread. Specifically, the first time notify_stop_main_thread() is called (by notify_start_main_thread() before the thread is created) is harmless (because notify_t_main is 0). Calling notify_stop_main_thread() later may be either OK because the main thread is running, or harmless because no thread with id notify_t_main is running: the two functions will fail with return value ESRCH (no such process), or fatal because an unrelated thread with this thread id is running: it will be cancelled, and the join may or may not succeed depending on whether the thread is joinable or detached. The "unrelated thread" could be the next-appointment thread, notify_thread_app, launched by notify_check_next_app(). Always calling notify_stop_main_thread() before starting the main thread becomes fatal when notify_check_next_app() is called shortly before notify_start_main_thread(). This is the case in the scenario described. The next-app-thread is then running when notify_stop_main_thread() is called, and apparently it has the thread id of the old main thread (confirmed by logging the return values from pthread_cancel() and pthread_join(); the first succeeds while the second fails with EINVALID which means that the thread is not joinable). The next-app-thread will therefore exit without unlocking mutexes. Ensure that notify_t_main, in case the notify main thread is not running, has a value that it will never have when it is running. A possibility is the thread id of the main() calcurse process (returned by pthread_self()). Check for this condition in notify_stop_main_thread() and set notify_t_main when the thread is stopped. Similar changes have been introduced for the periodic save thread and the calendar date thread. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: fix basic authenticationDino Macri2018-07-221-0/+5
| | | | | | | Read whether basic authentication is used and add the credentials to httplib2 when making a request. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: add HTTP supportDino Macri2018-07-221-6/+18
| | | | | | | | | | | Introduce support for HTTP connections. Use "HTTPS" in the config file to enable/disable (default is enabled). The option modifies the prefix of the host name to "http://" when disabled, rather than always using "https://" with no option to change. httplib2 automatically handles URLs beginning with either http or https. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix end-before-start inconsistencyLars Henriksen2018-06-051-7/+9
| | | | | | | | | | | | Due to deficient validation, it is possible to get an inconsistent database with an appointment that ends before it begins. Edit an existing one and specify an end time by a date that precedes the start date, or create a new one and give a date as end time that precedes the start. Then exit calcurse; on restart it will report a data error and exit. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix appointment becoming eventLars Henriksen2018-06-051-4/+4
| | | | | | | | | | | | You try to enter an appointment, but enter an invalid start time (by mistake). Calcurse rejects the input. You enter the correct start time and calcurse asks for the description, not the end time, i.e. you get an event. The check for an event must only be performed on valid input. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Support UTF-8 encoded characters in user choicesLars Henriksen2018-06-031-12/+23
| | | | | | | | Translations (in po-files) of texts that are used for alternative choices (e.g. [dwmy]), may use UTF-8 encoded Unicode characters (e.g. [éãüå]). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Key bindings for UTF-8 encoded charactersLars Henriksen2018-06-034-13/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Internally characters (keys) have two representations: integers and key names. Key names are characters strings, usually the name of the character; e.g., the character A has the representations 65 and "A", and the tab character the representations 9 and "TAB". The function keys_int2str() turns the integer representation of a key/character into the key name. For display purposes the key names are usually confined to have display width at most three. Some curses pseudo-keys have longer key names; e.g., the back-tab character is "KEY_BTAB". A long key name makes a character difficult to recognize in the status bar menu. The key name of a multibyte, UTF-8 encoded character is the conventional Unicode name of the code point; e.g., the character ü has key name "U+00FC" because ü is the code point 0xFC. Most of these look alike in the status bar menu. The patch makes the key name of a multibyte character look like that of a singlebyte character: the character itself, i.e. the key name of the character ü is "ü". The main tool is implementation of a utf8_encode() routine. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Rename utf8_ord() to utf8_decode()Lars Henriksen2018-06-033-4/+4
| | | | | | | Purely for readability and in preparation for the counterpart utf8_encode(). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Do not stop already cancelled notification threadLukas Fleischer2018-06-031-6/+11
| | | | | | | | | Add a static state variable to indicate whether the notification thread is already running or not. Only start the thread if the notification thread is paused. Only stop the thread if the notification thread is actually running. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Only lock save mutex as short as possibleLukas Fleischer2018-06-031-3/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Check for empty string in config_parse_int()Lars Henriksen2018-05-281-3/+6
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add option to specify the configuration file usedQuentin Hibon2018-05-283-8/+21
| | | | | | | | | The configuration file (~/.calcurse/conf by default) can now be specified with -C or --conf. Workaround for GitHub issue #86. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Always NUL-terminate buffer in note_gc()Lukas Fleischer2018-05-261-0/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Always NUL-terminate buffer in keys_fill_missing()Lukas Fleischer2018-05-261-0/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix buffer overflow in keys_action_allkeys()Lukas Fleischer2018-05-261-4/+9
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Always NUL-terminate buffer in io_load_keys()Lukas Fleischer2018-05-261-0/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* notify.c: fix several buffer overflowsLukas Fleischer2018-05-261-13/+18
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Properly NUL-terminate the day heading after editingLukas Fleischer2018-05-261-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Avoid buffer overrun in config_parse_str()Lukas Fleischer2018-05-261-1/+6
| | | | | | | | | | The previous implementation only read a prefix from the configuration file if the configuration value was too long and forgot to terminate the string with a NUL character. Return 0 if the string is too long instead. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Scrollbar and right window border (corrected)Lars Henriksen2018-05-269-36/+32
| | | | | | | | | | | | | | | | | When a scrollbar is on display in APP or TOD windows, the right vertical border (outside the scrollbar) is not highlighted when the window is selected. The scrollbar is always highlighted: - when APP or TOD is deselected - in configuration windows where borders otherwise are not The patch moves the scrollbar parameters (except highlight) from arguments of draw_scrollbar() to the function itself. The highlight argument was 1; instead it is set higher in the call hierarchy (wins_update_panels()) and passed on down. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Transparent cursor fixLars Henriksen2018-05-262-8/+7
| | | | | | | | | | | | | Commit f8e6e0d (Fix no-colour theme, 2017-12-10) partly destroyed the cursor in getstring() by turning it into a solid block. The fix reintroduces wchgat() which requires a color pair argument. When no colors are wanted, color pair 0 is used. A similar problem exists in the layout and colour customization windows and is fixed in the same way: move to the position and apply the reverse video attribute. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix end-of-string calculationLars Henriksen2018-05-241-1/+1
| | | | | | | | In keys_fill_missing() a pointer is walked through a string of space-separated character names, but misses the string-terminating null character. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: remove authorization data from logsLukas Fleischer2018-05-231-1/+7
| | | | | | | | The Authorization header contains the Base64-encoded user name and password. Remove this information from debug logs, unless the user explicitly requests to keep them by using the --debug-raw flag. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Run pre-load hook before testing for modificationsLukas Fleischer2018-05-232-2/+8
| | | | | | | | | | | The pre-load hook is often used to manipulate the data files before loading, such as by synchronizing with a remote calendar. Make sure we always execute the pre-load hook upon reloads, even if the data files have not been modified. Fixes GitHub issue #98. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Unlock the save mutex as early as possibleLukas Fleischer2018-05-191-4/+5
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use dummy variables to ignore return values of pair_content()Lukas Fleischer2018-05-101-2/+2
| | | | | | | | This prevents from segmentation faults with recent ncurses implementations. See commit 5722d2e (Fix segmentation fault when changing colors, 2017-07-28) for details. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* ical: use the VALUE parameter in DTSTARTQuentin Hibon2018-05-101-1/+1
| | | | | | | | | According to RFC5545 3.3 (Property Value Data Types): "If the value type of a property is one of the alternate valid types, then it MUST be explicitly specified with the "VALUE" parameter." Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Allow for passing negative arguments to -dLukas Fleischer2017-12-131-10/+14
| | | | | | | | When specifying date ranges using -d, allow for passing negative values to indicate that the date range should start a certain number of days ago. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix no-colour themeLars Henriksen2017-12-103-13/+8
| | | | | | | | | | | | | In colour customization, pressing cancel ('ESC' by default) will deselect all colours and put calcurse in no-color mode. For this to work, all colour changes must be performed with the routines custom_apply_attr()/custom_remove_attr(). Fixed for the getstring cursor, the scroll window border and the week number. In addition, the week number is unconditionally coloured as the rest of the calendar contents whether CAL is selected or not. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Scrollbar and right window borderLars Henriksen2017-12-103-23/+49
| | | | | | | | | | | | | | | | | | | When a scrollbar is on display in APP or TOD windows, the right vertical border (outside the scrollbar) is not highlighted when the window is selected. The scrollbar itself is always highlighted: - when APP or TOD is deselected - in configuration windows where borders otherwise are not The patch moves the scrollbar parameters from arguments of draw_scrollbar() to the function itself. The highlight argument to draw_scrollbar() was always 1. Instead call circumstances are figured out and highlight set accordingly. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Default colour as foreground colourLars Henriksen2017-12-104-4/+24
| | | | | | | | | | | | | In the default colour setup (white on black), white could only with great difficulty be used as customized foreground colour, because the colour pair COLR_CUSTOM then was identical to COLR_DEFAULT (default on default). This made it impossible to distinguish the selected element in lists. The patch turns on the video attribute bold when default is chosen as foreground colour. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update UTF-8 base codeLars Henriksen2017-12-072-23/+11
| | | | | | | | | | UTF-8 encodes characters in one to four bytes (since 2003). Because 0 is a valid code point, the decode function utf8_ord() should return -1, not 0, on error. As a consequence utf8_width() should return 0 for a continuation byte (as it did previously). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Avoid corrupting the sync DBLukas Fleischer2017-11-231-2/+9
| | | | | | | | | When importing an iCal event via calcurse fails (i.e. does not return a single object hash), do not write anything to the synchronization database instead of blindly appending the entry, thereby potentially corrupting the database. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Do not prompt when non-interactive import failsLukas Fleischer2017-11-231-17/+11
| | | | | | | | | | When running calcurse in non-interactive mode, we should not expect any user input. This is even more important in the case of iCal imports which are used by calcurse-caldav to import events from CalDAV servers. Partly fixes GitHub issue #73. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Check for the year span 1902-2037Lars Henriksen2017-11-233-15/+34
| | | | | | | | | | | | | Reintroduce year check for systems with a 32-bit time_t type. Remove the lower limit (1902) for systems with a 64-bit time_t. This limits movements in the calendar (for 32-bit systems) and in no way ensures constistency of data. Commit a12833e (Handle dates past January 19th, 2038, 2015-01-19) removed the upper limit (2037) on dates but left the lower limit (1902). It did not ensure the support of the target system. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Function cleanup in custom.cLars Henriksen2017-11-232-42/+39
| | | | | | | Remove two remnants: custom_color_theme_name() and custom_set_swsiz(). Make static and rename custom_confwin_init() into confwin_init(). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix help for nine actionsLars Henriksen2017-11-151-4/+18
| | | | | | | | | | | | Seven actions were absent from display_help(). This meant that commands like ':help ^P' did not work. They now refer to general.txt, but are not all described there. For two actions, generic-copy/paste, the file name was misspelled. This solves Github issue #44. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* contrib/caldav/README.md: Fix localhost URIRaf Czlonka2017-11-111-1/+1
| | | | | Signed-off-by: Raf Czlonka <rczlonka@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Document build dependenciesRandy Ramos2017-11-101-0/+10
| | | | | Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Document external password optionRandy Ramos2017-11-101-0/+8
| | | | | | | Add information about the CALCURSE_CALDAV_PASSWORD environment variable. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Read password from env variableRandy Ramos2017-11-101-3/+4
| | | | | | | | Add the option to read the basic authentication password from the CALCURSE_CALDAV_PASSWORD environment variable. Signed-off-by: Randy Ramos <rramos1295@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Revert "calcurse-caldav: Add --password command line argument"Lukas Fleischer2017-11-081-5/+3
| | | | | | | | | | This reverts commit efd76a0d995292e48f5466fccada4901618f7d97. Passing passwords as command line arguments is not a good idea, since they may appear in process listings which are potentially visible to other users logged into the system. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Add SyncFilter config optionSatvik Sharma2017-11-053-12/+53
| | | | | | | | The SyncFilter option filters the types of items synced from/to a CalDAV server by making use of the --filter-type command line argument. Signed-off-by: Satvik Sharma <satvik.sharma2@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* calcurse-caldav: Use /usr/bin/env in the shebangStefan Hagen2017-11-051-1/+1
| | | | | | | | | | | | It is best practice to use `/usr/bin/env python3` instead of a hard coded path. This will search for "python3" in the PATH environment variable. Most Linux distributions install python to "/usr/bin". Most BSDs to "/usr/local/bin". Signed-off-by: Stefan Hagen <github@textmail.me> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Remove unused argument from wins_other_status_pageLars Henriksen2017-11-033-3/+3
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Release 4.3.0v4.3.0Lukas Fleischer2017-11-023-2/+83
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* po/: Translation updates from TransifexLukas Fleischer2017-11-02222-1470/+1698
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* test/Makefile.am: Add missing data file to EXTRA_DISTLukas Fleischer2017-11-021-0/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>