l10n: Updates to Portuguese (Brazilian) (pt_BR) translation
[siplcs.git] / src / core / sipe-cal.h
blob0af2644eb9c301292d9b75d84024026bb20c0b21
1 /**
2 * @file sipe-cal.h
4 * pidgin-sipe
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:
26 * <time.h>
27 * <glib.h>
30 /* Forward declarations */
31 struct sipe_buddy;
32 struct _sipe_xml;
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 {
42 time_t start_time;
43 time_t end_time;
44 /* SIPE_CAL_* */
45 int cal_status;
46 char *subject;
47 char *location;
48 int is_meeting;
51 void
52 sipe_cal_event_free(struct sipe_cal_event* cal_event);
54 /**
55 * Returns hash of Calendar Event for comparison.
57 * Must be g_free()'d after use.
59 char *
60 sipe_cal_event_hash(struct sipe_cal_event* event);
62 /**
63 * Describes Calendar event in human readable form.
65 * Must be g_free()'d after use.
67 char *
68 sipe_cal_event_describe(struct sipe_cal_event* cal_event);
70 /**
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
77 time_t
78 sipe_mktime_tz(struct tm *tm,
79 const char* tz);
81 /**
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.
87 */
88 char *
89 sipe_cal_get_freebusy_base64(const char* freebusy_hex);
91 /** Contains buddy's working hours information */
92 struct sipe_cal_working_hours;
94 /**
95 * Parses Working Hours from passed XML piece
96 * and creates/fills struct sipe_cal_working_hours in struct sipe_buddy
98 void
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
105 void
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"
112 char *
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,
124 time_t *since);
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);