aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util/calobj.h
blob: 00dbd5c63e9ae7dcb1f73f8161de6475db48f3d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Internal representation of a Calendar object.  This is modeled after the
 * iCalendar/vCalendar specificiation
 *
 * Authors: Miguel de Icaza (miguel@gnu.org), Federico Mena (federico@gimp.org).
 */
#ifndef CALOBJ_H
#define CALOBJ_H

#include <libgnome/libgnome.h>
#include "versit/vcc.h"

BEGIN_GNOME_DECLS

enum AlarmType {
    ALARM_MAIL,
    ALARM_PROGRAM,
    ALARM_DISPLAY,
    ALARM_AUDIO
};

enum AlarmUnit {
    ALARM_MINUTES,
    ALARM_HOURS,
    ALARM_DAYS
};

typedef struct {
    enum AlarmType type;
    int            enabled;
    int            count;
    enum AlarmUnit units;
    char           *data;

    /* Widgets */
    void           *w_count;      /* A GtkEntry */
    void           *w_enabled;    /* A GtkChecButton */
    void           *w_timesel;    /* A GtkMenu */
    void           *w_entry;      /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
    void           *w_label;
} CalendarAlarm;

/* Calendar object type */
typedef enum {
    ICAL_EVENT,
    ICAL_TODO,
    ICAL_JOURNAL,
    ICAL_FBREQUEST,
    ICAL_FBREPLY,
    ICAL_BUSYTIME,
    ICAL_TIMEZONE
} iCalType;

/* For keys that might contain binary or text/binary */
typedef struct {
    char *data;
    int  len;
} iCalValue;

typedef struct {
    int     valid;      /* true if the Geography was specified */
    double  latitude;
    double  longitude;
} iCalGeo;

typedef enum {
    ICAL_OPAQUE,
    ICAL_TRANSPARENT
} iCalTransp;

typedef char NotYet;

/*
 * This describes an iCalendar object, note that we never store durations, instead we
 * always compute the end time computed from the start + duration.
 */
typedef struct {
    iCalType      type;

    GList         *attach;      /* type: one or more URIs or binary data */
    GList         *attendee;    /* type: CAL-ADDRESS */
    GList         *categories;  /* type: one or more TEXT */
    char          *class;

    char          *comment;     /* we collapse one or more TEXTs into one */
    time_t        completed;
    time_t        created;
    GList         *contact;     /* type: one or more TEXT */
    time_t        dtstamp;
    time_t        dtstart;
    time_t        dtend;
    GList         *exdate;      /* type: one or more time_t's */
    GList         *exrule;      /* type: one or more RECUR */
    iCalGeo       geo;
    time_t        last_mod;
    char          *location;
    char          *organizer;
    int           percent;
    int           priority;
    char          *rstatus;         /* request status for freebusy */
    GList         *related;     /* type: one or more TEXT */
    GList         *resources;   /* type: one or more TEXT */
    GList         *rdate;       /* type: one or more recurrence date */
    GList         *rrule;       /* type: one or more recurrence rules */
    int           seq;
    char          *status;
    char          *summary;
    iCalTransp    transp;
    char          *uid;
    char          *url;
    time_t        recurid;

    CalendarAlarm dalarm;
    CalendarAlarm aalarm;
    CalendarAlarm palarm;
    CalendarAlarm malarm;
} iCalObject;

iCalObject *ical_new (char *comment, char *organizer, char *summary);
iCalObject *ical_object_new (void);
void        ical_object_destroy (iCalObject *ico);
iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);

END_GNOME_DECLS

#endif