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
25 /* Calendar statuses */
26 #define SIPE_CAL_FREE 0
27 #define SIPE_CAL_TENTATIVE 1
28 #define SIPE_CAL_BUSY 2
29 #define SIPE_CAL_OOF 3
30 #define SIPE_CAL_NO_DATA 4
32 struct sipe_cal_event
{
43 sipe_cal_event_free(struct sipe_cal_event
* cal_event
);
46 * Returns hash of Calendar Event for comparison.
48 * Must be g_free()'d after use.
51 sipe_cal_event_hash(struct sipe_cal_event
* event
);
54 * Describes Calendar event in human readable form.
56 * Must be g_free()'d after use.
59 sipe_cal_event_describe(struct sipe_cal_event
* cal_event
);
62 * Converts struct tm to Epoch time_t considering timezone.
64 * @param tz as defined for TZ environment variable.
66 * Reference: see timegm(3) - Linux man page
69 sipe_mktime_tz(struct tm
*tm
,
73 * Converts hex representation of freebusy string as
74 * returned by Exchange Web Services to
75 * condenced and base64 encoded form
77 * Must be g_free()'d after use.
80 sipe_cal_get_freebusy_base64(const char* freebusy_hex
);
82 /** Contains buddy's working hours information */
83 struct sipe_cal_working_hours
;
86 * Parses Working Hours from passed XML piece
87 * and creates/fills struct sipe_cal_working_hours in struct sipe_buddy
90 sipe_cal_parse_working_hours(xmlnode
*xn_working_hours
,
91 struct sipe_buddy
*buddy
);
94 * Frees struct sipe_cal_working_hours
97 sipe_cal_free_working_hours(struct sipe_cal_working_hours
*wh
);
100 * Returns user calendar information in text form.
101 * Example: "Currently Busy. Free at 13:00"
104 sipe_cal_get_description(struct sipe_buddy
*buddy
);
107 * Returns calendar status SIPE_CAL_* at time specified.
108 * Returns SIPE_CAL_NO_DATA if no calendar data availible.
110 * @param since (out) Returns beginning time of the status.
113 sipe_cal_get_status(struct sipe_buddy
*buddy
,
114 time_t time_in_question
,
118 * Returns calendar event at time in question.
119 * If conflict, takes last event in the following
120 * priority order: OOF, Busy, Tentative.
122 struct sipe_cal_event
*
123 sipe_cal_get_event(GSList
*cal_events
,
124 time_t time_in_question
);