902 Commits

Author SHA1 Message Date
Lukas Fleischer
162b871682 src/notify.c: Fix printf() misuse
Make sure we actually copy the notification warning interval to the
correct buffer instead of printing it to stdout (using an arbitrary
format string). This makes sure the current warning interval is shown
when editing the field and also eliminates a potential format string
vulnerability.

Spotted with "-Wformat-nonliteral".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-19 14:32:43 +02:00
Jérôme Pinot
9a85b790aa Format "DURATION" field properly on ical export
Use days/hours/minutes/seconds instead of seconds in the DURATION field.
It fixes interaction with other softwares like phpicalendar.

Lukas: Remove use of dur-week. RFC 5545 states that you cannot use this
in conjunction with dur-day. Also, fix formatting and use proper
constants.

Signed-off-by: Jerome Pinot <ngc891@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-12-16 15:12:17 +01:00
Lukas Fleischer
5e4db62662 src/io.c: Avoid use of memcpy()
Use strncpy() and a proper limit, which ensures we never read more
characters than the buffer can hold. Also, ensure we always
null-terminate strings here.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-11 12:18:16 +01:00
Lukas Fleischer
120f434967 src/io.c: Null-terminate the ical_readline() buffer
Ensure we always return with a null-terminated buffer, even if we read
more than BUFSIZ characters.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-11 12:16:35 +01:00
Lukas Fleischer
3aefd00f6a Cleanup joinable threads on termination
Always invoke pthread_join() when we blow up a thread via
pthread_cancel() (avoid zombie threads).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-04 12:26:42 +02:00
Lukas Fleischer
4cd62fb0fb src/io.c: Update todo item count on iCal import
Update the number of todo items when importing an iCal file to prevent
some items from being inaccessible.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-04 11:07:33 +02:00
Lukas Fleischer
c41eda256d Do not hardcode paths to the default editor/pager
Use "vi" instead of "/usr/bin/vi" and "less" instead of "/usr/bin/less".
Hardcoding absolute paths is a bad idea:

    $ uname -rsv
    Linux 3.0-ARCH #1 SMP PREEMPT Tue Aug 30 07:32:23 UTC 2011
    $ which less
    /bin/less

The "$PATH" environment variable will almost always have a better idea
of where these binaries are located.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-04 11:05:43 +02:00
Lukas Fleischer
9f1fed3ed1 Release 2.9.2
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-09-06 14:55:30 +02:00
Lukas Fleischer
2d298dcd5f Update translations
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-09-06 14:37:56 +02:00
Lukas Fleischer
ac50b5a111 Add a configure setting to skip "doc/"
This should fix all remaining build issues with documentation
generation. Finally.

The new "--disable-docs" option should be used to skip documentation
completely, whereas "--without-asciidoc" can be used if both manual and
man page should not be rebuilt. As a consequence, "--without-asciidoc"
can only be combined with "--enable-docs" if ready-made documentation
already exists in "doc/". This is true for release tarballs (where we
include prebuilt documentation for the sake of portability and
simplicity), as well as for Git checkouts where the documentation has
already been built earlier.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-09-03 02:19:32 +02:00
Lukas Fleischer
b59070a49e Rework indentation code in print_notefile()
Do not use snprintf() here as printf() behaviour is undefined if the
destination pointer is used as a parameter.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-08-26 12:14:03 +02:00
Lukas Fleischer
806a13ed8a src/io.c: iCal content line folding correctness
This is a rather invasive change that introduces correct line folding to
our iCal parser.

From now on, ical_readline() should be used instead of fgets() to read
lines from an iCal file as it unfolds lines automatically. We also need
to use shared buffers as each ical_readline() invocation eats up the
first part of the next line and stores it in the "lstore" buffer.
Subsequent ical_readline() invocations copy the contents of this buffer
and append continuation lines. We currently use a single buffer pair
that is allocated in io_import_data() and pass it to all subroutines.

ical_readline_init() needs to be called once for every buffer pair. It
reads the first part of the current line and writes to "lstore",
clearing the target buffer at the same time.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-08-26 11:57:30 +02:00
Lukas Fleischer
de85010edc Release 2.9.1
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-31 02:55:56 +02:00
Lukas Fleischer
2336066855 Update translations files
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-31 02:55:56 +02:00
Lukas Fleischer
13a41f8e0a Fix sort order in app_arg()
We used to iterate over the list of regular appointments and the list of
recurrent appointments in separate loops, thus leading to recurrent
appointments being printed first and regular appointments being printed
afterwards, regardless of their start and end times. Merge these loops
to coerce precedence of the start time.

