6 * Copyright (C) 2009 pier11 <pier11@operamail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Interface dependencies:
30 /* Forward declarations */
34 /* Calendar statuses */
35 #define SIPE_CAL_FREE 0
36 #define SIPE_CAL_TENTATIVE 1
37 #define SIPE_CAL_BUSY 2
38 #define SIPE_CAL_OOF 3
39 #define SIPE_CAL_NO_DATA 4
41 struct sipe_cal_event
{
52 sipe_cal_event_free(struct sipe_cal_event
* cal_event
);
55 * Returns hash of Calendar Event for comparison.
57 * Must be g_free()'d after use.
60 sipe_cal_event_hash(struct sipe_cal_event
* event
);
63 * Describes Calendar event in human readable form.
65 * Must be g_free()'d after use.
68 sipe_cal_event_describe(struct sipe_cal_event
* cal_event
);
71 * Converts struct tm to Epoch time_t considering timezone.
73 * @param tz as defined for TZ environment variable.
75 * Reference: see timegm(3) - Linux man page
78 sipe_mktime_tz(struct tm
*tm
,
82 * Converts hex representation of freebusy string as
83 * returned by Exchange Web Services to
84 * condenced and base64 encoded form
86 * Must be g_free()'d after use.
89 sipe_cal_get_freebusy_base64(const char* freebusy_hex
);
91 /** Contains buddy's working hours information */
92 struct sipe_cal_working_hours
;
95 * Parses Working Hours from passed XML piece
96 * and creates/fills struct sipe_cal_working_hours in struct sipe_buddy
99 sipe_cal_parse_working_hours(const struct _sipe_xml
*xn_working_hours
,
100 struct sipe_buddy
*buddy
);
103 * Frees struct sipe_cal_working_hours
106 sipe_cal_free_working_hours(struct sipe_cal_working_hours
*wh
);
109 * Returns user calendar information in text form.
110 * Example: "Currently Busy. Free at 13:00"
113 sipe_cal_get_description(struct sipe_buddy
*buddy
);
116 * Returns calendar status SIPE_CAL_* at time specified.
117 * Returns SIPE_CAL_NO_DATA if no calendar data availible.
119 * @param since (out) Returns beginning time of the status.
122 sipe_cal_get_status(struct sipe_buddy
*buddy
,
123 time_t time_in_question
,
127 * Returns calendar event at time in question.
128 * If conflict, takes last event in the following
129 * priority order: OOF, Busy, Tentative.
131 struct sipe_cal_event
*
132 sipe_cal_get_event(GSList
*cal_events
,
133 time_t time_in_question
);