summaryrefslogtreecommitdiffstats
path: root/comm/calendar/base/public/calIFreeBusyProvider.idl
blob: 5215f5499850776cf36baa9f91370293326a48a3 (plain)
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
/* 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/. */

#include "nsISupports.idl"

interface calIDateTime;
interface calIPeriod;
interface calIOperation;
interface calIGenericOperationListener;

[scriptable, uuid(EB24424C-DD22-4306-9379-FA098C61F5AF)]
interface calIFreeBusyProvider : nsISupports
{
    /**
     * Gets free/busy intervals.
     * Results are notified to the passed listener interface.
     *
     * @param aCalId      calid or MAILTO:rfc822addr
     * @param aRangeStart start time of free-busy search
     * @param aRangeEnd   end time of free-busy search
     * @param aBusyTypes  what free-busy intervals should be returned
     * @param aListener   called with an array of calIFreeBusyInterval objects
     * @return            optional operation handle to track the operation
     */
    calIOperation getFreeBusyIntervals(in AUTF8String aCalId,
                                       in calIDateTime aRangeStart,
                                       in calIDateTime aRangeEnd,
                                       in unsigned long aBusyTypes,
                                       in calIGenericOperationListener aListener);
};

/**
 * This interface reflects a free or busy interval in time.
 * Referring to RFC 2445, section 4.2.9, for the different types.
 */
[scriptable, uuid(CCBEAF5E-DB87-4bc9-8BB7-24754B76BCB5)]
interface calIFreeBusyInterval : nsISupports
{
    /**
     * The calId this free-busy period belongs to.
     */
    readonly attribute AUTF8String calId;

    /**
     * The free-busy time interval.
     */
    readonly attribute calIPeriod interval;

    /**
     * The value UNKNOWN indicates that the free-busy information for the time interval is
     * not known.
     */
    const unsigned long UNKNOWN = 0;

    /**
     * The value FREE indicates that the time interval is free for scheduling.
     */
    const unsigned long FREE = 1;

    /**
     * The value BUSY indicates that the time interval is busy because one
     * or more events have been scheduled for that interval.
     */
    const unsigned long BUSY = 1 << 1;

    /**
     * The value BUSY_UNAVAILABLE indicates that the time interval is busy
     * and that the interval can not be scheduled.
     */
    const unsigned long BUSY_UNAVAILABLE = 1 << 2;

    /**
     * The value BUSY_TENTATIVE indicates that the time interval is busy because
     * one or more events have been tentatively scheduled for that interval.
     */
    const unsigned long BUSY_TENTATIVE = 1 << 3;

    /**
     * All BUSY* states.
     */
    const unsigned long BUSY_ALL = (BUSY |
                                    BUSY_UNAVAILABLE |
                                    BUSY_TENTATIVE);

    /**
     * One of the above types.
     */
    readonly attribute unsigned long freeBusyType;
};

/**
 * This service acts as a central access point for free-busy lookup.
 * A free-busy request will be multiplexed to all added free-busy providers.
 * Adding a free-busy provider is transient.
 */
[scriptable, uuid(BE1796CF-CB53-482e-8942-D6CAA0A11BAA)]
interface calIFreeBusyService : calIFreeBusyProvider
{
    /**
     * Adds a new free-busy provider.
     */
    void addProvider(in calIFreeBusyProvider aProvider);

    /**
     * Removes a free-busy provider.
     */
    void removeProvider(in calIFreeBusyProvider aProvider);
};