There's still a fair bit of hackery in here - we will fix that later.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-30 21:10:53 +02:00
Lukas Fleischer
709525cf8d Fix apoint_get() call in apoint_switch_notify()
We passed the function arguments the wrong way round. This regression
was introduced in commit 77ef3fe76e4ce4c9a990e8a5904ad2d83420ca02.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-29 20:38:59 +02:00
Lukas Fleischer
1a849cfb8e Fix notify_check_repeated()
Remove the "current_time" check from the first if condition. As "greater
than" relations (">") have higher precedence than assignments ("=") in
C, this caused "real_app_time" to always be one or zero which definitely
isn't what we want here. Reading further down, it turns out that we
don't even need this comparison here, so we should be fine removing it.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-29 20:38:59 +02:00
Lukas Fleischer
1da88589b2 Fix recurrent appointment notification
We probably broke this in 9fab24818a119aef08b9726f6c1cd31d5434ce34.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-29 20:38:59 +02:00
Lukas Fleischer
0126cbd1b3 Update the notification item in *_paste_item()
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-29 20:38:59 +02:00
Lukas Fleischer
cce0acbe00 Update the notification item in day_edit_item()
Ensure the start time as well as the description of the notification
appointment are synced after editing it.

We use notify_check_next_app()'s force parameter to ensure that the
notification item is updated even if only the description was modified.

Reported-by: Andraž 'ruskie' Levstik <ruskie@codemages.net>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-29 20:38:43 +02:00
Lukas Fleischer
5a5c6d2604 Add "force" parameter to notify_check_next_app()
This allows to force notify_check_next_app() to update the notification
appointment, even if start times are equal (e.g. if the item description
was changed).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-29 20:28:30 +02:00
Lukas Fleischer
8681af3c6d io.c: Accept resource parameters in iCal import
Remove colons from the "SUMMARY:" and "DURATION:" search patterns in
ical_read_event() to allow for additional parameters (such as language
parameters, cf. RFC 5545).

Reported-by: Andraž 'ruskie' Levstik <ruskie@codemages.net>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-28 13:37:16 +02:00
Lukas Fleischer
0c4e9d3f00 Invoke vars_init() before importing data with "-i"
We forgot to call vars_init() when importing an item using the "-i"
command line argument, which led to the pager configuration variable
being unset and hence the pager invocation (triggered to show the log in
case there are any errors during import) failing.

Fix this by calling vars_init() before io_import_data().

Reported-by: Andraž 'ruskie' Levstik <ruskie@codemages.net>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-28 13:36:30 +02:00
Lukas Fleischer
34f094312f Honor "TMPDIR" environment variable
Replace all hardcoded paths referring to "/tmp" with a new function that
honors the "TMPDIR" environment variable as well as P_tmpdir and uses
"/tmp" as a fallback.

Thanks-to: Erik Saule <esaule@bmi.osu.edu>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-09 17:52:25 +02:00
Lukas Fleischer
585ed53748 doc/manual.txt: Document backward-kill-word
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-29 15:40:31 +02:00
Lukas Fleischer
0827e00247 Handle resize properly in the sidebar config menu
There used to be no resize handler in custom_sidebar_config() which
resulted in a messed up screen if the terminal was resized during
sidebar configuration. Doing a simple wins_reset() if the terminal was
resized works around this problem.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-29 15:21:05 +02:00
Lukas Fleischer
bc2bead505 Do not try to display items with negative width
Don't display anything rather than segfault if the appointment panel
becomes too small (e.g. during a terminal resize).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-28 18:28:21 +02:00
Lukas Fleischer
6c6c7d5ec0 Always work with new window dimensions on resize
This one came up after improving resizing behaviour in commit
fec37db06bbbdff79bc9816046a76e0b29e173b4. We used to use outdated width
and height values at various places without noticing it due to the
resize algorithm being called several times on every resize.

This patch ensures we retrieve the new window dimensions *before* doing
any layout calculations.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-28 18:27:52 +02:00
Lukas Fleischer
fec37db06b Avoid redundant redraws on resize
Use a global flag to record whether the terminal was resized instead of
redrawing everything each time a KEY_RESIZE is read.

