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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
/* -*- Mode: idl; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// XXX use strings for kind values instead of enumerated constants?
#include "nsISupports.idl"
interface calIItemBase;
interface calIDateTime;
interface calIDuration;
interface calITimezone;
interface calIIcalProperty;
interface nsIInputStream;
/**
* General notes:
*
* As with libical, use of getNextFoo(footype) is only valid if there have been
* no intervening getNextFoo(otherfootype)s, or removeFoo()s, or addFoo()s. In
* general, you want to do as little manipulation of your FooContainers as
* possible while iterating over them.
*/
[scriptable,uuid(59132cf2-e48c-4807-ab53-779f414a7fbc)]
interface calIIcalComponent : nsISupports
{
/**
* The parent ical property
*/
readonly attribute calIIcalComponent parent;
/**
* Access to the inner ical.js objects. Only use these if you know what you
* are doing.
*/
attribute jsval icalComponent;
attribute jsval icalTimezone;
/**
* This is the value that an integer-valued getter will provide if
* there is no such property on the wrapped ical structure.
*/
const int32_t INVALID_VALUE = -1;
/**
* @param kind ANY, XROOT, VCALENDAR, VEVENT, etc.
*/
calIIcalComponent getFirstSubcomponent(in AUTF8String componentType);
calIIcalComponent getNextSubcomponent(in AUTF8String componentType);
readonly attribute AUTF8String componentType;
attribute AUTF8String uid;
attribute AUTF8String prodid;
attribute AUTF8String version;
/**
* PUBLISH, REQUEST, REPLY, etc.
*/
attribute AUTF8String method;
/**
* TENTATIVE, CONFIRMED, CANCELLED, etc.
*/
attribute AUTF8String status;
attribute AUTF8String summary;
attribute AUTF8String description;
attribute AUTF8String location;
attribute AUTF8String categories;
attribute AUTF8String URL;
attribute int32_t priority;
attribute calIDateTime startTime;
attribute calIDateTime endTime;
readonly attribute calIDuration duration;
attribute calIDateTime dueTime;
attribute calIDateTime stampTime;
attribute calIDateTime createdTime;
attribute calIDateTime completedTime;
attribute calIDateTime lastModified;
/**
* The recurrence ID, a.k.a. DTSTART-of-calculated-occurrence,
* or null if this isn't an occurrence.
*/
attribute calIDateTime recurrenceId;
AUTF8String serializeToICS();
/**
* Return a string representation of this instance.
*/
AUTF8String toString();
/**
* Serializes this component (and subcomponents) directly to an
* input stream. Typically used for performance to avoid
* unnecessary conversions and XPConnect traversals.
*
* @result an input stream which can be read to get the serialized
* version of this component, encoded in UTF-8. Implements
* nsISeekableStream so that it can be used with
* nsIUploadChannel.
*/
nsIInputStream serializeToICSStream();
void addSubcomponent(in calIIcalComponent comp);
// If you add then remove a property/component, the referenced
// timezones won't get purged out. There's currently no client code.
// void removeSubcomponent(in calIIcalComponent comp);
/**
* @param kind ANY, ATTENDEE, X-WHATEVER, etc.
*/
calIIcalProperty getFirstProperty(in AUTF8String kind);
calIIcalProperty getNextProperty(in AUTF8String kind);
void addProperty(in calIIcalProperty prop);
// If you add then remove a property/component, the referenced
// timezones won't get purged out. There's currently no client code.
// void removeProperty(in calIIcalProperty prop);
/**
* Timezones need special handling, as they must be
* emitted as children of VCALENDAR, but can be referenced by
* any sub component.
* Adding a second timezone (of the same TZID) will remove the
* first one.
*/
void addTimezoneReference(in calITimezone aTimezone);
/**
* Returns an array of VTIMEZONE components.
* These are the timezones that are in use by this
* component and its children.
*/
Array<calITimezone> getReferencedTimezones();
/**
* Clones the component. The cloned component is decoupled from any parent.
* @return cloned component
*/
calIIcalComponent clone();
};
[scriptable,uuid(5b13a69c-53d3-44a0-9203-f89f7e5e1604)]
interface calIIcalProperty : nsISupports
{
/**
* The whole property as an ical string.
* @exception Any error will be thrown as an calIError::ICS_ error.
*/
readonly attribute AUTF8String icalString;
/**
* Access to the inner ical.js objects. Only use these if you know what you
* are doing.
*/
attribute jsval icalProperty;
/**
* The parent component containing this property
*/
readonly attribute calIIcalComponent parent;
/**
* Return a string representation of this instance.
*/
AUTF8String toString();
/**
* The value of the property as string.
* The exception for properties of TEXT or X- type, those will be unescaped
* when getting, and also expects an unescaped string when setting.
* Datetime, numeric and other non-text types are represented as ical string
*/
attribute AUTF8String value;
/**
* The value of the property in (escaped) ical format.
*/
attribute AUTF8String valueAsIcalString;
/**
* The value of the property as date/datetime value, keeping
* track of the used timezone referenced in the owning component.
*/
attribute calIDateTime valueAsDatetime;
// XXX attribute AUTF8String stringValueWithParams; ?
readonly attribute AUTF8String propertyName;
AUTF8String getParameter(in AUTF8String paramname);
void setParameter(in AUTF8String paramname, in AUTF8String paramval);
AUTF8String getFirstParameterName();
AUTF8String getNextParameterName();
void removeParameter(in AUTF8String paramname);
void clearXParameters();
};
[scriptable,uuid(eda9565f-f9bb-4846-b134-1e0653b2e767)]
interface calIIcsComponentParsingListener : nsISupports
{
/**
* Called when the parsing has completed.
*
* @param rc The result code of parsing
* @param rootComp The root ical component that was parsed
*/
void onParsingComplete(in nsresult rc, in calIIcalComponent rootComp);
};
[scriptable,uuid(31e7636b-5a64-4d15-bc60-67b67cd85176)]
interface calIICSService : nsISupports
{
/**
* Parse an ICS string into components.
*
* @param serialized an ICS string
*/
calIIcalComponent parseICS(in AUTF8String serialized);
/**
* Asynchronously parse an ICS string into components.
*
* @param serialized an ICS string
* @param listener The listener that notifies the root component
*/
void parseICSAsync(in AUTF8String serialized,
in calIIcsComponentParsingListener listener);
calIIcalComponent createIcalComponent(in AUTF8String kind);
calIIcalProperty createIcalProperty(in AUTF8String kind);
calIIcalProperty createIcalPropertyFromString(in AUTF8String str);
};
|