118 Commits

Author SHA1 Message Date
Baptiste Jonglez
7850f6ddf1 src/apoint.c: Update in-notify-bar help for new duration syntax
Signed-off-by: Baptiste Jonglez <baptiste@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-07 12:30:56 +01:00
Baptiste Jonglez
71e05b1dcf src/apoint.c: Fix a length bug introduced by new duration format
Commit 4ff3bb9d introduced a new format for parsing durations, thus
allowing a larger string to be retrieved from user input.

However, the string used is still declared with the old length,
leading to crashes when compiling with stack-smashing protection
features (the default on Archlinux). Inputting a duration string of
more than 8 characters (such as "+1d11h11m") would crash calcurse with
a *** stack smashing detected *** message.

Using a larger string from the start fixes the bug.

Signed-off-by: Baptiste Jonglez <baptiste@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-07 12:30:56 +01:00
Lukas Fleischer
dfe835190f src/apoint.c: Remove several unneeded variables
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-12-05 00:48:47 +01:00
Lukas Fleischer
d32d811623 src/apoint.c: Remove apoint_recur_s2apoint_s()
This one is hackish, obsolete and no longer used by any other function.
Drop it!

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-14 11:08:14 +01:00
Lukas Fleischer
edad2f39db Removed unused parameter from apoint_sec2str()
This is no longer needed as of commit 2d89d336.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-14 11:08:14 +01:00
Lukas Fleischer
41c33eeb44 Use a global configuration variable
This is one of the few valid use cases for a global variable. No need to
make it pseudo-local and pass it from one function to another.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-14 11:08:14 +01:00
Lukas Fleischer
6f01c7af97 Remove parentheses from return statements
No reason to use "return (x);" here. Refer to the GNU coding guidelines
for details. Created using following semantic patch:

    @@
    expression expr;
    @@

    - return (expr);
    + return expr;

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-02 19:38:38 +01:00
Lukas Fleischer
7cc6305588 Do not cast unused return values to void
A small style fix that removes all remaining "(void)" casts. Using these
isn't encouraged in GNU coding guidelines and doesn't serve a certain
purpose, except for satisfying a few static code analysis tools. We
already nuked some of these in previous patches, but this semantic patch
should fix what's left:

    @@
    identifier func;
    @@

    - (void)func (
    + func (
    ...);

Long lines were re-formatted manually.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-02 18:32:17 +01:00
Lukas Fleischer
44bc9605d6 Avoid use of printf()/fprintf()
Use one of the following functions where appropriate:

* puts() (whenever we print hard coded strings to stdout)
* fputs() (whenever we print hard coded strings to a stream)
* putchar() (whenever we print a single character to stdout)
* fputc() (whenever we print a single character to a stream)
* strncpy() (whenever we copy hard coded strings to a buffer)

This removes the overhead introduced by the format string parser and
reduces the number of false positive C-format strings spotted by
xgettext(1)'s heuristics.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-02 18:31:10 +01:00
Lukas Fleischer
2d89d33668 src/apoint.c: Format recurrent multi-day items properly
Enable "..:.." formatting for recurrent appointments that last beyond
midnight. Apart from our recurrent item handler being a tad broken,
there is no reason not to do the same thing we already do with regular
appointments here.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-21 08:58:53 +02:00
Lukas Fleischer
3e84074ae5 Make events start on 00:00 (12:00 a.m.)
There is absolutely no reason to make events start on noon, 12:00.
Switching to 00:00 seems totally reasonable here, and makes event
handling a bit easier, also.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-21 08:58:53 +02:00
Lukas Fleischer
6e5ae6562d src/apoint.c: Resize duration input field
Now that we support more powerful duration strings, we should also
resize the input field for duration strings. Twelve characters is enough
space for "+999d23h59m".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06 12:37:07 +02:00
Lukas Fleischer
39dd3c251d Use parse_{time,duration}() where appropriate
Make use of these new helpers at various places. Note that this patch
implies a few behavioural changes:

* Short forms such as "23:" and ":45" are allowed when entering times.

* Durations always need to be prefixed with a plus sign ("+"), with the
  nice side effect that you can now use "+3:30" to declare an
  appointment that lasts three hours and thirty minutes (that's much
  more convenient than "+210").

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
ba2aa5167b Add count parameter to *_{in,de}crease()
This allows for moving more than one item up/down.

This currently isn't used anywhere but will be bound to a key with one
of the following patches.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
70a488a64e Remove temporary highlight pointers
Add an additional check to apoint_update_panel() and todo_update_panel()
and only highlight currently selected items if the corresponding panel
is active. This allows us to remove all the highlight pointer juggling
that we used whenever the panel selection changed.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06 12:37:05 +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
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
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
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
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
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
57b62a1e49 Use do-while loops when reading start time and duration in apoint_add().
Using do-while loops seems more appropriate here as "item_time" hasn't
even been read when either of the loops are entered. Spotted by
clang-analyzer.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12 12:02:39 +02:00
Lukas Fleischer
5fc6d92866 Remove some more dead assignments spotted by clang-analyzer.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12 12:02:38 +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
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
2030a0563c Parse appointment end times correctly if they date back.
End times used to be parsed incorrectly if start and end time's hour
components were equal, but the end time was smaller than the start time.
This is fixed by comparing the minute components as well in case of
equal hour components.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-13 12:57:55 +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
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
a8cb1c92ef All headers gathered into a single one. Typedefs suppressed. 2010-03-20 10:54:41 +00:00
Frederic Culot
5dcc213c16 Make use of erase_note() whenever possible. 2009-07-19 08:19:37 +00:00
Frederic Culot
5694955002 stdbool header removed, unsigned type used instead 2009-07-12 16:21:57 +00:00
Frederic Culot
27b25548a4 Switch to BSD license. 2009-07-05 20:33:13 +00:00
Frederic Culot
3f6aff84e6 The buffer should be allocated dynamically, but I am quite busy right now :'( Anyway, thanks Kamil for feedback 2009-05-22 19:59:17 +00:00
Frederic Culot
936b6fe373 more code cleanup 2009-01-03 21:32:10 +00:00
Frederic Culot
bf3bce0ab2 code cleanup 2009-01-02 22:28:53 +00:00
Frederic Culot
aa7d6c5eb7 various bugfixes 2009-01-02 19:52:32 +00:00
Frederic Culot
cac30a7e14 cut/paste feature aded
fixed a 2-years old bug that made repeated items with exceptions to load
uncorrectly in some cases (thanks Jan for reporting it)
2009-01-01 17:50:41 +00:00
Frederic Culot
5352496984 Added wrappers around libc's memory management functions, to easily debug memory usage 2008-12-28 13:13:58 +00:00
Frederic Culot
b1d3178bba small bugfixes and a major one (freeze when deleting an appointment's note, thanks Jan for reporting it) 2008-12-15 20:02:00 +00:00
Frederic Culot
65ec1bb0fa small bugfixes and code cleanup 2008-12-14 15:54:50 +00:00
Frederic Culot
53db22a380 code cleanup 2008-12-12 20:44:50 +00:00
Frederic Culot
639058740a Checks added while loading key bindings configuration. 2008-12-07 09:20:38 +00:00
Frederic Culot
9d4899110a More work on implementing user-definable keybindings 2008-11-16 17:42:53 +00:00
Frederic Culot
2341c90003 some memory leaks fixed using valgrind and some minor code cleanup 2008-04-19 21:04:47 +00:00
Frederic Culot
efd782699b Yet another style for source code. GNU style now used (I am fed up with tabs...) 2008-04-12 21:14:03 +00:00
Frederic Culot
407a262938 Code parts related to item update rewritten 2008-01-20 10:45:38 +00:00
Frederic Culot
738a3a4170 Ability to attach notes to appointments and events added 2008-01-13 12:40:45 +00:00
Frederic Culot
478b2762e6 Ability to attach notes to todo items added 2007-12-30 16:27:58 +00:00