Add some additional checks to help_write_pad() as invalid actions may be
passed now due to using signals instead of virtual key presses.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-28 18:22:43 +02:00
Lukas Fleischer
6636232bc7 doc/Makefile.am: Fix "--without-asciidoc"
Do not try to distribute man page and manual files if documentation
generation is disabled.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-20 19:01:30 +02:00
Lukas Fleischer
9c3a8a5a49 src/llist.c: Use stable insertion algorithm
Ensure the relative order of elements with equal keys is maintained when
inserting into a sorted list.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-20 19:01:30 +02:00
Lukas Fleischer
b2645847a0 Fix whitespace issues
Strip trailing whitespaces in all source files.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-09 21:37:22 +02:00
Lukas Fleischer
4e6e3a9c97 src/utils.c: Make bell() static
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-07 09:33:50 +02:00
Lukas Fleischer
3cd5c1d738 Release 2.9.0.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-24 11:48:24 +02:00
Lukas Fleischer
ee369c596f build-aux/git-version-gen: Ignore timestamps.
Do not declare the working tree dirty if only a timestamp has changed.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-24 11:46:34 +02:00
Lukas Fleischer
c61a63a46d Add version information to distribution tarball.
We somehow forgot this when adding Git version string support in commit
c5e4187590f37e9524a8e3fcb2bccb20f2e8b4eb.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-24 11:25:13 +02:00
Lukas Fleischer
f3e3020104 README: Add missing translators.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-24 11:25:13 +02:00
Lukas Fleischer
79deaaac35 Translation updates from Transifex.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-24 11:25:07 +02:00
Lukas Fleischer
6d2b7bd497 .tx/config: Add EOL character to the last line.
Be a little more consistent here.

Also, transifex-client will automatically add a newline character to the
last line of its config file unless it is already there.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-18 20:37:03 +02:00
Lukas Fleischer
0f03e80d03 Add missing llist header files to "_SOURCES".
We forgot to add those to the "_SOURCES" variable in commit
0eb1da8dd7fa3ae9d95e12df6058fb41a5ec1c11 and
d668963e2056027526374098efe2869a0d389b92. Spotted by `make distcheck`.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-17 10:16:32 +02:00
Lukas Fleischer
35ade5bf96 Add iCalendar keywords TODO entry.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 07:52:47 +02:00
Lukas Fleischer
38865b8e48 Update copyright notices in source files, documentation and "COPYING".
* Update copyright dates (use 2004-2011 as date range everywhere).

* Change copyright holder from "Frederic Culot" to "calcurse Development
  Team".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 07:26:05 +02:00
Lukas Fleischer
c9db3b7db7 TODO overhaul.
* Use AsciiDoc style formatting.

* Fix some wording. Use "we" instead of "I" and "us" instead of "me".

* Update mail addresses.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:51:27 +02:00
Lukas Fleischer
bd0be4237c README overhaul.
* Use AsciiDoc style formatting.

* Remove outdated information on the "ChangeLog" file (removed that in
  commit b9fa5bdbb17f507ba756fe38a14d5993e522bb6c).

* Replace references to language specific manual files by
  "doc/manual.html".

* Update author roles.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:51:05 +02:00
Lukas Fleischer
79353a625c Ignore daemon lock file if the daemon process died.
Do this in a fashion similar to what was done in commit
6ff95238766656c5ea9d5c65c35d3aef93499f60.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:38 +02:00
Lukas Fleischer
ddd0cb21fa Be a bit more fail-safe in "build-aux/git-version-gen".
The existence of a ".git" directory is not a sufficient condition to be
sure we are in a Git repository. Only overwrite the version information
file if `git describe` returns a non-empty string.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:38 +02:00
Lukas Fleischer
621b335179 Return -1 in io_file_is_empty() if file cannot be accessed.
Ensure files don't appear as empty if fopen() fails (e.g. on temporary
EACCES failures).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:38 +02:00
Lukas Fleischer
371f20e631 Documentation Makefile overhaul.
* Add documentation input and output files to distribution tarballs.

* Use a more generic rule to generate man pages instead of the hardcoded
  "calcurse.1" target.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:38 +02:00
Lukas Fleischer
c5e4187590 Add Git version string support.
Introduce a script to auto-generate version strings. Use `git describe`
to create descriptive version strings when building from a Git checkout,
use ".version" files for release tarballs.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:37 +02:00
Lukas Fleischer
cbd66b13b1 Use "event" structure when iterating over events in app_arg().
Regression introduced in commit
5b174ba5d46c256f41c1cfb952d46f49a088db8a.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:37 +02:00