Czech translation update (via transifex.net)
[cinaest] / src / plugins / calendar-backend-adapter.cc
1 /* This file is part of Cinaest.
2  *
3  * Copyright (C) 2009 Philipp Zabel
4  *
5  * Cinaest is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * Cinaest is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with Cinaest. If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #include <CEvent.h>
20 #include <CMulticalendar.h>
21 #include <CalendarErrors.h>
22 #include <ctime>
23
24 using namespace std;
25
26 extern "C" {
27
28         int calendar_backend_add_event (char* summary,
29                                         char* description,
30                                         char* location,
31                                         time_t start,
32                                         time_t end)
33         {
34                 CMulticalendar* MC = CMulticalendar::MCInstance ();
35                 CCalendar* C = MC->getDefaultCalendar ();
36                 int id = C->getCalendarId ();
37                 int error = 0;
38
39                 CEvent* E = new CEvent (summary, description, location, start, end);
40
41                 MC->addEvent (E, id, error);
42
43                 delete E;
44
45                 if (error != CALENDAR_OPERATION_SUCCESSFUL) {
46                         return error;
47                 } else {
48                         return 0;
49                 }
50         }
51
52 }