]> Pileus Git - lackey/blob - src/cal.h
13b12d04c8bbdff9d080aa29b39b5f496b1d83e3
[lackey] / src / cal.h
1 /*
2  * Copyright (C) 2012-2013 Andy Spencer <andy753421@gmail.com>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 /* Cal status types */
19 typedef enum {
20         NEW  = 0,
21         DONE = 100,
22 } status_t;
23
24 /* Calendar type */
25 typedef struct cal_t {
26         char         *type;
27         char         *name;
28         char         *desc;
29         struct cal_t *next;
30 } cal_t;
31
32 /* Calendar item types */
33 typedef struct event_t {
34         char           *name;
35         char           *desc;
36         char           *loc;
37         char           *cat;
38         date_t          start;
39         date_t          end;
40         const cal_t    *cal;
41         struct event_t *next;
42         struct event_t *prev;
43 } event_t;
44
45 typedef struct todo_t {
46         char          *name;
47         char          *desc;
48         char          *cat;
49         status_t       status;
50         date_t         start;
51         date_t         due;
52         cal_t         *cal;
53         struct todo_t *next;
54         struct todo_t *prev;
55 } todo_t;
56
57 /* Global data */
58 extern cal_t   *CAL,   *CALS;
59 extern event_t *EVENT, *EVENTS;
60 extern todo_t  *TODO,  *TODOS;
61
62 /* Calendar functions */
63 void cal_init(void);
64 void cal_load(year_t year, month_t month, day_t day, int days);
65 void cal_config(const char *group, const char *name, const char *key, const char *value);