171 Commits

Author SHA1 Message Date
Lukas Fleischer
711d5dea20 Add configuration option to run the GC on exit
If "auto_gc" is enabled, the garbage collector for note files will be
run on every exit. As this is an experimental feature and may cause data
loss, this is disabled by default.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-05 12:25:48 +02:00
Lukas Fleischer
6c7edfbb86 Do not unlink() note files on note removal
Now that we use hash-based note file names, note files should never be
unlinked as a note file might be shared.

Also, remove the ERASE_FORCE_KEEP_NOTE flag that no longer makes any
sense.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-05 12:25:47 +02:00
Lukas Fleischer
c77d1a573f Use hash-based file names in ical_read_note()
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-05 12:25:47 +02:00
Lukas Fleischer
2fe7a36aab Accept variable length note names
Read up to the first blank in note_read() instead of assuming a
fixed-width note file name. Accept everything up to 40 characters (which
is the length of a SHA1 hash in hexadecimal representation).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-05 12:25:47 +02:00
Lukas Fleischer
bc97d60ef2 Refactor out note deserialization
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-05 12:25:47 +02:00
Lukas Fleischer
c7b56ca556 Add a copy file routine
Add io_file_cp() which can be used to copy an existing source file to
another location. We will need this for our new hash-based note file
names.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-05 12:25:47 +02: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
78b663d073 Merge branch 'maint'
Conflicts:
	src/io.c
2011-09-06 14:56:17 +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
45417bc6f0 Add configuration option to notify all appointments
If "notify-all" is enabled, all non-flagged appointments will be
notified (instead of flagged ones). This is useful for users that want
to be notified of everything.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-31 03:23:32 +02:00
Lukas Fleischer
54813eef19 Merge branch 'maint' 2011-07-28 13:38:12 +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
a232c9af33 Use gettext plural features
Make use of the plural features of gettext to handle plural forms
correctly instead of using the plural form even if the singular form
should be used.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-24 21:13:14 +02:00
Lukas Fleischer
e121ded3a5 Split stats messages in io_import_data()
Use separate format strings for separate values. This is useful in case
we want to output similar stats somewhere else and is a preparation for
supporting plural forms.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-24 21:00:59 +02:00
Lukas Fleischer
9d41f8e5b3 Use single-line configuration settings by default
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-15 18:47:43 +02:00
Lukas Fleischer
b362c17daa Skip indentation and comments in io_extract_data()
We actually only use this function to parse configuration data.
Currently, this probably is the best way to do some common
preprocessing.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-15 18:13:45 +02:00
Lukas Fleischer
ab4c4dee76 Remove artificial delay when saving data
This doesn't contribute to functionality or usability in any way. Keep
the progress bar option but only show bars as long as the actual save
operation is in progress.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-14 18:23:31 +02:00
Lukas Fleischer
160f12687e Merge branch 'maint' 2011-07-10 19:04:49 +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
3076670a76 Refactor out todo item serialization
Add a todo_write() function that allows one to serialize todo items and
write serialized data to an output stream in a fashion similar to
apoint_write() and event_write().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02 10:15:35 +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
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
fb5f9d0155 Use generic lists for recurring item exceptions.
Rename "days" structure to "excp" which seems to be a better name here.
Use generic linked lists of excp structures instead of using the "days"
structure which again contains a linked list implementation. Do some
cleanups and invocation fixes.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:36 +02:00
Lukas Fleischer
9fab24818a Use generic lists for recurring apointments and events.
Use them instead of "recur_apoint_list" and "next" pointers in
"recur_event" type variables. Includes some code simplifications and
cleanups.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:35 +02:00
Lukas Fleischer
bf431d6cd9 Use generic lists for todo items.
Use the new generic list implementation instead of "next" pointers in
todo items.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
6f883c0f3f Use generic lists for events.
Use the new generic list implementation instead of those insane "next"
pointers in events. Includes some cleanups.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
77ef3fe76e Use generic lists for appointments.
Use the new generic list implementation instead of "apoint_list"
everywhere. Simplify stuff and drop unused variables as well.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:33 +02:00
Lukas Fleischer
cc49f1e262 Fix io_file_is_empty() behaviour when file starts with a newline.
Read second byte if the first byte is a newline character to ensure the
file doesn't contain any further data.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12 18:31:48 +02:00
Lukas Fleischer
b9c1969126 Drop empty notes after editing.
Keeping empty notes doesn't make sense here. Also, there doesn't seem to
be a simple way to erase notes yet. This will make calcurse delete any
notes that are empty (meaning that they are either 0-byte files or
contain nothing but a newline character) when returning from the editor.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12 12:02:23 +02:00
Lukas Fleischer
6fb0f6f4c6 Compare pointers to "NULL" instead of "0".
"bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-05 09:27:04 +02:00
Erik Saule
6ff9523876 ignore the lock file if the pointed process is dead.
Lukas: Small formatting and logic changes.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-29 10:35:14 +02:00
Lukas Fleischer
9c9fd5da15 Overall indentation fixes.
Use spaces instead of tabs for source code indentation only, strip
trailing whitespaces from lines.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-14 19:03:53 +01:00
Lukas Fleischer
c22dcaf6be Update website links to match the new URL.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:49 +01:00
Lukas Fleischer
73e9649387 Update mail addresses to match the new mailing lists.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:40 +01:00
Lukas Fleischer
061f74108b Simplify str_toupper() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 08:54:01 +01:00
Lukas Fleischer
91c9cac898 Remove CVS "$Id" headers.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03 16:19:45 +01:00
Lukas Fleischer
56b9cbcb84 Fixed file permissions. 2011-03-03 12:21:16 +01:00
Frederic Culot
6892b59622 Avoid concurrent screen refreshes. 2010-03-21 10:17:03 +00:00
Frederic Culot
cc77e839d8 More work on sidebar customization. 2010-03-21 09:21:06 +00:00
Frederic Culot
a8cb1c92ef All headers gathered into a single one. Typedefs suppressed. 2010-03-20 10:54:41 +00:00
Frederic Culot
9ac8389823 Check for data directory availability added (thanks Brandon for reporting this bug). 2009-11-01 11:06:37 +00:00
Frederic Culot
758d5ff035 Code to save the calendar default view in the configuration file. 2009-10-28 15:15:43 +00:00
Frederic Culot
220f49f206 Memory leak fixed in ical_read_note. 2009-08-09 16:00:01 +00:00
Frederic Culot
989b6c885f Save and restore daemon configuration options. 2009-08-01 17:44:51 +00:00
Frederic Culot
35e4aa61c7 bugfixes 2009-07-29 18:20:54 +00:00
Frederic Culot
4f0c71585d io_file_exist(): new function 2009-07-27 21:00:41 +00:00
Frederic Culot
bccd37ef96 --status flag added 2009-07-26 20:26:14 +00:00
Frederic Culot
3d23af73c0 More work on implementing calcurse daemon. 2009-07-26 12:47:15 +00:00
Frederic Culot
23817b6b7d Incorrect duration format when exporting to ical (thanks Chris for reporting it). 2009-07-23 19:16:03 +00:00