2 * Copyright (C) 2012-2013 Andy Spencer <andy753421@gmail.com>
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.
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.
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/>.
29 .desc = "dummy calendar",
32 static event_t event = {
34 .start = {2012, OCT, 0, 12, 0},
35 .end = {2012, OCT, 0, 13, 0},
36 .name = "dummy event",
37 .desc = "this event is random and does not exist",
40 static todo_t todo = {
43 .desc = "this todo is random and does not exist",
44 .due = {2012, OCT, 0, 13, 0},
51 void dummy_config(const char *group, const char *name, const char *key, const char *value)
53 if (match(group, "dummy") && match(key, "enable"))
54 enable = get_bool(value);
58 cal_t *dummy_cals(void)
64 event_t *dummy_events(date_t start, date_t end)
66 event_t *last = &event;
67 for (int i = 0; i < 8; i++) {
68 last->next = new0(event_t);
69 last->next->cal = event.cal;
70 last->next->start = event.start;
71 last->next->end = event.end;
72 last->next->name = strcopy(event.name);
73 last->next->desc = strcopy(event.desc);
75 date_t *s = &last->next->start;
76 date_t *e = &last->next->end;
77 add_days(&s->year, &s->month, &s->day, 7*i);
78 add_days(&e->year, &e->month, &e->day, 7*i);
83 return enable ? event.next : 0;
87 todo_t *dummy_todos(date_t start, date_t end)
90 for (int i = 0; i < 6; i++) {
91 last->next = new0(event_t);
92 last->next->cal = todo.cal;
93 last->next->name = strcopy(todo.name);
94 last->next->desc = strcopy(todo.desc);
95 last->next->due = todo.due;
96 last->next->status = todo.status;
100 return enable ? todo.next : 0;