2 * Copyright (C) 2012 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/>.
28 .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 event_t *dummy_events(date_t start, date_t end)
60 event_t *last = &event;
61 for (int i = 0; i < 8; i++) {
62 last->next = new0(event_t);
63 last->next->cal = event.cal;
64 last->next->start = event.start;
65 last->next->end = event.end;
66 last->next->name = strcopy(event.name);
67 last->next->desc = strcopy(event.desc);
69 date_t *s = &last->next->start;
70 date_t *e = &last->next->end;
71 add_days(&s->year, &s->month, &s->day, 7*i);
72 add_days(&e->year, &e->month, &e->day, 7*i);
77 return enable ? event.next : 0;
81 todo_t *dummy_todos(date_t start, date_t end)
84 for (int i = 0; i < 6; i++) {
85 last->next = new0(event_t);
86 last->next->cal = todo.cal;
87 last->next->name = strcopy(todo.name);
88 last->next->desc = strcopy(todo.desc);
89 last->next->due = todo.due;
90 last->next->status = todo.status;
94 return enable ? todo.next : 0;